[swift-evolution] multi-line string literals

Travis Tilley ttilley at gmail.com
Sat Dec 12 00:25:53 CST 2015


That's another great example that I hadn't even thought of.


- Travis Tilley


On Fri, Dec 11, 2015 at 7:43 PM, Jason Dusek <jason.dusek at gmail.com> wrote:

> One use case for a slightly richer approach to indentation erasure — one
> that I encounter every day — is inline SQL. If it’s 10 lines or more, it
> should probably find expression as a VIEW or stored procedure; but
> queries like this are not unusual:
>
> func findMentions(account: String) -> Array<String> {
>     let db = databaseFactory().findDatabase()
>     let q = `​``SELECT array_agg(mentioner.id)
>                  FROM account
>                  JOIN mention ON (account.id = mentioned)
>                  JOIN account AS mentioner ON (mentioner.id = mentioner)
>                 WHERE account.handle = :1
>                 ORDER BY timestamp DESC
>                 LIMIT 1`​``
>
>     return db.query(q).parameterize(account).run()
> }
>
> Moving everything below q seems infelicitous, at best. However, I do see
> the appeal of basing the rule on the position of the backticks.
>
> Best Regards,
>
> Jason Dusek
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151212/6fbf9ec9/attachment.html>


More information about the swift-evolution mailing list