Proposal: Inline Languages
See original GitHub issueProposal
I’d like to propose an idea for C# 8: inline languages. C and C++ have the __asm
keyword which opens a new syntactical scope for inline assembly coding [1][2]. Proposed are such nested scopes in C# 8 for an open-ended set of languages.
Inline languages are envisioned as implemented by .NET components and interoperable with integrated development environments, compilers and debuggers.
Modes of Operation
Three modes of operation are compatible with inline languages:
- As per
__asm
, generates program logic - Generates program logic which generates a runtime object
- Embeds a resource into an assembly and generates program logic to load it and to parse it into a runtime object
Advantages
- Software quality
- Maintainability - suitability for debugging (localization and correction of errors) and for modification and extension of functionality
- Readability
- Testability - suitability for allowing the programmer to follow program execution (runtime behavior under given conditions) and for debugging
- Optimization with MSIL
- Complexity reduction in use of nested languages
- data languages (XML, RDF, CSV, etc) with IDE features
- querying languages (SQL, SPARQL, etc) with IDE features
- programming languages (Prolog, etc) with IDE features
- special purpose languages (SRGS, SSML, grammars) with IDE features
Examples
using language __msil = System.Runtime.MsilComponent;
class Example1
{
void Function()
{
int x;
__msil
{
... x;
}
}
}
using language __xml = System.Xml.XmlComponent;
class Example2
{
void Function()
{
System.Xml.XmlDocument x1 = __xml
{
<!-- -->
}
System.Xml.XmlDocumentFragment x2 = __xml
{
<!-- -->
}
}
}
Scenarios
Ideas for inline language scenarios include:
__msil
,
__xml
, __rdf
, __n3
,
__sql
, __sparql
,
__pls
, __srgs
, __ssml
,
__antlr
, __grammar
,
__prolog
References
[1] https://msdn.microsoft.com/en-us/library/45yd4tzz.aspx [2] https://msdn.microsoft.com/en-us/library/4ks26t93.aspx
Issue Analytics
- State:
- Created 7 years ago
- Reactions:17
- Comments:18 (4 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
F#:
While we’re at it,
+