Keeping with the helpfullness of the compiler, having warnings when doing 
scetchy things with string interpolation (issue #905 on Github 
<https://github.com/elm-lang/elm-compiler/issues/905>) could be useful. 
This could be warnings about building urls's from variables that might be 
user input. It could also be about building SQL queries, or HTML. 

I suggest having some basic checks in the compiler for these areas where 
special care should be taken. This would generate warnings, assuming it is 
a mistake until proven otherwise.

`"http://example.com/profile/{{userdata}}/"` would generate a warning. 
`"http://example.com/profile/{{[url] userdata }}/"`would not. 

`"My name is {{[url] userdata}}."`would generate a warning.
`"My name is {{userdata}}."`would not.

`"Check out my <a href='://example.com/{{[html] 
userdata}}/blog'>blog</a>."` would generate a warning.
`"Check out my <a href='://example.com/{{[url] userdata}}/blog'>blog</a>."` 
would generate a warning.
`"Check out my <a href='://example.com/{{[html, url] 
userdata}}/blog'>blog</a>."` would not.

`"Select * from users where username = '{{userdata}}'"` would generate a 
warning.
`"Select * from users where username = '{{[html, url] userdata}}'"` 
would generate a warning.
`"Select * from users where username = '{{[sql] userdata}}'"` would not.

Exact syntax is not important right now. I want to know what the community 
thinks about the idea of "I know what I'm doing"-annotated string 
interpolation.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to