Annotation with List Argument

13 views
Skip to first unread message

Robert Fischer

unread,
Jan 30, 2012, 8:04:01 AM1/30/12
to The Mirah Programming Language
Okay, I think I've encountered a syntax error, but I don't get why.

The goal is to create a class with two annotated String fields.


class FastBigBenchmark < Benchmark

def initialize
$VmParam["-Xms32m -Xmx32m", "-Xms1g -Xmx1g","-Xms32m -Xmx1g", "-
Xms64m -Xmx64m","-Xms128m -Xmx128m" ]
@memory = String(nil)
end

end

Error I'm getting is:

Cause: (NativeException) jmeta.SyntaxError: expected Ensure before '
$VmParam["-' (at line: 14, char: 1)

Any idea what I'm doing wrong? It compiles just fine if I reduce it to
a single argument in the annotations. Does Mirah not support a list
argument in the annotation? Is there a way to kludge around that? Or
did I just muck up the syntax?

~~ Robert.

Robert Fischer

unread,
Jan 30, 2012, 9:44:23 AM1/30/12
to The Mirah Programming Language
Ignore the "two annotated String fields" comment. That was a poor
edit: I had two String fields, but simplified it to one in an effort
to debug it, and forgot to update my e-mail. So the goal is to create
a class with *one* annotated String field, and that's creating the
syntax error if the annotation has more than one element.

~~ Robert.
Science tells us we are merely beasts, but we don't feel like that. We
feel like angels trapped inside the bodies of beasts, forever craving
transcendence.
(VS Ramachandran, cognitive neuroscientist)

Robert Fischer

unread,
Jan 30, 2012, 10:22:59 AM1/30/12
to The Mirah Programming Language
Here's a minimal test case:

class Foo
$SuppressWarnings["foo", "bar"]
def test
end
end

One argument: OK. Two arguments: no dice.

Looks like this works, though:

class Foo
$SuppressWarnings[["foo", "bar"]]
def test
end
end

~~ Robert.
Science tells us we are merely beasts, but we don't feel like that. We
feel like angels trapped inside the bodies of beasts, forever craving
transcendence.
(VS Ramachandran, cognitive neuroscientist)

Nick Howard

unread,
Jan 30, 2012, 10:35:33 AM1/30/12
to mi...@googlegroups.com
Hmm, I suspect we don't currently handle arrays as arguments to annotations. Please file an issue about it.

If you want, you could look at adding array handling. The test file for annotations is here https://github.com/mirah/mirah/blob/master/test/jvm/annotations_test.rb
and if you check the blame, you'll see commits adding more types to our annotation argument handling.
Reply all
Reply to author
Forward
0 new messages