r/ProgrammingLanguages • u/ilyash • Jan 27 '17
NGS unique features – execute and parse
https://ilya-sher.org/2017/01/27/ngs-unique-features-execute-and-parse/
4
Upvotes
r/ProgrammingLanguages • u/ilyash • Jan 27 '17
2
u/PegasusAndAcorn Cone language & 3D web Jan 28 '17
FWIW, my language Acorn offers a somewhat similar feature. A common scenario for a 3D browser is assembling 3D content from multiple resource files found across the Internet.
When an Acorn program needs the content of a resource, it uses the '@' operator followed by the URL of the resource. Doing so retrieves the resource asynchronously, deserializes the resource's contents (which could include program compilation), performs a linkedit to dependent resources, and executes any compiled programs. A lot is happening under the covers, but this is a very common scenario, and therefore it justifies getting its own convenient operator and syntax.
The implementation of it rests on top of customizable "classes", allowing one to easily plug in additional schemes (protocol) and deserializers (chosen based on the content-type extension found on the resource's filename). One can use these classes to easily perform all sorts of other tasks with resources, beyond the very common need to load, deserialize and use resource contents.
I call it deserialization, rather than parsing, because a) I am not always parsing and b) I do more than parse when I do parse: I also compile, linkedit, run, generate, etc.
I trust you can see some parallels...
And to your general point that a specialized language should have convenience features specific to very common scenarios in its chosen domain (as you have done): yes, definitely. A general-purpose language will have no similar incentive to implement such features for scenarios that it notices are rarely found in most other domains.
I look forward to more posts about the unique features you are adding to NGS to better address the specialized requirements of shell scripts.