Which language constructs could be done as a library if we accept some breaking changes?

Paul Backus snarwin at gmail.com
Mon Nov 29 13:51:30 UTC 2021


On Monday, 29 November 2021 at 13:11:47 UTC, Alexandru Ermicioi 
wrote:
> But isn't a slice basically a struct with pointer and length?
> Therefore you can consider that a slice is never null, but 
> rather internal ptr field is, while length is 0.
> The assoc array could follow same logic, i.e. point to null 
> node.
>
> any ops could then be implemented in terms of operator 
> overloading.

You can't overload operators for built-in types, like pointers. 
So if you do it this way, you would no longer be able to write 
`ptr[start .. end]`--instead, you'd have to write something like 
`ptr.slice(start, end)`.


More information about the Digitalmars-d mailing list