Plot2kill 0.2

dsimcha dsimcha at yahoo.com
Sat Mar 5 15:42:26 PST 2011


On 3/5/2011 5:51 PM, Michel Fortin wrote:
> There's still a small ambiguity with functions returning callable types.
> For instance, if you have a template defining a property of a
> parametrized type, forgetting to add @property to the getter could
> result in buggy behaviour with a callable type but work fine with
> everything else. Is making parenthesis optional worth making this kind
> of bug easier to slip by, I wonder.

This is an extreme corner case, especially if a one-way semantic 
@property syntax is available to work around it.  The percentage of 
functions that return callables is very small, and of these the 
percentage that would forget @property is probably very small.  I'd 
rather bug-proneness in a ridiculous corner case than breaking tons of 
existing code code and losing a nice feature in the common case.

>
> That said, () being optional doesn't help you use setters with chaining.
> You'd have to not label your setters with @property for them to work
> with chaining, unless you want to play with a lot of nested parenthesis.
>
> (((Graph().title = abc).xTitle = def).yTitle = hij);
>
> Wow, that looks almost like Objective-C!

Right.  The point is that I can do the same thing with either property 
syntax or with chaining.  The choice is up to me as the caller, if the 
API designer is ok with allowing this choice.


More information about the Digitalmars-d-announce mailing list