Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: What if Perl had an OO standard library?

by awncorp (Acolyte)
on Aug 23, 2022 at 23:07 UTC ( [id://11146346]=note: print w/replies, xml ) Need Help??


in reply to Re^2: What if Perl had an OO standard library?
in thread What if Perl had an OO standard library?

I'm not sure what you mean by "real" true and false. Perl doesn't have real true and false yet. If you're talking about "true" and "false" from the "builtin" pragma, that's still very experimental and only available from Perl 5.36+. What we have now are different conventions for representing true and false, i.e. the legacy 1 and 0 (and the problems they have, i.e. cross-language interoperability), the YAML/JSON spurred \1 and \0 (but that doesn't play nice with legacy code), and now my dualvar-based 1|"1" and 0|"0" which is (IMHO) better than all the rest because it's fully backward-compatible (i.e. legacy code expecting 1 or 0 works just fine) yet easy to identify as a boolean (via is_dualvar).

"I am inevitable." - Thanos
  • Comment on Re^3: What if Perl had an OO standard library?

Replies are listed 'Best First'.
Re^4: What if Perl had an OO standard library?
by Your Mother (Archbishop) on Aug 24, 2022 at 09:34 UTC

    Side note: Perl might have booleans now, maybe. :P No idea how compatible or permanent but they’re trying (v36.0).

    builtin::true, builtin::false, builtin::is_bool

    true and false return boolean true and false values. Perl is still perl, and doesn't have strict typing of booleans, but these values will be known to have been created as booleans. is_bool will tell you whether a value was known to have been created as a boolean.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-23 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found