Good morning all, I just noticed that x2 has been replaced by x1 in the record definition. I have made the following changes
class test(v1, v2) #:whynot local x1 local x2 global y1 method add(y) static z1 x1 +:= y end initially(a, b) v1 := a v2 := b end class whynot(a,b) local c local d initially end and the relevant records are now record test__state(__s,__m,v1,v2,x1,x2) record whynot__state(__s,__m,a,b,c,d) The grammar specifies that you should be able to have multiple locals defined in the one local definition. regards Bruce Rennie On 20/03/14 02:57, Bruce & Breeanna Rennie wrote: > Good morning to all, > > I was running a test example and have found what may be an anomaly in > the unicon compiler. The source code is given below > > class test:whynot(v1, v2) > local x1, x2 > global y1 > > method add(y) > static z1 > x1 +:= y > end > initially(a, b) > v1 := a > v2 := b > end > > class whynot(a,b) > #local c,d > initially > end > > if the line that is commented out is uncommented, the unicon compiler > will fail with an error of > > Write(): can't handle treenode > > this occurs in line 874 of the idol.icn code. > > Otherwise, if left commented, the compile will succeed and the locals x1 > and x2 will be fields in the record > > test__state(__s,__m,v1,v2,x1,x1,a,b) > > My question is what is the expected result for using locals in the class > definitions when classes are subclasses of another. > > Secondly, if the class hierarchy is removed as below > > class test(v1, v2) #:whynot > local x1, x2 > global y1 > > method add(y) > static z1 > x1 +:= y > end > initially(a, b) > v1 := a > v2 := b > end > > class whynot(a,b) > local c,d > initially > end > > > the two state records obtained are as follows > > record test__state(__s,__m,v1,v2,x1,x1) > record whynot__state(__s,__m,a,b,c,*c*) > > Notice the d is missing from the second record definition and has been > replaced by the duplicate c > > regards > > Bruce Rennie > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > Unicon-group mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/unicon-group > ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Unicon-group mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/unicon-group
