On 9/4/07, Ovid <[EMAIL PROTECTED]> wrote:
> --- demerphq <[EMAIL PROTECTED]> wrote:
>
> > > If string data was *always* quoted and numeric data never was
> > (assuming
> > > it's really numeric), then most of the issues raised in this thread
> > > would go away.
> >
> > Define string data and numeric data. :-)
> >
> > IOW, is 0E0 string or numeric?
>
> This can be tricky to determine in a dynamic language.  This is easy to
> determine in Java.  I would argue that for dynamic language
> practitioners, we can ignore the distinction but the YAML output should
> *not* ignore that distinction.  We should have a single TAP YAML
> diagnostic standard so that we have less concern about interoperability
> issues.  Admittedly, not too many here seem worried about that so maybe
> it's a minor issue but when I work on exchanging data between static
> and dynamic languages, I keep getting bit by related issues.
>
> And I have no idea if 0E0 should be string or numeric :)

I think the solution is to leave it up to a given language as to
whether they discriminate or not, document how they can, and leave it
alone. Its not going to be easy to do in some languages, so they
probably dont have to or want to care, and in the others it will be
trivial so probably isnt an issue anyway.

IOW, if your language is strongly typed you will never get a char*
return from a routine that is supposed to return an INT. So it
probably doesnt matter.

I really think this is an area where the more you think about it the
more problems you discover and the less you think about it the less
likely you will encounter any problems at all.

And just to make life nice and difficult, if you ARE going to
discriminate between strings and true numeric data formats then are
you going to discriminate between different types of native format?
IOW, are you going to want to facilitate checking that a routine
returned an 8 bit integer and not a 16 bit integer? Etc? When somebody
decides to use TAP for Pascal code are you going to distinguish a
string of 10 chars from a string of 11 (as Pascal itself is documented
to distinguish).

So to summarize:

In dynamic languages its unlikely that there is going to be a
difference between a "string" value and a "numeric" value. In static
typed languages it wont matter because a routine cant return the wrong
type anyway. And if the language allows returning a pointer to a given
type there will be issues when dereferencing that type in the wrong
way (or maybe not, such as in C, but then its highly unlikely that the
values will compare correctly if they return a int *v instead of a
char *v.

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Reply via email to