I dislike the idea of any syntax that will let me do something dumb and let me "Fix it later" because that generally never happens
Zach ᐧ On Sun, Jul 31, 2016 at 11:15 PM, Filip Haglund <[email protected]> wrote: > 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] > <http://example.com/%7B%7B%5Bhtml%5D> userdata}}/blog'>blog</a>."` would > generate a warning. > `"Check out my <a href='://example.com/{{[url] > <http://example.com/%7B%7B%5Burl%5D> userdata}}/blog'>blog</a>."` would > generate a warning. > `"Check out my <a href='://example.com/{{[html > <http://example.com/%7B%7B%5Bhtml>, 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. > -- Zach Kessin SquareTarget <http://squaretarget.rocks?utm_source=email-sig> Twitter: @zkessin <https://twitter.com/zkessin> Skype: zachkessin -- 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.
