3 ms·
By the way, Jai (which is a language currently being developed and is beta) has a “using” keyword which allows you to import the scope of the struct in normal f
by cyber_kinetist 4y ago
By the way, Jai (which is a language currently being developed and is beta) has a “using” keyword which allows you to import the scope of the struct in normal functions, which looks like:
do_something :: (using data: Data, arg: int) {
field1 = field2 + arg
…
}
Which lets you get rid of the annoying data.field1 and data.field2 indirection.
I really wish more languages implement this feature…
- Jtsummers 4y agoCommon lisp has had that for ages too, though you specify which slots you are interested in and possibly rename them (useful when you have multiple instances of the same class or classes with common slot names). http://clhs.lisp.se/Body/m_w_slts.htm http://clhs.lisp.se/Body/m_w_slts.htm http://clhs.lisp.se/Body/m_w_acce.htm#with-accessors http://clhs.lisp.se/Body/m_w_acce.htm#with-accessors