Suggestion to improve proc type infer, and some complains

2023-07-10 Thread alexeypetrushin
> What if there are 2 overloaded procedures that take a proc with one parameter > but different parameter type Then it's not enough data for compiler to decide which one to use and human should specify argument types explicitly. But in most cases Nim compiler does know what code means, yet stil

Suggestion to improve proc type infer, and some complains

2023-07-10 Thread demotomohiro
What if there are 2 overloaded procedures that take a proc with one parameter but different parameter type like this: type Event = object Event2 = object proc on_click(fn: proc(e: Event)) = discard proc on_click(fn: proc(e: Event2)) = discard on_clic

Suggestion to improve proc type infer, and some complains

2023-07-10 Thread alexeypetrushin
It reminds me talks from Lisp community, that brackets are just a minor detail, and with proper IDE support and highlighting you won't even notice it, and after a while stop noticing and may even like it :). Yes, I guess the discussion is pointless, there are those who like brackets, and who don

Suggestion to improve proc type infer, and some complains

2023-07-10 Thread ElegantBeef
> The question is why you need macros and AST magic, for trivial thing, passing > a proc to function. Well as you demonstrated you do not. You do not like the status quo, which is fine. I just provided a way that enables using `=>` in the present state of Nim, whilst being very reusable(Althoug

Compiling nimrtl.nim as static library

2023-07-10 Thread juancarlospaco
Time to Deprecate some switches...

Suggestion to improve proc type infer, and some complains

2023-07-10 Thread Araq
> when you really need it, it's not ok to use it everywhere. So put it in a helper module.

Suggestion to improve proc type infer, and some complains

2023-07-10 Thread alexeypetrushin
The question is why you need macros and AST magic, for trivial thing, passing a proc to function. This thing `template map*[T](coll: openArray[T], expr: untyped): untyped =` \- are you seriously propose to write code like this? So the whole codebase will be fragile and unmanageable mess with te

Suggestion to improve proc type infer, and some complains

2023-07-10 Thread ElegantBeef
I'll just post this here as I'm too tired to think of anything witty for either side. import std/[macros, genasts] proc replaceIdent(node: NimNode, idnt: string, with: NimNode) = for i, n in node: case n.kind of nnkIdent: if n.eqIdent idnt:

Suggestion to improve proc type infer, and some complains

2023-07-10 Thread alexeypetrushin
I had a temptation to add `Just don't mention mapit`. The problem of `mapit` is that you had to provide it for every `list.filterit,anyit,allit,deleteit` and so on and on, and for every custom method on your class. Writing two methods, say `delete`, one normal delete, and another deleteit, and