If I had my way

F i L witte2008 at gmail.com
Tue Dec 13 18:45:35 PST 2011


Jonathan M Davis wrote:
> The simplest solution would be to simply have the function 
> callable as a non-
> property function when there's such an ambiguity, but that does 
> go against the whole "require a property function to be used as 
> a property" thing. Your suggested syntax is pretty good, but 
> it's not exactly a desirable solution either. I don't know. 
> Given the simplicity of it and the fact that there's no way 
> that you're going to change the property function to a member 
> variable (since it's not like you can add it to arrays), 
> allowing for it to be called as normal function seems like the 
> better solution, albeit not exactly ideal. Free functions 
> definitely complicate the whole property thing.
>
> - Jonathan M Davis

Honestly I'm kind of a fan of having any method with zero or one 
parameters being usable as properties or methods at the 
programmer's discretion. Then conflicting pseudo methods could 
just be resolved through normal method semantics as you 
described. But I understand this is being removed so there must 
be a reason for it.

To bad the comma was used as new-line or we could remove the 
zero-or-one requirement all together and have Go-like return 
semantics:

    void foo(string a, int b, float c) { ... }

    float, float up() {
        return 0f, 1f;
    }

    void main() {
        foo = "bar", 1, 2.0f;
        float x, y = up;
    }

Of course, changing the language around like that is obviously 
not a realistic option. So this is just pointless speculation.


More information about the Digitalmars-d mailing list