[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ideas about colon operator syntax (and a patch in the work)
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 29 Apr 2014 15:41:18 +0200
On Tue, Apr 29, 2014 at 3:30 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> Now would I be willing to sacrifice the syntax space for that
> eventuality in favour of typing two characters fewer in the case
> of a member function called with no arguments? That is the
> question.
I've also liked the idea that the unambiguous expression text:upper
becomes a partial function application creating a new closure[1]; it's
convenient for callbacks. (text:upper() continues to be evaluated
directly, of course)
As for 'v: integer' as an expression: it looks very much like a
dynamic _typecast_ and I would probably write it as "v as integer".
[1] another discarded Lua proposal that got its way into Moonscript.....
$ mooni
MoonScript version 0.2.4
> text = "hello"
> f = text\upper
> f!
"HELLO"
Note the ugly \ for method calls and the idiomatic ! for calling a
function of no arguments.