|
|
Choosing A Webhost: |
Re: Undef issues: msg#00123lang.perl.perl6.compiler
Hi Stuart, You (and Carl) are absolutely right... all these things are behaving as they should. Cool! :-) I'll fix the tests later on today. Thanks, Ade Stuart Cook wrote: >On 5/24/05, Adrian Taylor <ade@xxxxxxxxxxx> wrote: > > >>eval_is('undef + 1', undef, 'undef + 1', :todo<bug>); # dies >> >> > >In this case, you're expecting > (undef) + 1 >but you're getting > undef(+1) >instead. > >This is because 'undef' serves double-duty as both 'undefined value' >and 'prefix op for undefining variables', and the op form is taking >precedence in parsing. > >It's worth noting that Perl5 seems to have exactly the same parsing behaviour: > >$ perl -e 'print undef + 1' >Warning: Use of "undef" without parentheses is ambiguous at -e line 1. >Can't modify constant item in undef operator at -e line 1, at EOF >Execution of -e aborted due to compilation errors. > >I'm not sure whether this behaviour is supposed to be changing. > > > > >>eval_is('1 + undef', undef, '1 + undef', :todo<bug>); # gives 1 >>eval_is('2 * undef', undef, '2 * undef', :todo<bug>); # gives 0 >> >> > >AFAIK, a vanilla (undef) numifies to 0, so these are already correct. >If you were expecting undef to behave as a 'poisoned' value then I can >understand the confusion. > > > > >>eval_is('undef xx 2', undef, 'undef xx 2', :todo<bug>); # dies >> >> > >Again, you're expecting > (undef) xx 2 >but you're getting > undef(xx 2) >instead. > > >Stuart > >
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: (OT) Re: Perl development server, JensBeimSurfen |
|---|---|
| Next by Date: | Re: (OT) Re: Perl development server, Michele Dondi |
| Previous by Thread: | Re: Undef issues, Stuart Cook |
| Next by Thread: | Re: Undef issues, Piers Cawley |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |