FAQ

On Tue May 24 05:37:20 2011, jv wrote:
#!/usr/bin/perl
use strict;
use warnings;
use 5.14.0;
default { say "Hello!" }

prints "Hello!" and then aborts with:

Can't use when() outside a topicalizer at ...
What would be a better message -- and how should it be classified
according to the scale in 'pod/perldiag.pod'?

(W) A warning (optional).
(D) A deprecation (enabled by default).
(S) A severe warning (enabled by default).
(F) A fatal error (trappable).

Thank you very much.
Jim Keenan

Search Discussions

  • Father Chrysostomos via RT at Dec 15, 2011 at 2:08 am

    On Wed Dec 14 17:57:27 2011, jkeenan wrote:
    On Tue May 24 05:37:20 2011, jv wrote:
    #!/usr/bin/perl
    use strict;
    use warnings;
    use 5.14.0;
    default { say "Hello!" }

    prints "Hello!" and then aborts with:

    Can't use when() outside a topicalizer at ...
    What would be a better message
    Can't use default outside a topicalizer...?
    -- and how should it be classified
    according to the scale in 'pod/perldiag.pod'?

    (W) A warning (optional).
    (D) A deprecation (enabled by default).
    (S) A severe warning (enabled by default).
    (F) A fatal error (trappable). (F)
    Thank you very much.
    Jim Keenan
    --

    Father Chrysostomos
  • Johan Vromans at Dec 15, 2011 at 6:58 am
    [Quoting Father Chrysostomos via RT, on December 14 2011, 18:08, in "[perl #91514] Wrong "]
    Can't use default outside a topicalizer...?
    Can't use default{} outside a topicalizer...?
    (F)
    Yes.

    -- Johan
  • Aristotle Pagaltzis at Dec 16, 2011 at 5:08 am

    * Johan Vromans [2011-12-15 08:00]:
    * Father Chrysostomos via RT [2011-12-15 03:10]:
    On Wed Dec 14 17:57:27 2011, jkeenan wrote:
    On Tue May 24 05:37:20 2011, jv wrote:
    #!/usr/bin/perl
    use strict;
    use warnings;
    use 5.14.0;
    default { say "Hello!" }

    prints "Hello!" and then aborts with:

    Can't use when() outside a topicalizer at ...
    What would be a better message
    Can't use default outside a topicalizer...?
    Can't use default{} outside a topicalizer...?
    $ perl -econtinue
    Can't "continue" outside a when block at -e line 1.
    $ perl -enext
    Can't "next" outside a loop block at -e line 1.

    I think the errors for `when` and `default` should follow that style:

    Can't "when" outside a topicalizer at ...
    Can't "default" outside a topicalizer at ...

    Regards,
    --
    Aristotle Pagaltzis // <http://plasmasturm.org/>
  • Johan Vromans at Dec 16, 2011 at 7:32 am
    [Quoting A. Pagaltzis via RT, on December 15 2011, 21:09, in "Re: [perl #91514] Wr"]
    $ perl -econtinue
    Can't "continue" outside a when block at -e line 1.
    Oh yes, I can:

    perl -e "for(1){}continue{}"

    Can't "when" outside a topicalizer at ...
    Can't "default" outside a topicalizer at ...
    +1

    -- Johan
  • Aristotle Pagaltzis at Dec 16, 2011 at 10:47 am
    Hi Johan,

    * Johan Vromans [2011-12-16 08:35]:
    [Quoting A. Pagaltzis via RT, on December 15 2011, 21:09, in "Re: [perl #91514] Wr"]
    $ perl -econtinue
    Can't "continue" outside a when block at -e line 1.
    Oh yes, I can:

    perl -e "for(1){}continue{}"
    That’s different, it’s a `continue` block. The runtime error message is
    talking about the `continue` statement introduced for falling through
    from a `when` block. Yes, the ambiguity is annoying.

    The error for putting that one in the wrong context is very different:

    $ perl -e'continue{}'
    syntax error at -e line 1, near "continue"

    I find it annoying personally that `when` and `default` are dynamically
    scoped and therefore misplacing them cannot similarly be a compile time
    syntax error. The scoping of `given`, `when`, and `continue`/`break`
    follows nothing else that already existed in Perl, for no substantial
    reason I can think of, and smart-match broke the operator monorphism
    axiom of Perl. The whole combination of additions feels like a foreign
    body in the language.

    (I find it difficult to constrain myself to the point at hand when
    I touch on the subject because it just feels all so wrong.)

    Regards,
    --
    Aristotle Pagaltzis // <http://plasmasturm.org/>
  • Johan Vromans at Dec 16, 2011 at 11:18 am
    [Quoting A. Pagaltzis via RT, on December 16 2011, 02:47, in "Re: [perl #91514] Wr"]
    (I find it difficult to constrain myself to the point at hand when
    I touch on the subject because it just feels all so wrong.)
    Yes, I recognise this...

    -- Johan
  • Father Chrysostomos via RT at Dec 16, 2011 at 5:54 pm

    On Thu Dec 15 23:32:28 2011, jv wrote:
    [Quoting A. Pagaltzis via RT, on December 15 2011, 21:09, in "Re:
    [perl #91514] Wr"]
    $ perl -econtinue
    Can't "continue" outside a when block at -e line 1.
    Oh yes, I can:

    perl -e "for(1){}continue{}"

    Can't "when" outside a topicalizer at ...
    Can't "default" outside a topicalizer at ...
    +1
    Done with commit fc7debfb0.

    --

    Father Chrysostomos
  • Linda Walsh at Dec 20, 2011 at 1:37 am

    James E Keenan via RT wrote:
    On Tue May 24 05:37:20 2011, jv wrote:


    #!/usr/bin/perl
    use strict;
    use warnings;
    use 5.14.0;
    default { say "Hello!" }

    prints "Hello!" and then aborts with:

    Can't use when() outside a topicalizer at ...
    Has anyone considered that 'topicalizer' is complete jargon rubish?

    Try using *concrete* terms in a error messages, like Can't use when outside
    of a given or while block, (are there others?)... but topicalizer????

    ARRRGGG!!!

    How about we just cut to the end of this trend and start printing things
    like "ABEND 47102".
  • Eric Brine at Dec 20, 2011 at 1:56 am

    On Mon, Dec 19, 2011 at 8:37 PM, Linda Walsh wrote:

    **

    James E Keenan via RT wrote:

    On Tue May 24 05:37:20 2011, jv wrote:


    #!/usr/bin/perl
    use strict;
    use warnings;
    use 5.14.0;
    default { say "Hello!" }

    prints "Hello!" and then aborts with:

    Can't use when() outside a topicalizer at ...


    Has anyone considered that 'topicalizer' is complete jargon rubish?

    Try using **concrete** terms in a error messages, like Can't use when
    outside
    of a given or while block, (are there others?)... but topicalizer????
    given, for, map and grep ...except not the last two.

    $ perldoc perlsyn | grep -i topical || echo 'not found'
    not found
  • Brad Gilbert at Dec 20, 2011 at 2:29 am

    On Mon, Dec 19, 2011 at 7:55 PM, Eric Brine wrote:
    On Mon, Dec 19, 2011 at 8:37 PM, Linda Walsh wrote:

    James E Keenan via RT wrote:

    On Tue May 24 05:37:20 2011, jv wrote:




    #!/usr/bin/perl
    use strict;
    use warnings;
    use 5.14.0;
    default { say "Hello!" }

    prints "Hello!" and then aborts with:

    Can't use when() outside a topicalizer at ...


    Has anyone considered that 'topicalizer' is complete jargon rubish?

    Try using *concrete* terms in a error messages, like Can't use when
    outside
    of a given or while block, (are there others?)... but topicalizer????

    given, for, map and grep ...except not the last two.

    $ perldoc perlsyn | grep -i topical || echo 'not found'
    not found
    Well this is screwy:

    $> perl -E'say grep { when("a"){} } "a".."d"'
    Can't use when() outside a topicalizer at -e line 1.

    $> perl -E'say grep { when("b"){} } "a".."d"'
    Can't use when() outside a topicalizer at -e line 1.

    $> perl -E'say grep { when("c"){} } "a".."d"'
    ab

    $> perl -E'say grep { when("d"){} } "a".."d"'
    ab

    $> perl -E'say grep { when("d"){}; 1 } "a".."d"'
    Can't use when() outside a topicalizer at -e line 1.

    $> perl -E'say grep { when("a"){...} } "a".."d"'
    Unimplemented at -e line 1.

    $> perl -E'say grep { when("c"){...} } "a".."d"'
    ab

    $> perl -E'say grep { when("d"){}; say } "a".."d"'
    a
    b
    c
    Can't use when() outside a topicalizer at -e line 1.

    $> perl -E'say grep { when("e"){}; say } "a".."d"'
    a
    b
    c
    d
    abcd

    $> perl -E'say $]'
    5.014001

    It doesn't matter what is inside of the `when` block.
    It only works properly when it isn't the only thing inside of the `grep` block.
    Even then It only fails upon a successful match.
  • Father Chrysostomos via RT at Dec 20, 2011 at 7:30 am

    On Mon Dec 19 18:30:16 2011, b2gills@gmail.com wrote:
    Well this is screwy:

    ...
    Could you open a new ticket?


    --

    Father Chrysostomos

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-porters @
categoriesperl
postedDec 15, '11 at 1:57a
activeDec 20, '11 at 7:30a
posts12
users7
websiteperl.org

People

Translate

site design / logo © 2018 Grokbase