Difference between revisions of "LogiX:Overloading"

From Neos Wiki
Jump to navigation Jump to search
(Marked this version for translation)
 
Line 3: Line 3:
 
Logix is strongly typed, so nodes can only accept a single type of value for each pin. This means there needs to be multiple Logix components for each operator (for instance add for int32, and add for float), however users do not need to care about this because of [[wikipedia:Operator_overloading|overloading]].
 
Logix is strongly typed, so nodes can only accept a single type of value for each pin. This means there needs to be multiple Logix components for each operator (for instance add for int32, and add for float), however users do not need to care about this because of [[wikipedia:Operator_overloading|overloading]].
  
 +
<!--T:2-->
 
When you assign a pin in Logix with a [[:LogiX_Tooltip|Logix tooltip]], if the pin type does not match the type of the wire you are trying to connect, a search is done to find a different component representing the same operation that has compatible pins. If one is found the node is replaced, and the wire is assigned. If one is not found a [[:cast_(LogiX_node)|cast node]] may be created, or the assignment fails and the wire is not connected.
 
When you assign a pin in Logix with a [[:LogiX_Tooltip|Logix tooltip]], if the pin type does not match the type of the wire you are trying to connect, a search is done to find a different component representing the same operation that has compatible pins. If one is found the node is replaced, and the wire is assigned. If one is not found a [[:cast_(LogiX_node)|cast node]] may be created, or the assignment fails and the wire is not connected.
  
 +
<!--T:3-->
 
Many nodes support overloading with a set of input pins such as the [[:Multiplex_(LogiX_node)|multiplex node]], and some nodes can have more exotic overloading patterns such as the [[:×_(LogiX_node)|x node]].
 
Many nodes support overloading with a set of input pins such as the [[:Multiplex_(LogiX_node)|multiplex node]], and some nodes can have more exotic overloading patterns such as the [[:×_(LogiX_node)|x node]].
  
 +
<!--T:4-->
 
To see overloading in action, assign a float to a [[:%2B_(LogiX_node)|+ node]], then remove the wire and assign an int to the same node. The node should automatically convert to the float overload (which it likely spawned as), and then be converted to an int overload when that wire is connected.
 
To see overloading in action, assign a float to a [[:%2B_(LogiX_node)|+ node]], then remove the wire and assign an int to the same node. The node should automatically convert to the float overload (which it likely spawned as), and then be converted to an int overload when that wire is connected.
 
Do note that if you attach a float to the first pin, and then an int to the second, a [[:cast_(LogiX_node)|cast node]] is created instead.
 
Do note that if you attach a float to the first pin, and then an int to the second, a [[:cast_(LogiX_node)|cast node]] is created instead.
 
</translate>
 
</translate>

Latest revision as of 04:17, 9 July 2021

Overloading

Logix is strongly typed, so nodes can only accept a single type of value for each pin. This means there needs to be multiple Logix components for each operator (for instance add for int32, and add for float), however users do not need to care about this because of overloading.

When you assign a pin in Logix with a Logix tooltip, if the pin type does not match the type of the wire you are trying to connect, a search is done to find a different component representing the same operation that has compatible pins. If one is found the node is replaced, and the wire is assigned. If one is not found a cast node may be created, or the assignment fails and the wire is not connected.

Many nodes support overloading with a set of input pins such as the multiplex node, and some nodes can have more exotic overloading patterns such as the x node.

To see overloading in action, assign a float to a + node, then remove the wire and assign an int to the same node. The node should automatically convert to the float overload (which it likely spawned as), and then be converted to an int overload when that wire is connected. Do note that if you attach a float to the first pin, and then an int to the second, a cast node is created instead.