I found a sentence that was difficult to guess the meaning of the ‘Implementing a language feature’ topic of the ‘1.introduce’ chapter.
‘You might be aware, for example, that Optional
is just a generic enumeration. The truth is that most of the fundamental types are part of the standard library and not baked into the compiler.’
What does “not baked” mean in the sentence?
Thanks for the question. Languages like C have standard types like int
which are defined by code in the compiler. By contrast, Swift’s Int
is not part of the compiler code. Instead, it is defined using a Swift struct
. The advantage of that is that you, as user of the language, can define your own low-level types. For example, you could define a Point
type that could operate just as efficiently and natively as something like an int
.
By baked-in, I was trying to express “hardcoded” stuff that you can not change or imitate easily unless you recompile the compiler toolchain itself. In this sense, Swift is infinitely hackable, which makes it special.
1 Like
Thank you. I understand exactly what you are saying.
I was surprised by the quick reply, and thank you for your kind and detailed reply.
Have a nice day!
1 Like