infinitenothing Posted October 16, 2018 Report Share Posted October 16, 2018 (edited) Coerce to type is useful for getting nontypedeffed data into a typedef form but there's a small problem of type safety. For example, if you try and coerce an I32 to a U8, the value will silently wrap without even so much as a coercion dot. But in recent versions of LV, we have something to ensure a little safety— "Assert Structural Type Match" And fortunately, for this use case, it's not so sensitive as to disallow typedeffed data from matching it's plain counterpart so we can use it to enforce a runtime error if someone wires an I32 up. And, to make this new function more convenient, you can wrap it up in a VIM. Edited October 16, 2018 by infinitenothing Quote Link to comment
shoneill Posted October 18, 2018 Report Share Posted October 18, 2018 (edited) Why would there be a coercion dot on the input of a function whose name implies it is being used for a coercion? The fact that a coercion is taking place is obvious due to the presence of the node for doing the coercion...... That aside, I think the addition of type safety would be a welcome additional function. But does your function allow us to coerce a U8 to a U16 for example? Here no data is lost and it should be completely safe (under the assumption the programmer knows what they are doing). Edited October 18, 2018 by shoneill spelling Quote Link to comment
infinitenothing Posted October 19, 2018 Author Report Share Posted October 19, 2018 No, it will break if you try and convert a U8 into U16 so it's a little conservative in that manner. The programmer would be expected to do the U8 to U16 upstream to "get rid of the broken arrow". It would be really cool if there was a way to allow all the "safe cooerces". Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.