in reply to Re: What's magic so "magic"?
in thread What's magic so "magic"?

I agree the type of explanation of "magic" you provided, but also I would like to think there is a type of "magic" in general in Perl.

So in the Perl world, "magic" has two sides of its meangings, but they actually agree with each other. If you look into things like hash tie, behind it, Perl simply calls subs like STORE, FETCH etc. on your behalf. And those STORE, FETCH, etc. can be defaults from perl, can be what you supplied thru Tie::Hash.

Replies are listed 'Best First'.
Re: Re: Re: What's magic so "magic"?
by jand (Friar) on Mar 16, 2003 at 16:51 UTC
    While this is true for most magic in Perl, not all "magic" is implemented via magic variables. The docs list at least the following areas as "magic", which according to your "strict" definition aren't:
    • Auto-increment (and range) operator on strings "has a little extra builtin magic to it"
    • one and two argument open() is called "magic open"
    • goto &NAME is said to be "highly magical"
    So, as usual with Perl, things are a little more fuzzy.

    Update: This was supposed to be a reply to Elians comment, not to pgs.

Re: Re: Re: What's magic so "magic"?
by Elian (Parson) on Mar 16, 2003 at 16:25 UTC
    While it's OK to think that there's pixie-dust driven featuers inside of perl, it's not a good idea to call them magic, since that really does overlap with a feature explicitly called magic. It'd be like thinking of a feature as filehandle or hash, say, which wasn't perl's actual filehandle or hash feature.

    Perl's magic feature's definitely less often directly used than many things, but it does exist, so it's best to restrict what you label as magic to what actually is magic. Less confusion in the long run there.

      You mean like the way people say "I use CGI"?

      Makeshifts last the longest.

        Gah! Yes, like that.