I have the feeling that I'm going to be repeating this for some time to come...
There is a very important distinction to be drawn between typed values and typed variables. C only has typed variables; you can't look at an arbitrary C value and know its type. You can do this in Perl, that's what bless and friends are for. In Perl 6 we'll be getting a richer set of value types out of the box and I applaud that. We're also getting typed variables in Perl 6, and that's good too, for several different reasons:
- You will be able to define 'struct' in Perl that matches an equivalent C struct, which makes life so much easier for 'Glue' writers.
- If you want it (and I can't imagine why you would) you can go the whole bondage and discipline route and adopt strict typing throughout your code.
- Optimizers can make use of type declarations to improve performance, so you can opt to take B&D flexibility hit only in your inner loops (or at other points where a profiler shows you have speed issues)
Perl 6 also introduces a concept that I'll call, for the nonce, 'storage typing', which allows you to specify that a particular variable that looks like, say, a Scalar, is actually implemented by some arbitrary type that responds to the same interface as a Perl Scalar. This looks like being Perl 6's replacement for tying, and very nice it looks too.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||