[erlang-questions] Matthew Sackman's "cut" proposal

Anthony Ramine <>
Mon Dec 16 20:39:35 CET 2013


True, it may be sugar. But it is certainly not saccharine.

While it may look like

	fun map(do_stuff())/1

and

	fun (_2) -> map(do_stuff(), _2) end

are equivalent, they aren’t.

The returned closure in my proposal closes over the pre-supplied arguments, not anything else. This means the code expands to:

	_1 = do_stuff(),
	fun (_2) -> map(_1, _2) end.

The pre-supplied arguments are evaluated at the abstraction site, not when the returned closure is called. This also avoids a whole set of ambiguities caused by the introduction of a new scope.

All things said, I am not usually for syntax sugar and I would not care  if such a proposal were to be rejected. I will probably implement it anyway, to play with it.

I do not like your ‘+’ proposal. I reused ‘/‘ only because it is already abused for funs.

Regards,

-- 
Anthony Ramine

Le 16 déc. 2013 à 18:47, Erik Søe Sørensen <> a écrit :

> Disclaimer 2: Surface syntax bikeshed!




More information about the erlang-questions mailing list