3 ms·
Yes, the language is definitely much more complex than I expected. I’m still getting the hang of some syntax choices like the `with … yield` and the myriad ways
by alin23 5y ago
Yes, the language is definitely much more complex than I expected. I’m still getting the hang of some syntax choices like the `with … yield` and the myriad ways of using closures: https://crystal-lang.org/reference/1.3/syntax_and_semantics/blocks_and_procs.html#with-yield https://crystal-lang.org/reference/1.3/syntax_and_semantics/...
But I really miss some of Crystal’s features in other languages I work with:
1. Being able to declare union types when ingesting some not-so-normalized data
alias UserID = String | Int32 | UUID
2. Macros and meta-programming
For example here I have a `storedprop` macro which I can use to define propertied that get saved automatically to a YAML config when they are changed: https://f.lunar.fyi/uRW69B/settings.cr https://f.lunar.fyi/uRW69B/settings.cr
class Settings
include YAML::Serializable
storedprop host : String = "ddcutil-server.local"
storedprop port : UInt16 = 3485
end
The good thing is you’re not really required to learn this stuff if you don’t want. But they surely can make the language fit to your style better if you invest the time to understand them.