UBC-Stat-ML / blangDSL

Blang core (parsing, generation, eclipse plug-in)
https://www.stat.ubc.ca/~bouchard/blang/
BSD 2-Clause "Simplified" License
2 stars 0 forks source link

Equality does not trigger auto deboxing #57

Closed alexandrebouchard closed 7 years ago

alexandrebouchard commented 8 years ago

Let x denote an object of type say IntVar. Then a statement of the form x == 1 will never be true since auto deboxing never triggers here.

A workaround would be to use extension method to overload ==, but we would need to find a way to auto import it to make sure it's always there.

alexandrebouchard commented 8 years ago

Work-around pushed in commit 3a7accf of blangSDK. Remains to do the auto-import of the extension methods in blang.utils.ExtensionUtils

alexandrebouchard commented 7 years ago

Instead of auto-import, maybe use local extension? I.e. methods from a base class

alexandrebouchard commented 7 years ago

That does not work in the base class because all the stuff is static.

Solution:

http://koehnlein.blogspot.co.uk/2011/07/extending-xbase.html https://github.com/svenefftinge/Xtext-2.0-released-source-code/blob/master/plugins/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/featurecalls/StaticMethodsFeatureForTypeProvider.java

alexandrebouchard commented 7 years ago

Actually, above deprecated, see instead: ImplicitlyImportedFeatures

alexandrebouchard commented 7 years ago

Ok prototype of this is working! Now just need to push through all the cases and clean up.

alexandrebouchard commented 7 years ago

Ok, fixed with f95a8b666bc3efbc521f6766cf5c3dbb22199206