mirah/mirah — Issue #169: Cast within Macros Don't Seem to Work
Author: RobertFischer
Created: 2012-02-01 23:05:24+00:00
State: open

It doesn't look like there is a way to do a cast to an arbitrary type via a macro.

```ruby
import java.util.List

class Bar
macro def declare(clazz)
quote {
`clazz`(nil)
}
end

def doIt
x = declare List
x = []
puts x.getClass
end
end

Bar.new.doIt
```

Changing it from `clazz` to a bare "List", however, works—as is expected.
```ruby
import java.util.List

class Bar
macro def declare(clazz)
quote {
List(nil)
}
end

def doIt
x = declare List
x = []
puts x.getClass
end
end

Bar.new.doIt
```

I have to imagine this stunt is used somewhere else in Mirah — am I just all messed up on the syntax?