January 2020
Intermediate to advanced
532 pages
13h 31m
English
In general, whenever we need to access a specific field of an object, we can conveniently write it as object.fieldname. As it turns out, this notation is really syntactic sugar, that is, some sweet syntax, for the getproperty function call. To be clear, whenever we write the code in the following format:
object.fieldname
It is translated to a function call to getproperty:
getproperty(object, :fieldname)
For our lazy file loader example, fc.path is really the same as getproperty(fc, :path).
All that magic is performed automatically by the Julia compiler. A great thing about Julia is that this kind of magic is quite transparent. We can actually see what the compiler did by using the Meta.lower ...
Read now
Unlock full access