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

Internal Parrot errors leak through when passing some kinds of pairs #650

Closed
p6rt opened this issue Jan 25, 2009 · 15 comments
Closed

Internal Parrot errors leak through when passing some kinds of pairs #650

p6rt opened this issue Jan 25, 2009 · 15 comments

Comments

@p6rt
Copy link

@p6rt p6rt commented Jan 25, 2009

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

Searchable as RT62730$

@p6rt
Copy link
Author

@p6rt p6rt commented Jan 25, 2009

From @masak

Rakudo r35994​:

$ perl6 -e 'Hash.new( a => "b" )'
$ perl6 -e 'Hash.new( "a" => "b" )'
argument doesn't hash
[...]

$ perl6 -e 'sub foo(*%h) { say %h.perl }; foo( :a(1) )'
{"a" => 1}
$ perl6 -e 'sub foo(*%h) { say %h.perl }; sub bar(*%h) { foo(|%h) };
bar( :a(1) )'
argument doesn't array
[...]

The two exception messages come from lines 556 and 567, respectively,
in src/inter_call.c in Parrot.

@p6rt
Copy link
Author

@p6rt p6rt commented Jan 28, 2009

From @jnthn

On Sun Jan 25 04​:44​:47 2009, masak wrote​:

Rakudo r35994​:

$ perl6 -e 'Hash.new( a => "b" )'
$ perl6 -e 'Hash.new( "a" => "b" )'
argument doesn't hash
[...]

I figured this would be easy to fix, but it's not. Basically, because
for infix​:=> we could have any complex expression that generates a key
on the RHS, and Parrot does not allow us to pass named arguments where
the name is from a register rather than from a string constant. I've run
into this one before...probably last time I tried to fix this... :-|

Any input from the Parrot side would be good on if we can change
this...otherwise I don't see how we can resolve this ticket easily (I
can of course build a Hash for the one argument and then set .flatten(1)
on it, which may be a good workaround...but not quite sure we want to do
that...I can though if pmichaud feels it's the way to go for now.)

Jonathan

@p6rt
Copy link
Author

@p6rt p6rt commented Jan 28, 2009

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

@p6rt
Copy link
Author

@p6rt p6rt commented Jan 29, 2009

From @chromatic

On Wednesday 28 January 2009 05​:43​:08 jnthn@​jnthn.net via RT wrote​:

I figured this would be easy to fix, but it's not. Basically, because
for infix​:=> we could have any complex expression that generates a key
on the RHS, and Parrot does not allow us to pass named arguments where
the name is from a register rather than from a string constant. I've run
into this one before...probably last time I tried to fix this... :-|

Can you show some example PIR code that should work?

-- c

@p6rt
Copy link
Author

@p6rt p6rt commented Jan 29, 2009

From @jnthn

chromatic wrote​:

On Wednesday 28 January 2009 05​:43​:08 jnthn@​jnthn.net via RT wrote​:

I figured this would be easy to fix, but it's not. Basically, because
for infix​:=> we could have any complex expression that generates a key
on the RHS, and Parrot does not allow us to pass named arguments where
the name is from a register rather than from a string constant. I've run
into this one before...probably last time I tried to fix this... :-|

Can you show some example PIR code that should work?

Ah, yes, sorry...

.sub 'main'
  $S0 = 'foo'
  example('foo'=>42) # works
# example($S0=>42) # what I want to work also
.end

.sub 'example'
  .param pmc foo :named('foo')
  say foo
.end

Uncomment the line I commented out, and IMCC gives a syntax error.

Thanks!

Jonathan

@p6rt
Copy link
Author

@p6rt p6rt commented Jan 29, 2009

From @Whiteknight

On Thu Jan 29 02​:16​:23 2009, jonathan@​jnthn.net wrote​:

.sub 'main'
$S0 = 'foo'
example('foo'=>42) # works
# example($S0=>42) # what I want to work also
.end

.sub 'example'
.param pmc foo :named('foo')
say foo
.end

Uncomment the line I commented out, and IMCC gives a syntax error.

IMCC currently allows this "name"=>value syntax in three places​: in a
.return directive, in an argument list to a subroutine, and in a target
list of returned values​:

  .return("name"=>value)
  MySub("name"=>value)
  ("name"=>value) = MySub()

I assume that we want to be able to use SREGs (and string variables) in
all of these places? Or, are we looking to be more general to try and
include all stringifiable registers and variables here?

--
Andrew Whitworth
a.k.a Whiteknight

@p6rt
Copy link
Author

@p6rt p6rt commented Jan 29, 2009

From @chromatic

On Thursday 29 January 2009 02​:14​:23 Jonathan Worthington wrote​:

Can you show some example PIR code that should work?

Ah, yes, sorry...

.sub 'main'
$S0 = 'foo'
example('foo'=>42) # works
# example($S0=>42) # what I want to work also
.end

.sub 'example'
.param pmc foo :named('foo')
say foo
.end

Uncomment the line I commented out, and IMCC gives a syntax error.

I can't reproduce that error as of r36159.

(That's because I fixed it in r36159.)

-- c

@p6rt
Copy link
Author

@p6rt p6rt commented Mar 29, 2009

From @moritz

On Sun Jan 25 04​:44​:47 2009, masak wrote​:

Rakudo r35994​:

$ perl6 -e 'Hash.new( a => "b" )'
$ perl6 -e 'Hash.new( "a" => "b" )'
argument doesn't hash
[...]

Works now, and tested in t/spec/S02-builtin_data_types/hash.t.
Closing ticket.

@p6rt
Copy link
Author

@p6rt p6rt commented Mar 29, 2009

@moritz - Status changed from 'open' to 'stalled'

@p6rt
Copy link
Author

@p6rt p6rt commented Apr 1, 2009

From @bacek

It's actually resolved not stalled.

--
Bacek

@p6rt
Copy link
Author

@p6rt p6rt commented Apr 1, 2009

@bacek - Status changed from 'stalled' to 'resolved'

@p6rt
Copy link
Author

@p6rt p6rt commented Apr 4, 2009

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

@p6rt
Copy link
Author

@p6rt p6rt commented Apr 4, 2009

From @masak

No, it's actually open, not resolved.

The original bug description also consisted of this Parrot leakage​:

$ perl6 -e 'sub foo(*%h) { say %h.perl }; foo( :a(1) )'
{"a" => 1}
$ perl6 -e 'sub foo(*%h) { say %h.perl }; sub bar(*%h) { foo(|%h) };
bar( :a(1) )'
argument doesn't array
[...]

As of Rakudo 924ec3f, the above still fails.

@p6rt
Copy link
Author

@p6rt p6rt commented May 13, 2009

From @moritz

On Sat Apr 04 02​:58​:31 2009, masak wrote​:

No, it's actually open, not resolved.

The original bug description also consisted of this Parrot leakage​:

$ perl6 -e 'sub foo(*%h) { say %h.perl }; foo( :a(1) )'
{"a" => 1}
$ perl6 -e 'sub foo(*%h) { say %h.perl }; sub bar(*%h) { foo(|%h) };
bar( :a(1) )'
argument doesn't array
[...]

As of Rakudo 924ec3f, the above still fails.

Works now (Rakudo 7b56f00fbbd3ac7cab98c20429051e7cfd2785ca), and tested
in t/spec/S06-signature/slurpy-and-interplation.t.

Anybody who protests any further will be shot ;-)

Cheers,
Moritz

@p6rt
Copy link
Author

@p6rt p6rt commented May 13, 2009

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

@p6rt p6rt closed this May 13, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant