3 ms·
Thank you for making this. Have you considered an approach based on annotations and multi-line strings? I'm not sure string constants are valid targets for ann
by tofflos 6y ago
Thank you for making this.
Have you considered an approach based on annotations and multi-line strings? I'm not sure string constants are valid targets for annotations but maybe that could be added to the language?
@Language(name="Javascript")
"""
function callBark(aBarker) {
aBarker.bark();
}
"""
- mckinney 6y agoThank you! Yes, Manifold already supports Java 15 multi-line strings (aka text blocks) like this: var myValue = """ [>.js<] function foo() { return "hi"; } foo(); """; You can embed a resource fragment as either a declaration or a value. You use a string to embed a value fragment as with the JS example above. Note the [>.js<] header indicates the resource type for the string, similar to your annotation. As you surmised, an expression such as a string literal cannot be annotated.