Any plans for better optional arguments?

2021-08-28 Thread alexeypetrushin
> Most typed programming languages are using some kind of Option[T]. I would change it to "most old typed languages". > Nim should be moving towards not nil in the future anyways. TypeScript is not nil always. And has excellent optional arguments.

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-08-28 Thread jasonfi
You should think of the hard choices to start with, otherwise your efforts could be for nothing. Is such a program even possible?

Any plans for better optional arguments?

2021-08-28 Thread elcritch
> Most typed programming languages are using some kind of Option[T]. Yah, playing around with it a bit more and using `some` is pretty common in most other modern languages with Option types. It's really not that bad. I did toy around with adding a convenience function for it (similar to `%` or

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-08-28 Thread Niminem
Wow, now this is interesting thanks!

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-08-28 Thread Niminem
The way I'm approaching this is by converting Python ast to a JSON representation, and work recursively on that in Nim- adding to a nim ast tree. That shit looks complicated lol

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-08-28 Thread Niminem
So far I've got basic types, for/while loops, if/elif/else statements, variable assignments, function calls, and parameter-less function declarations. There are a couple of Python->Nim conversions for certain built-in calls like `print`. I'm at the point where it's time to handle the hard stuff

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-08-28 Thread xflywind
see also

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-08-28 Thread juancarlospaco
Fork and revive ?.

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-08-28 Thread Niminem
Hey guys, I'm developing a python-to-nim transpiler similar to `c2nim` and I have an initial design choice that needs to be made at this point. I'd like to get some input from you prior and current Python developers if I may. Converting Python Lists to Nim Type: Current choices I'm thinking of

Any plans for better optional arguments?

2021-08-28 Thread juancarlospaco
Using `void` to represent Null is not a better idea than using `Option[T]`. Most typed programming languages are using some kind of `Option[T]`. Nim should be moving towards `not nil` in the future anyways.

Advice for handling circular dependencies (functions)

2021-08-28 Thread Niminem
Thank you my good sir, so far this has been the solution. I actually went back and read the entire manual again- I've been coding Nim for a year now and this entire time I thought forward declarations for procs were simply defining the entire proc, including its body, before using it somewhere

how to reverse string in nim

2021-08-28 Thread ynfle
There is also `unicode.reversed`

Any plans for better optional arguments?

2021-08-28 Thread elcritch
I used a varargs the other day partly to do this the other day. When dealing with C api's they all use the sentinel value approach, but it's kind of annoying and not as type safe. Reading the above comments sounds like Nim is pretty close to solving this problem but runs into a few corner cases

Advice for handling circular dependencies (functions)

2021-08-28 Thread Yardanico
The usual way to handle this problem is to just add forward declarations of your procedures: proc addFor(nimTree: NimNode, pyNode: JsonNode) # this proc adds a new IF statement tree to parent ast tree proc addIf(nimTree: NimNode, pyNode: JsonNode) = # some logic

Advice for handling circular dependencies (functions)

2021-08-28 Thread Niminem
Hey guys, I'm writing a python-to-nim transpiler and ran into a circular dependency problem for some procedure calls. Can I get some feedback/advice on a way to handle this? Here are two sample procs: # this proc adds a new IF statement tree to parent ast tree proc addIf(nimTr

disk based btree

2021-08-28 Thread cblake
The fusion one is very "`ref object` store GC'd types in it/use the existing nim allocator". For external use you will at least need your own node allocator and probably a prohibition against (or at least very special handling of) GC'd types like `string`. [adix](https://github.com/c-blake/adix

Goodboy Galaxy - Kickstarter and demo now live!

2021-08-28 Thread enthus1ast
Can you give a little insight what technologies you've used?

Goodboy Galaxy - Kickstarter and demo now live!

2021-08-28 Thread dom96
Huh, I didn't even notice the Kickstarter page has a link to a demo. Either I'm blind or it might be a good idea to modify the banner image to include the words "Click Here to Play Free Demo!" :) I bought it anyway, but the demo has blown me away even more. Really amazing work putting this toge

code competition.

2021-08-28 Thread dom96
Programming languages unfortunately lack the sentience to organize coding competitions. Maybe you'd be willing to organize one?

code competition.

2021-08-28 Thread Kalbhairab
Nim should organize code competition as other programming languages do.

disk based btree

2021-08-28 Thread Araq
Fusion has BTrees that should be easy to patch so that they support writing to disk.

disk based btree

2021-08-28 Thread rforcen
haven't found a nim implementation for it, so i just ported a simple implementation: suitable for a fixed environment, it that just fits my needs of a 1e8 key array[10,char] file based index btree limitations: 1. fixed key & data type

Goodboy Galaxy - Kickstarter and demo now live!

2021-08-28 Thread Yardanico
Amazing! Maybe put it in ?

Any plans for better optional arguments?

2021-08-28 Thread alexeypetrushin
Looks good, but the code below would fail: proc somefn(v: int | void = void) = when v is void: echo "default" else: echo v someFn(10) someFn() proc anotherfn(v: int | void = void) = somefn(v) anotherfn(10) anotherfn()