Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't assign here documents to constants #3121

Closed
p6rt opened this issue May 4, 2013 · 7 comments
Closed

can't assign here documents to constants #3121

p6rt opened this issue May 4, 2013 · 7 comments

Comments

@p6rt
Copy link

p6rt commented May 4, 2013

Migrated from rt.perl.org#117853 (status was 'resolved')

Searchable as RT117853$

@p6rt
Copy link
Author

p6rt commented May 4, 2013

From @grondilu

This is perl6 version 2013.04-32-gc66c428 built on parrot 5.2.0
revision RELEASE_5_2_0

# this works​:
my $text = q :to 'END';
Hello world
:)
END

say $text;

# this does not​:
constant TEXT = q :to 'END';
Hello world
:)
END

say TEXT;

@p6rt
Copy link
Author

p6rt commented Jun 9, 2013

From @masak

<masak> r​: constant FOO = q​:to /EOF/;␤ OH HAI␤ EOF␤␤say FOO
<camelia> rakudo b2072f​: OUTPUT«===SORRY!===␤Premature heredoc consumption␤»
<masak> what in the world does "Premature heredoc consumption" mean? :(
<masak> is it unreasonable to want to put a heredoc string in a
constant? I don't think so.
<jnthn> masak​: It means that constants are evaluated immediately
<jnthn> masak​: It's the BEGIN block / heredoc thing in disguise.
<masak> jnthn​: I fail to understand. I know that constants evaluate
immediately. but my heredocs are constant; they aren't qq strings,
they're q strings.
<jnthn> masak​: The problem being that expression after the = up to the
; is evaluated right away at statement end
<jnthn> masak​: The heredoc itself hasn't been parsed at that point.
<masak> ah.
<jnthn> r​: BEGIN say q​:to /EOF/;␤ OH HAI␤ EOF␤␤say FOO
<camelia> rakudo b2072f​: OUTPUT«===SORRY!===␤Premature heredoc consumption␤»
<jnthn> Same as there.
<masak> I understand now.
<masak> still dissatisfied with that semantics.
<jnthn> Well, not sure what we can do about it.
<jnthn> Given
<jnthn> r​: (BEGIN say q​:to /EOF/; say 42)␤ OH HAI␤ EOF␤␤say FOO
<camelia> rakudo b2072f​: OUTPUT«===SORRY!===␤Premature heredoc consumption␤»
<jnthn> There the BEGIN isn't even a top-level statement.
<masak> feels like Perl 6 isn't doing enough for me :)
<masak> we know that there is *going* to be a string there, in a very
short while.
<jnthn> Well, feel free to play with it to see if you can work out a
sane way to make it work
* jnthn isn't sure how
<masak> oki. gotcha.
<jnthn> I mean, I'd be happy enough with it working. I just don't see
how to get there.
<masak> yeah, I'm not saying it's an easy problem to solve. I'm saying
it feels like it could work.
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Apr 12, 2015

From @masak

<jnthn> masak​: I think https://rt-archive.perl.org/perl6/Ticket/Display.html?id=117853 can get a test (if there isnt' already one) and be closed now?
<masak> jnthn​: yep. was gonna add that to the ticket.
* masak adds it now

@p6rt
Copy link
Author

p6rt commented Apr 12, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Apr 13, 2015

From @usev6

nbrown++ added a test to S02-literals/heredocs.t with commit Raku/roast@9b7d709fd7.

I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Apr 13, 2015

From @usev6

nbrown++ added a test to S02-literals/heredocs.t with commit Raku/roast@9b7d709fd7.

I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Apr 13, 2015

@usev6 - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant