Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: what would you like to see in perl5.12?

by blazar (Canon)
on Aug 26, 2007 at 11:49 UTC ( #635119=note: print w/ replies, xml ) Need Help??


in reply to Re^3: what would you like to see in perl5.12?
in thread what would you like to see in perl5.12?

Indeed, if I'd been spec'ing Perl 6 interpolation, I think I would have removed all other interpolations in favour of a single 'interpret the block and substitute whatever it produces in its place' construct.

Oh no! Perl 6's new quoting mechanism, with everything based on a single C<Q> and a bunch of adverbs is just breathtaking: it is at same time simple, intuitive and powerful as familiar constructs like C<q> and C<qq> will remain very much the same as in Perl 5 and a terrible amount of more flexibility will be available at the tiny expense of appending a semicolon and a few letters. Or in some cases no colon at all and a single letter.

For me, the ability to have my editor highlight interpolations, (without resorting to running a second OS as an editor:), would more than make up for the slightly less convenient syntax it would require for the simple case.

Oh well, that's hardly a problem for me so we definitely see things from two very different perspectives. Personally, I find too much syntax highlighting to be distracting, but when I find it... ehm... desirable. (Speaking of strings, in current Perl, e.g. when the necessary evil of a string eval of a considerable amount of code is needed and then I use q{...} or qq{...}.)

Yet it seems to me we could still have the best of both worlds: if e.g. C<qq> implies :s, :a, :h, :f, :c and :b you may still stick to only interpolate {...} expressions when you want them to be syntax highlighted, and your editor may do a good job of doing so.

Or if you want to stay very strict, then you may get into the habit of doing:

macro qbuk { Q:c:b }


Comment on Re^4: what would you like to see in perl5.12?
Select or Download Code
Re^5: what would you like to see in perl5.12?
by BrowserUk (Pope) on Aug 26, 2007 at 12:58 UTC
    with everything based on a single C<Q> and a bunch of adverbs

    I don't understand what you mean by "based on a single c<Q>"?

    And I'd just point out that the adverbs could still be used with "...{{ code }}:x ...".


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I don't understand what you mean by "based on a single c<Q>"?

      <joke>It is not in my realm of competence to know whether you understand or not.</joke>

      Seriously, to quote from Synopsis 2:

      And I'd just point out that the adverbs could still be used with "...{{ code }}:x ...".

      Adverbs within the quoted material? A completely different thing: adverbs on (quote-like) operators define how the "language" in the quoted material is interpreted. What you're talking about would be a feature specific of one such language. (Speaking of which I suppose it will be possible to define your own parser switching adverbs, along with an appropriate parser.)

        So q is really short for Q:q and qq is short for Q:qq.

        Oh. So all that flowery prose,

        Oh no! Perl 6's new quoting mechanism, with everything based on a single C<Q> and a bunch of adverbs is just breathtaking: it is at same time simple, intuitive and powerful as familiar constructs like C<q> and C<qq> will remain very much the same as in Perl 5 and a terrible amount of more flexibility will be available at the tiny expense of appending a semicolon and a few letters.

        is just breathless hot air admiration, but completely orthogonal to the point I was making.

        Ie. I was discussing the definition of the "language" that can appear inside one of those long-winded substitutes for the simple quote-like operators that we already have. (And that no doubt Perl6Critic will adjudge it to being the moral equivalent of walking around with your fly unbuttoned if you don't use the long form; and a few individuals will adopt derigeur because they think it looks cute :)

        I re-read Syn2 last week before posting this suggestion, and it strikes me that with all the stuff that can now appear inside double-quotes, it's easier to just backwack everything that isn't special, than work out what is. The old thing of "this is all just string constant except for a few bits that will be runtime substituted" has been turned on it's head.

        And it will be impossible for editors, even those that are thinly disguised OSs, to highlight the difference between the passive and active bits. Ie. They will be unable to assist the (maintenance) programmer in working out which bits of string constants are actually constant and which are not.

        I can see myself adopting the use of single quoted constants interspersed with concatenated variables and expressions, in order to make it clear what is constant and what not. So complex have the rules become.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-08-28 01:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (254 votes), past polls