Re: Complex vs Rational implementations in the Standard Library

2018-04-22 Thread Araq
PRs are welcome.

Complex vs Rational implementations in the Standard Library

2018-04-22 Thread FernandoTorres
I'm learning some features of the language, and I don't understand why in the Standard Library, the Complex type would be defined as a tuple, when the Rational type is defined as an object and allows generics? Shouldn't there be some sort of consistency in the ways these libraries are

Re: importc and dynamic name resolution

2018-04-22 Thread Araq
> Alternatively, use c2nim and use a regexp on the output c2nim offers `#nep1` and `#mangle`, no need for post processing with regexes.

Re: importc and dynamic name resolution

2018-04-22 Thread mratsim
You can create a custom pragma and tag your proc with it. It will get passed the proc AST, including the name so you can add h3d and uppercase the first letter so that it matches the C API. I don't have a handy example right now though. Alternatively, use c2nim and use a regexp on the output .

importc and dynamic name resolution

2018-04-22 Thread c0ntribut0r
Some library's C API functions look like this: h3dAddResource h3dDelResource ... In my nim wrapper I use: {.push dynlib:lib, importc:"h3d$1".} proc AddResource(...) proc DelResource(...) {.pop.} This appends "h3d" before proc name for C

Re: Perfecting Nim

2018-04-22 Thread arnetheduck
> bitsets a really nice macro? also, backend compiler optimizers are pretty good at getting perf for these kinds of ops anyway, and with fewer features in the nim compiler, there's more room in there for good compiler features - better error messages, better transformations.. > exceptions,

Re: Perfecting Nim

2018-04-22 Thread mratsim
* Dead code elim: make it the default * bitsets: No, I agree with the other posters they are super useful. I can squeeze lots of speed from them without thinking on how to reimplement bitvector, shifts, masking and all that jazz. * Exceptions. I think it really depends on the use case. I

Re: Perfecting Nim

2018-04-22 Thread Arrrrrrrrr
> bitsets I use them almost in every place, and I suppose the compiler does the same. > exceptions I would not remove them, but it piss me off when they are used in the stardard modules. I'd rather check if the result is equals to -1 or is none than have to handle an exception when trying to

Re: Perfecting Nim

2018-04-22 Thread amalek
> bitsets - why are these even in the language and not a library? Because they're **SUPER USEFUL** in game development, and from what I can tell lots of people use Nim for game development. You need resistances in you RPG? type Element* = enum eFire, eWater, eEarth,

Perfecting Nim

2018-04-22 Thread arnetheduck
"Perfection is Achieved Not When There Is Nothing More to Add, But When There Is Nothing Left to Take Away" With the specter of 1.0 approaching, it seems everyone is keen on squeezing their favorite feature in, but it seems to me that one would perhaps be better served by removing any and all

Re: Can I rewrite this in Nim?

2018-04-22 Thread Udiknedormin
Surely, why not?