3 ms·
This is interesting. I'm wondering what compelled the author to use the division magic method for arguments instead of the more intuitive and commonly used appr
by languagehacker 2y ago
This is interesting. I'm wondering what compelled the author to use the division magic method for arguments instead of the more intuitive and commonly used approach to passing parameters.
- lakshayg 2y agoInteresting choice indeed. It looks like it supports the traditional approach as well > wat object can quickly inspect things by using the division operator (to avoid typing parentheses). A short, no-parentheses syntax wat / object is equivalent to wat(object).
- enragedcacti 2y agoI think it makes a lot of sense in the context of a live interpreter. Wrapping and object in help() or dir() is an annoying set of movements vs. just pressing 5 keys with no modifiers (Home, w,a,t,/). It makes its feel much more like a magic command without actually needing it to be magic. The dot modifiers are also convenient compared to passing kwargs imo.
- pvg 2y agoThe README suggests for easier typing in interactive use.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- igrek51 2y agoIt's the parentheses that drove me crazy. As people already noted, it's for faster typing, at the cost of the division magic as you noted. If it's more familiar to you, it works with `wat(object)` syntax as well.
- wnolens 2y agoI love it