This restriction is annoying, but it's easy to relax later (from an API
perspective, maybe not an implementation one).
--
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 ema
Cool, glad to know it's tracked, didn't see the issue when searching.
Le vendredi 16 décembre 2016 08:55:50 UTC+1, s...@porto5.com a écrit :
>
> This is in a list of suggestions to be addressed some day
> https://github.com/elm-lang/elm-compiler/issues/1375
> 'Allow keywords as record field names'
This is in a list of suggestions to be addressed some day
https://github.com/elm-lang/elm-compiler/issues/1375
'Allow keywords as record field names'
It seems this can be possible, just not done yet.
On Friday, December 16, 2016 at 11:23:23 AM UTC+11, Nick H wrote:
>
> Ah, I guess you would run i
Ah, I guess you would run into typing issues if you tried to use a Dict...
that's just my knee-jerk response when people ask about doing things with
records that you can't do with records :-|
On Thu, Dec 15, 2016 at 4:06 PM, Nick H wrote:
> If you want something that can hold arbitrary string k
If you want something that can hold arbitrary string keys like a JavaScript
object, you can use a Dict.
Making keywords context-sensitive would be a language designer's nightmare.
I don't think most languages allow this. Which contexts would the keywords
be reserved, and which would they not be? E
Well, it certainly seems easier to make a robust parser if keywords are not
context-dependent. Yes, perhaps you could tell that { port = "foo" } is a
record with a 'port' field, but what about port = "foo"? Is that a record
missing its opening and closing braces, or a messed-up declaration of an
Both solutions are valid (I'm actually using both depending on the
situation) but my main question is why is there such a limitation? Reserved
keywords could (should?) depend on the context. You cannot define a real
port inside a record, you just want a string to name a property.
For example, i