An interesting consequence of safety requirements
David Gileadi
foo at bar.com
Wed Nov 4 11:42:25 PST 2009
Andrei Alexandrescu wrote:
> grauzone wrote:
>>
>> Maybe I don't get it, but how to you call prepend() from safe code?
>
> module(safe) wyda;
>
> void main() {
> auto lst1 = new List;
> auto lst2 = new List;
> List.prepend(lst1, lst2)
> }
This seems to be another case where automatic function rewriting would
be nice, a la D's "Functions as Array Properties":
void main() {
auto lst1 = new List;
auto lst2 = new List;
// rewritten by compiler to List.prepend(lst1, lst2):
lst1.prepend(lst2);
}
More information about the Digitalmars-d
mailing list