You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a duplicate of issue #3 , where passing an Html.Attributes.class instance to an svg function results in a runtime error, even though the code compiles just fine.
Example:
svg [ class "fill-green-400"][Icons.Outlined.check 20Neutral]
this compiles fine, but on runtime, we get an infinite loop of
Cannot set property className of #<SVGElement> which only has a getter
I know (through asking in Elm Slack - it took away about an hour of my time), that I need to pass in Svg.Attributes.class, but this is still an important bug to fix in my opinion. Here are two reasons why:
It breaks the core promise of Elm: I had code that compiled correctly but threw a runtime error
It violates a functional contract: I had a function that promised me if I gave it an array of Html.Attribute and Svg that I would get back an Html msg without side effects. I gave it valid instances of both and saw a side effect (detailed above). This is slightly worse than public Html<M> svg(List<Html.Attribute> attributes, List<Svg> svgs) throws Exception, because at least the method signature says the that it throws.
I saw the counterargument that I should know better about the difference between SVGs and HTMLs to pass in the right class method, but I counter that I really shouldn't need to:
In strongly-typed functional programming all I need to know is the type of my inputs to know what type of output I get and whether I should expect side effects. I might need to understand the workings of the function to know what value to expect, but not what type and whether any errors or other side effects will happen. The classical example is dividing by zero, where in an imperative language it may throw and error and stop the program, but in a functional language it will return a value so regardless of whether you understand division or not you know whether the program will continue running, throw and error, and what kind of value it will return.
The text was updated successfully, but these errors were encountered:
This is a duplicate of issue #3 , where passing an
Html.Attributes.class
instance to ansvg
function results in a runtime error, even though the code compiles just fine.Example:
this compiles fine, but on runtime, we get an infinite loop of
I know (through asking in Elm Slack - it took away about an hour of my time), that I need to pass in
Svg.Attributes.class
, but this is still an important bug to fix in my opinion. Here are two reasons why:Html.Attribute
andSvg
that I would get back anHtml msg
without side effects. I gave it valid instances of both and saw a side effect (detailed above). This is slightly worse thanpublic Html<M> svg(List<Html.Attribute> attributes, List<Svg> svgs) throws Exception
, because at least the method signature says the that it throws.I saw the counterargument that I should know better about the difference between SVGs and HTMLs to pass in the right class method, but I counter that I really shouldn't need to:
In strongly-typed functional programming all I need to know is the type of my inputs to know what type of output I get and whether I should expect side effects. I might need to understand the workings of the function to know what value to expect, but not what type and whether any errors or other side effects will happen. The classical example is dividing by zero, where in an imperative language it may throw and error and stop the program, but in a functional language it will return a value so regardless of whether you understand division or not you know whether the program will continue running, throw and error, and what kind of value it will return.
The text was updated successfully, but these errors were encountered: