[swift-evolution] multi-line string literals.

L. Mihalkovic laurent.mihalkovic at gmail.com
Thu May 5 02:01:42 CDT 2016


Rust and Scala support macros, C++ has templates, and even the venerable C has #defines. Introducing mera-programming is by no means easy as it generally equates introducing a second, more limited, language inside the original. There exists today an opportunity to take advantage of the string literal effort 
* provide a minimalmultiline literal extension
* provide a general mechanism into the current parser for dealing with "pockets" of semantically tagged contents into the stream of implicitely swift-tagged characters

The latter could be used at a later date for
* custom colorization schemes 
* custom validation

It is conceivable to reserve one of these semantic tags, say SWIFT_SIL for the introduction of SIL code in multiline litterals as a test of what macros in swift might be.

Done clealy, this scheme has the advantage of
* very minimal intrusion into the existing parser, reducing the risk of unwantes side effects
* very minimal level of commitment to featureset of string literals
* maximum open doors regarding what can be added via future via content tags (imagine using mime types as tags, while allowing the mirror API to query the tag value)
* a simple pathway for the introduction of macros, even supporting different types of macro types, none of which requiring changes to the parser once the proposed first step is in place

Regards
(From mobile)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160505/75860fda/attachment.html>


More information about the swift-evolution mailing list