Re: some proposed changes



Huw Rogers <count0 building2 co jp> writes:

> > > 
> > > Huw Rogers <count0 building2 co jp> writes:
> > > > * if a sequence is undef, it is marshalled as a zero length sequence.
> > > > Right now if it is not a true reference to an array it dies.
> > > 
> > > I don't agree with this at all.
> > > 
> > >  $a = []; print scalar (@$a), "\n";
> > >  $a = undef; print scalar (@$a), "\n";
> > > 
> > > Are very different; the second one is a warning. 
> > > 
> > > Allowing this would be similar to allowing "undef" to be marshalled as
> > > an empty string without any warning, which is similar to thinking
> > > in C that "" is the same as NULL. <shudder>
> > 
> > The sequence marshalling of undef is the most dubious of my proposals,
> > and I guess I should retract it.
> 
> Having said that,
> 
> $a = []; print scalar (@$a), "\n";
> $a = undef; print scalar (@$a), "\n";
>
> results in: "0" and "" being printed with no warnings.

$ perl -we '$a = undef; print scalar (@$a), "\n";'
Use of uninitialized value in array dereference at -e line 1.
Use of uninitialized value in print at -e line 1.

Perhaps you weren't testing with -w ... but programming Perl
without -w is akin to mountain climbing without a safety
rope...

> In general, I'd like things to behave in a Perl like fashion, including
> "auto-vivification" of CORBA data structures as necessary.

I certainly agree things that things should behave in
a Perl-like fashion; so I think it's not a big problem if
undef marshals like []. *but* it needs to generate a warning
when -w is used if you allow that.

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]