dao icon indicating copy to clipboard operation
dao copied to clipboard

sigsegv in a faulty abstract interface

Open dumblob opened this issue 10 years ago • 4 comments
trafficstars

The following should throw exception instead of sigsegv.

load time import time

interface DateTimee {
  routine add(self: time.DateTime,
    ...: tuple<enum<years, months, days>, int> as vargs) => time.DateTime
}
interface DateTimee for time.DateTime {
  routine add(self: time.DateTime,
    ...: tuple<enum<years, months, days>, int> as vargs) => time.DateTime { }
}

dumblob avatar Aug 08 '15 09:08 dumblob

Fixed.

daokoder avatar Aug 09 '15 08:08 daokoder

Right, it's fixed. One more question - I don't like much the ability to declare the interface in two ways which might be confusing if mixed.

interface DateTimee {
  routine add(self: time.DateTime,  # with self
    ...: tuple<enum<years, months, days>, int> as vargs) => time.DateTime
}
interface DateTimee {
  routine add(  # without self (this makes more sense to me)
    ...: tuple<enum<years, months, days>, int> as vargs) => time.DateTime
}

I would prefer just one way and if possible the one requiring less typing and less visual clutter. Which one do you prefer?

dumblob avatar Aug 20 '15 12:08 dumblob

It seems the situation is different when using invar, where it's required to explicitly use self in both abstract and concrete interface:

load time import time
interface DateTimee {
  routine add(
    ...: tuple<enum<years, months, days>, int> as vargs) => time.DateTime
}
interface DateTimee for time.DateTime {
  routine add(invar self: time.DateTime,
    ...: tuple<enum<years, months, days>, int> as vargs) => time.DateTime { self }
}
[[ERROR]] in file "/home/test/test.dao":
  At line 6 : Invalid interface definition --- " interface DateTimee for time. DateTime ... ";
  At line 6 : Incomplete concrete interface implementation --- " DateTimee<DateTime> ";

Should we require explicitly writing the redundant self stuff in abstract interfaces or not?

dumblob avatar Aug 21 '15 09:08 dumblob

Ping.

dumblob avatar Apr 13 '19 10:04 dumblob