Monkey error messges...

Community Forums/Monkey Talk/Monkey error messges...

Rone(Posted 2011) [#1]
Hi,

unfortunately the compiler error messages are very minimalistic...

it shows only 'syntax error'...


Global _typeMap:IntMap<List<Entity>> = New IntMap<List<Entity>>
...
local i:int = 0
List<Entity> l = _typeMap.Get(i)


What's wrog?

Btw. this would be nice
Map<int, List<Object>> map = new Map<int,List<Object>>
...
List<Object> l = map[0]


Also, it seems that 'Property documention is missing...

Thanks

Does anyone know the property syntax?


Yasha(Posted 2011) [#2]
Shouldn't this be:
Global _typeMap:IntMap<List<Entity>> = New IntMap<List<Entity>>
...
Local i:int = 0
Local l:List<Entity> = _typeMap.Get(i)

...?

i.e. 1) Case-sensitive and 2) can't use C-style declarations? (Just a guess, I haven't been playing with Monkey yet.)

EDIT: Whoops, case-sensitivity doesn't apply to keywords.

In your second example... both declarations are C-style. Why do you want to type out long generic type definitions twice, when you could use the type-assignment-declarator syntax:
Local map := new Map<int,List<Object>>

...?

And 3) the documentation makes it sound like only reference types can be used as generic type parameters, so int might be out. A bizarre restriction if true (and easily tested - if it's not true, I would say the docs are misleading).

Last edited 2011