ports and reserved words

57 views
Skip to first unread message

Craig Bilner

unread,
Oct 19, 2016, 5:48:42 PM10/19/16
to Elm Discuss
I'm probably missing something obvious here but when my port is a record with an attribute of `class` it comes through as `undefined`. Is there some documentation somewhere outlining reserved words in this area? Should the compiler throw?

Thanks

Frederick Yankowski

unread,
Oct 20, 2016, 11:20:31 AM10/20/16
to Elm Discuss
I had a similar problem with a field named `default`. I think you have to avoid all Javascript reserved words for records passed through ports.  http://www.w3schools.com/js/js_reserved.asp

It is an unfortunate leak of Javascript constraints into the Elm world. It does seem that the compiler could warn about such cases as it knows exactly which types of values are going over ports. 
Reply all
Reply to author
Forward
0 new messages