develooper Front page | perl.perl6.language | Postings from March 2005

Re: Parameter and trait questions - just how 'only' _is_'read-only'?

Thread Previous | Thread Next
From:
Uri Guttman
Date:
March 26, 2005 20:57
Subject:
Re: Parameter and trait questions - just how 'only' _is_'read-only'?
Message ID:
x7fyyhk7n7.fsf@mail.sysarch.com
>>>>> "LW" == Larry Wall <larry@wall.org> writes:

  LW> That being said, in Perl 5, if you say

  LW>     @a = undef;

  LW> you don't get an undefined array.  I'd like to make undef smart enough
  LW> about list contexts that @a actually does end up undefined in Perl 6.
  LW> That is, in scalar context, undef is a scalar value as in Perl 5, but
  LW> in Perl 6, undef in list context means "there isn't anything here if
  LW> you try to look for it", so it's more like () in Perl 5, except that
  LW> it also undefines the array if it's the only thing in the array.

then how would you assign undef to the only element of the array? would this
be needed:

	@a = ( undef ) ;	# same as p5?

vs.
	@a = undef ; 		# like undef @a in p5?

i have always railed against undef on aggregates as it leads to using
defined on them which is not the same as checking if an aggregate has
any elements. i see that often in newbie code. in fact i would like to
stop allowing undef as a function with args and have it only return a
scalar undef value. there should be a different op to truly make an
aggregate undefined (and i still don't see a need for that, emptying it
is all that i ever think is needed).

in my world undef is a scalar value and nothing else. how do you see it
in p6?

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

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