in reply to Re^2: Create a new operator, get LHS (indirect method)
in thread Create a new operator, get LHS

I like the idea of realizing variables as lvalue functions which evaluate passed code refs!

Thumbs up. :)

Not for normal Perl code, but maybe within internal DSLs which are limited to certain code areas like blocks.

Not sure why you use a hash where a closure var could do...

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re^3: Create a new operator, get LHS (indirect method)

Replies are listed 'Best First'.
Re^4: Create a new operator, get LHS (indirect method)
by Eily (Monsignor) on Aug 28, 2015 at 12:57 UTC

    Not sure either. I mostly coded this without thinking it through, with several iterations of corrections. So the hash is just something I had at one point and didn't think to replace. Since I like working with closures I'd definitely use a closed-over lexical if I ever needed to use that in actual code.

    The fact that you can code something that looks like another language entirely but still is valid perl says a lot about the flexibility of the language :).

    Edit: but it wouldn't work for everything though. If X in @list; works fine, (X + Y) in @list; would fail as (X + Y) is not a subroutine call.