Control: reopen -1

On 2016-02-07 20:26:22 -0500, James McCoy wrote:
> On Sun, Jan 24, 2016 at 07:24:54AM +0100, Vincent Lefevre wrote:
> > In a string context, undef is the empty string.
> 
> No, an empty string is an empty string.  undef is the lack of an
> argument.  The same thing happens if you call a function in Perl without
> any arguments.

So, then, if you want, this should be seen as an error, but this is
not the usual behavior (e.g. perl -e 'print undef eq ""' outputs 1).

> > No, undef must not be the null pointer.
> 
> Yes, it should.

If the library doesn't expect a null pointer, it certainly must not.

> > This makes no sense at all!
> > With a string argument, undef must be the empty string.
> 
> No, it mustn't.  That isn't even the case in Perl, so I don't see why it
> should convert to C.

It is the case in Perl (see example above).

Anyway, there are two correct behaviors:
1. Stringify the argument.
2. Return an error if the argument is not a string.

In Perl, a segmentation fault is a bug.

-- 
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to