dao
dao copied to clipboard
sigsegv in a faulty abstract interface
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 { }
}
Fixed.
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?
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?
Ping.