3 ms·
Long time Python dev here so choice #1 is a no-brainer and #2 looks reasonable too but I'm not so sure about the other two. Regarding #4, `obj.method` has alrea
by reinhardt 11y ago
Long time Python dev here so choice #1 is a no-brainer and #2 looks reasonable too but I'm not so sure about the other two. Regarding #4, `obj.method` has already a different meaning than `obj.method()` in Python, so how does Nim express it?
As for #3, I kinda see the motivation in statically typed languages for integrating independent libraries and frameworks with different naming conventions. In a dynamically typed language though refactoring is already bad enough, this would make it even harder. My "refactoring tool" of choice is grep (or rather ag, https://github.com/ggreer/the_silver_searcher https://github.com/ggreer/the_silver_searcher), with choice #3 you can't just grep for an identifier anymore.
- jboy 11y agoIn general in Nim (see footnote for fine print), `obj.someFunc` == `obj.someFunc()` == `someFunc(obj)` [0]. It's not a method bound to an object, as in `obj.method` in Python. So whenever there is some `obj.` in front of the function name, that's an argument being passed to a function call. [0] http://nim-lang.org/docs/manual.html#procedures-method-call-syntax http://nim-lang.org/docs/manual.html#procedures-method-call-... You can pass functions as first-class values (which Nim calls "procedural types" [1]) by supplying the function name without any arguments or parentheses, eg, `someFunc` on its own. [1] http://nim-lang.org/docs/manual.html#types-procedural-type http://nim-lang.org/docs/manual.html#types-procedural-type The base case occurs when the function takes no parameters: In this case, `someFunc` is a procedural type; `someFunc()` is a function invocation. Footnote for interested readers: closures [2]; setter properties [3]; multi-methods that use dynamic dispatch [4]. [2] http://nim-lang.org/docs/manual.html#procedures-closures http://nim-lang.org/docs/manual.html#procedures-closures , [3] http://nim-lang.org/docs/manual.html#procedures-properties http://nim-lang.org/docs/manual.html#procedures-properties , [4] http://nim-lang.org/docs/manual.html#multi-methods http://nim-lang.org/docs/manual.html#multi-methods