optional (), what is done elsewhere

deadalnix deadalnix at gmail.com
Mon Feb 4 07:08:02 PST 2013


On Monday, 4 February 2013 at 10:06:37 UTC, Jacob Carlborg wrote:
> In CoffeeScript it's only legal to call a function without 
> parentheses if it takes at least one argument. Example:
>
> foo = -> console.log "asd"
>
> bar = foo # refers to the "foo" function
> bar = foo() # calls the "foo" function
>
> x = (y) -> y * 2
>
> bar = x # refers to the "x" function
> x 3 # calls the "x" function with argument 3
> x(3) # calls the "x" function with argument 3
>
> So with CoffeeScript there's never a conflict.

OK, I missed that (I have to say I don't really know that 
language and went over it quite quickly). The point that was 
important to me is that this is not really applicable to D.


More information about the Digitalmars-d mailing list