3 ms·
By "first-class", I really did mean "indistinguishable from the rest of the core of the language." Consider Monte: def x :Int := 42 # evaluated statement
by DonbunEf7 9y ago
By "first-class", I really did mean "indistinguishable from the rest of the core of the language." Consider Monte:
def x :Int := 42 # evaluated statement
def ast := m`def x :Int := 42` # quasi-quoted Monte fragment
eval(ast, safeScope) # easy evaluation
Now, it happens that m`` is a library written in Monte itself, but that's unsurprising when you consider how much of the Monte compiler is also self-hosting. Since Monte is a complex and rich language, the homoiconic representation is equally rich:
def m`def @lhs := @rhs` := ast # pattern-matching!
[lhs, rhs] # [mpatt`x :Int`, m`42`]