Sha256: 539f03c87ebc3ee0a278dd45ebbd7b0432bfb138250dae15bf05569df3590dfc
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
Extensions and Macros ============== macro compile & load: compile klass$Extension1, load klass$Extension1, 1..n *hand wave* if encounter klass with annotation $Extensions, then - strip $Extensions - create klass$Extensions with just the annotation - compile to macrodest compile klass$Extensions referring to Extension1..n, so that it can be loaded from bytecode later macro load from bytecode: look up klass$Extensions gather Extension1..n Maybe could do: klass$Extensions klass$Extensions$Macro1 instead of Extension... $Extensions(....) class klass$Extensions end #------- extension compile &load extension AExt for_class A def aa: String toString end end transform -> class AExt def self.aa(zelf: A) zelf.toString end macro def aa quote {`@call.target`.toString} end macro_register A end $Extensions[....] class AExt$Extensions;end compile macro loading: load klass look in macroclasspath for klass$mirahExtensions, which has references to all the extensions class A macro def a quote { puts "a" } end end -> options: -> $Extensions[A$Extension1] class A #... end -> $Extensions -> mirah -d classes --macro-dest macro-classes classes/A.class macro-classes/A$mirahExtensions.class macro-classes/A$Extension1.class loading macros / extensions macros on classpath macros on macroclasspath extensions on classpath extensions on macroclasspath extension decomposition extension Foo of String def hello puts "hello, #{self}" end end -> class
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mirah-0.2.1-java | extensions_and_macros.md |
mirah-0.2.0-java | extensions_and_macros.md |