plaidgroup / plaid-lang

The Plaid Programming Language Tools
11 stars 1 forks source link

Cannot have method and field with the same name #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
In the merged bug there is a state with a field and method of the same name.  

What is the expected output? What do you see instead?
The expected output is for the test to complete successfully and print out a 
series of numbers.  
Instead, it throws an error.

When initially loading the state, the runtime first records it as a field.  
Then when it encounters 
the method of the same name later, it overwrites it in the state prototype (or 
vice-versa, 
depending on which one the parser encounters first).  When the user expects to 
get the field, the 
method is returned instead.

I'm not sure if this is technically a bug.  Java allows having a field and 
method of the same name, 
but it also doesn't have first-class functions, which effectively make methods 
a type of field.

Original issue reported on code.google.com by mhahn...@gmail.com on 20 May 2010 at 7:45

GoogleCodeExporter commented 9 years ago
Issue 19 has been merged into this issue.

Original comment by mhahn...@gmail.com on 20 May 2010 at 7:45

GoogleCodeExporter commented 9 years ago
As an additional note on how other people do it, Python appears to allow it and 
just overwrites whichever one 
comes last.

Original comment by mhahn...@gmail.com on 20 May 2010 at 7:50

GoogleCodeExporter commented 9 years ago

Original comment by mhahn...@gmail.com on 20 May 2010 at 7:59

GoogleCodeExporter commented 9 years ago

Original comment by mhahn...@gmail.com on 25 May 2010 at 9:11