Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: "" but true

by ikegami (Patriarch)
on May 13, 2021 at 19:03 UTC ( [id://11132547]=note: print w/replies, xml ) Need Help??


in reply to "" but true

$ perl -M5.010 -e' package Crazy { use overload bool => sub { 1 }, q{""} => sub { "" }, fallback => 1; } my $x = bless({}, Crazy::); say $x ? "true" : "false"; say length($x); ' true 0

But don't. Just don't. If you think non-printable characters are confusing, this is next level confusing. This is an XY Problem.

(U+FEFF ZERO WIDTH NO-BREAK SPACE would be a better choice than NUL, not that you should use that solution either.)

Seeking work! You can reach me at ikegami@adaelis.com

Replies are listed 'Best First'.
Re^2: "" but true
by Chuma (Scribe) on May 13, 2021 at 20:35 UTC
    Truly great and terrifying!
Re^2: "" but true
by Bod (Parson) on May 13, 2021 at 23:13 UTC

    That really shouldn't be allowed...

    The fact that it is, is what makes Perl so wonderful and bizarre at the same time in a sort of perfect mix!

      > That really shouldn't be allowed...

      That's not true.

      For instance overloads are great when designing internal DSLs.

      These are embedded mini-languages which are meant to operate in very special semantics.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        I wasn't being totally serious...
        ...but I think you know that LanX 😜

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132547]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-24 10:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found