Chapter 10

What are the risks and potential benefits of Type I piracy?

Type I piracy refers to a situation where a third-party function is redefined with a custom implementation. The risk is that custom implementation may not conform to the contract as expected by the third-party module. Coded incorrectly, the system may become unstable and crash.

What kind of problems can arise due to Type II piracy?

Type II piracy refers to a situation where a third-party function is extended without using your own types in the function arguments. It can be problematic because there is no guarantee that another dependent package also implements Type II piracy, conflicting with your pirate function. The result can be an unstable system.

How does Type III piracy cause trouble?

Type III piracy refers to a situation where a third-party function is extended with your own types but for a different purpose. While the function is defined using a custom type in the argument, there is no guarantee that the third-party module does not end up using your own function due to duck typing. Hence, your pirate function leaks into the third-party module and causes unexpected results.

What should we watch out for when specifying function arguments?

When specifying function arguments, we should avoid making the argument types too narrow. Arguments that are too narrow limit the reusability of the function.

How is system performance affected by using abstract function arguments?

System performance is not affected when function arguments are specified with abstract types. Julia always specifies the function depending on the type that is passed into the function. Hence, there is no runtime overhead.

How is system performance affected by using abstract field types for composite types?

System performance is affected negatively when abstract types are used for fields in a composite type. The Julia compiler must store pointers in memory for these objects because it has to support any data types relevant to those fields. Because pointers must be dereferenced to get to the data, system performance can be degraded greatly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.5.201