plaidgroup / plaid-lang

The Plaid Programming Language Tools
11 stars 1 forks source link

Cannot find fields using this.fieldname, but can find them when omitting "this" #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I've attached a test case that reproduces the problem.  I removed all uses of 
"this" except for one 
instance on line 32.

What is the expected output? What do you see instead?
The expected behavior is that this.head refers to the field of the List state 
named "head".  Instead, 
an error is thrown stating that the field "head" cannot be found.

From debugging, it appears that the scope gets messed up when instantiating new 
states using the 
"with {...}" notation.  I think it's due to the use of curly braces and some 
sort of confusion about their 
scoping rules with regard to instantiation.

Original issue reported on code.google.com by mhahn...@gmail.com on 19 May 2010 at 6:57

Attachments:

GoogleCodeExporter commented 9 years ago
When inside a constructor, "this" refers to the object currently being created. 
 "this" works properly outside of a 
constructor.  I believe this behavior is a fine model for how to treat "this".  
No further action is needed.

Original comment by mhahn...@gmail.com on 20 May 2010 at 6:57