matz / streem

prototype of stream based programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to access named array in namespace

octarect opened this issue · comments

Example:

def foo(obj) {
  puts(obj.id)   # ok
}
namespace Test {
  def foo(obj) {
    puts(obj.id) # error
  }
}
obj = new Test [id: 1]
obj.foo

To access fields in named array, you can use dot notation like: obj.id. However, I got an error "function not found" when I used the notation in the context of namespace.
In this case, I think I must use another notation like below;

puts(obj("id"))

Is there anything else I can write? I think it is good to use the same notation even in namespace.

It must be a bug. I will investigate later.