Open sirinath opened 7 years ago
For evalution, it could be an explicit scope used to determine lazy or strictness. that can be tucked away with a macro that always simplier typing to specify such. [ strict scope ] and { lazy scope } which can be used in a (top default scope). you can then write ({display [and x y ] {or x y}}) as needed to dictate intent.
https://web.cs.wpi.edu/~jshutt/kernel.html
http://www.dalnefre.com/wp/2011/12/semantic-extensibility-with-vau/
http://mainisusuallyafunction.blogspot.com/2012/04/scheme-without-special-forms.html
Environment
Environments map Symbols to values. They are first-class semantic objects, yet their structure is opaque. They cannot be decomposed by operatives. This is one of the key principles underlying the safety of extensibility in Kernel. Operatives can manipulate syntax, but cannot violate the encapsulation of semantic values. This gives us the freedom to implement environments using more efficient native mechanisms of Humus, including functional representation of bindings and lazy initialization of environment actors.
Source: http://www.dalnefre.com/wp/2011/12/semantic-extensibility-with-vau/
I think the environment should not just be mapping symbol to value but should have a pair of symbol and type to value.
the environment does not bind to any value. the environment is used to evaluate an expression. the expression would always do a lookup for the type that is valid in an environment. the value you mention is just the local storage use at a call site when an evaluation actually occurs. so {x + x} could be given an environment where x has an int type or float type. it can also have an environment where the expression only evaluates to first occurrence of the x and caches it for later lookups.
@sirinath those are really great ideas! Also thanks for the links - they're very inspiring. I'll add one more recent (2019) article about "macro language from the bottom to the top" - it's a "rant" about Racket still not fully achieving this goal despite a lot of success in that regard (IMHO the closest existing language to the goals outlined by you in this discussion thread).
With regarding implementing N2 the following approach will make life easy.
There should be a minimal core with macros with macros implementing most of the language features.
The base language features which might be needed are:
Macros:
Heterogeneous Data Structures
Proofs
Also what might not be not needed in base or level 0 language:
Some inspiration for this:
But with syntax which is more readable (http://readable.sourceforge.net/) than Lisp variants above. Inspiration does not mean all features from all language but minimal essential features for the core with macros defining each layer.
Also it is not the intention of the general user or programmer to use Nemerle Base / Level 0 abstractions.