develooper Front page | perl.perl6.language | Postings from June 2004

Re: Semantics of vector operations (Damian)

Thread Previous | Thread Next
From:
Matthew Walton
Date:
June 14, 2004 14:59
Subject:
Re: Semantics of vector operations (Damian)
Message ID:
40CE1FA2.7050106@alledora.co.uk
Austin Hastings wrote:
> Perhaps we could consider the junctive lvalues as a sort of implied 
> ?= operation:
> 
>    junction(@list) = value
> 
> means
>   
>    unless junction(@list) == value
>    {
>      given junction {
>      when 'none' { (@list.grep value) = undef; }
>      when 'any'  { for 0 .. random(@list) { @list[random(@list)] =
> undef; } }
>      when 'one'  { @list[random(@list)] = undef; }
>      when 'all'  { @list = $(@list) x undef; }
>      }
>    }
> 
> (which would make for some interesting use cases around 'any', at least
> ;-)

This is extremely scary. The thought of anybody actually using 'any' in 
their code is... umm... well, let's just say the Haskell programmer me 
is curling up in fright and screaming his head off, because the idea is 
entirely abhorrent to him. Gadget Matthew says it's a substanceless 
'wow' feature. Both are also skeptical about 'one', and my psychiatrist 
is rattling pill bottles.

'none' could be useful, but it would be better to explicitly just say

(@list.grep value) = undef

although I think that might be supposed to be

(@list.grep value) ยป= undef;

as shouldn't list.grep return a list of matches? Which we assume are 
aliases to the original elements.

I'm with Damian. TMTOWTDI yes, but there's a line between 'nice to have 
the alternative' and 'silly'.

Oh, and the example appears to have forgotten that only 'none' should be 
assigning undef, the rest should be assigning value - shouldn't they? I 
think they should, otherwise it doesn't make any sense at all. Or 
perhaps it does, and I need to go to bed.

Ciao.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About