On Wed, Aug 02, 2000 at 06:28:47PM -0600, Tom Christiansen wrote:
> >I'd also like some 'what are you' introspection I can do on all scalars, on
> >a more formal basis than 'ref'. Either an expansion of the 'ref' functionality
> >to cover filehandles, or a more general system...
> What do you mean, "formal"?  ref() has always been a de facto typeof
> operator, no?
>     open my $fh, "< /etc/motd";
>     print ref $fh
> GLOB

Doesn't print 'GLOB' for me, but that's because a lot of real-world systems
haven't hit 5.6.0 (I'm guessing, not absolutely sure that's the cause),
and I'm moving and don't have access to my development machine, so I don't
have access to anything later than 5.004_04.

To quote the docs:

perldoc -f ref on a 5.004_04 install:
--cut--
If the referenced object has been blessed into a package, then that package
name is returned instead.  You can think of ref() as a typeof() operator.
--cut--

Which does tend to support your point... although I'd argue ref is at least
tragically misnamed... 

ref claims to examine my EXPR, return true if it's a reference, and maybe
give me some more information about that reference. (perlfunc in 5.004_04).

The problem is the idea that the main interesting thing to examine has
been references.

Filehandles don't intuitively look like references to me. They don't
refer to something else within perl I might hypothetically manipulate
directly (I speak of how I envision perl6, if it turns out vaguely
similiar to how we're discussing).

If $foo is to be a filehandle, it has to be a new type of value we
can load into a SV. And it feels like it would be making a mockery
of something designed to tell me about references (ref), to let it
keep the same name and have it tell me about that too.

On the one hand, we could let people see what's _really_ in their scalars,
if they want, on the third hand, do we really want to think about that?

Part of the problem is that I _really_ don't want to have to do OO programming
to manipulate filehandles. I dunno, it's 2am, and the screen is drifting a bit,
maybe this will give someone ideas.

Reply via email to