afuna_archive: (Default)
afuna_archive ([personal profile] afuna_archive) wrote2008-01-04 11:50 am
Entry tags:

Oops, wrong language

Damn. PHP also uses @$. First thing I thought when I saw it was, "Oh neat, it's dereferencing an array reference." Then I realized a) the variable on the LHS wasn't an array, and b) I was in the wrong language.

(It's used for error control instead, which is also neat in its own way, I guess.)

[identity profile] ciaran-h.livejournal.com 2008-01-04 03:55 am (UTC)(link)
PHP makes me go :(.
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2008-01-04 11:46 am (UTC)(link)
At least, PHP doesn't consider @$@ to mean something. :-)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2008-01-04 02:11 pm (UTC)(link)
...okay. I give up. What does it mean? :)
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2008-01-04 02:29 pm (UTC)(link)
From perldoc perlvar:

       $@      The Perl syntax error message from the last eval() operator.
               If $@ is the null string, the last eval() parsed and executed
               correctly (although the operations you invoked may have failed
               in the normal fashion).  (Mnemonic: Where was the syntax error
               "at"?)


(and @ is the array dereference)
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2008-01-04 02:30 pm (UTC)(link)
(Yes, you can actually assign an arrayref to $@. I tried.)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2008-01-05 08:48 am (UTC)(link)
Oh interesting. Have you ever used it? *curious* (And not just to test ;p)
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2008-01-06 01:42 am (UTC)(link)
I have used $@ in code meant to Do Something Useful, but not to store an arrayref in it. You can pass a blessed reference to die inside an eval, which would set $@ to that reference, but blessed references are usually hashrefs (or pseudohash refs a la fields::phash), not arrayrefs.
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2008-01-08 04:18 pm (UTC)(link)
"pass a blessed reference to die inside an eval"
Something about these words together makes me think of a video game :-)

And hmmm. *nods thoughtfully*
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2008-01-04 02:13 pm (UTC)(link)
Hee. It's somewhat simple and easy to learn which means there's a *lot* of bad code out there written by people who don't know better, but I don't find PHP itself that bad.