when (compiles do: import a): is very broken

2020-12-09 Thread demotomohiro
It seems test for the existence of a module is not necessary for this case. I explained about it here:

fusion/SharedPtr why []= sig undefined?

2020-12-09 Thread ggibson
I was just curious why something as simple as value assignment to a shared pointer is left out of the library? It seems so simple and useful that the omission appears deliberate. Maybe I completely misunderstand something about the library or about nim. Thanks for your time. import

Forex là gì? Tại sao bạn nên đầu tư Forex?

2020-12-09 Thread duyenforex
[url= là gì[/b][/url][b] [/b]vững chắc là một câu hỏi nghi vấn đối với những người nào mới khởi đầu Nhận định về forex. Forex như một kênh đầu tư nguồn vốn lớn như vậy như thị trường chứng khoáng hay v

any way to extra version info from .nimble file?

2020-12-09 Thread jackhftang
> You can pretend it's of a fixed format and use simple extraction mechanisms. > Isn't that what you ended up doing anyway when you write I mean 1. sometimes the version string have to be present in a config file for third party tools 2. third party tools may not provide any mechanisms to d

any way to extra version info from .nimble file?

2020-12-09 Thread Araq
> Having a separate nim file containing the version will require third party > tools to parse/understand that nim file. You can pretend it's of a fixed format and use simple extraction mechanisms. Isn't that what you ended up doing anyway when you write > You may say that the parsing as shown i

any way to extra version info from .nimble file?

2020-12-09 Thread jackhftang
Interesting, it seems everyone invented their way to update/share version. Let me share my two cents. Basically, the method is same as @cblake , I made a [nim task](https://github.com/jackhftang/my_nim_github_template/blob/master/my_nim_github_template.nimble#L28) that can show the current vers

cpp2nim.py - c++ bindings

2020-12-09 Thread mratsim
I've tried on libtorch as well, here is the result (unedited): The command I used (the other folder are bonus, I don't understand why they hid the high level API `torch.h` in a such a long path): python build/cpp2

any way to extra version info from .nimble file?

2020-12-09 Thread cblake
I got the basic idea. My point was about finding the include-ee following up on @SolitudeSF's point about finding the `.nimble` file. Basically, if the relative location of some source module and its `.nimble` can change then finding the `.nimble` from the source or the `.nimble` finding the `v

Newbie: Small program fails in "-d:release" but works with plain build

2020-12-09 Thread coffeepot
Hi @protium, I'm the author of odbc. As others have said, I'd assume something like `r[i][0]` or similar is what's failing. For example, if the database can't retrieve the data due to any number of reasons (eg; security) then you'd get an index error when trying to read the results, as they woul

ANN: NimternalSQL, an in-memory SQL database library for Nim

2020-12-09 Thread Araq
Already done, see

ANN: NimternalSQL, an in-memory SQL database library for Nim

2020-12-09 Thread reneha
It would be an interesting undertaking to design a "Nim Query Language" which can be embedded using macros. To support existing DBMSs it would have to be implemented on top of SQL.

any way to extra version info from .nimble file?

2020-12-09 Thread Araq
> @Araq's include idea is probably best, if that always works for nimble itself. Sure it does, Nimble asks the Nim compiler to run the .nimble file as NimScript, no bugs or inconsistencies are possible. :-)

Advent of Nim 2020 megathread

2020-12-09 Thread cantanima
Yes, that did it. Thanks.

any way to extra version info from .nimble file?

2020-12-09 Thread cblake
Evaluating it as NimScript is indeed what that `nimp` parser does (for new-style `.nimble`), but I agree finding it could be tricky. @Araq's `include` idea is probably best, **if** that always works for `nimble` itself. I have not tested it against all `nimble` operations, but if the `.nimble` f

Advent of Nim 2020 megathread

2020-12-09 Thread juancarlospaco
(Not mine)

Advent of Nim 2020 megathread

2020-12-09 Thread miran
> This probably isn't a big deal, but your code doesn't work on my input. I get When this happens, usually it is because you have a final newline in your input, and he didn't have it. Try changing the line at the beginning to: `input = parse "2020/input09.txt".readFile.strip` (added `strip`)

any way to extra version info from .nimble file?

2020-12-09 Thread SolitudeSF
the only complete parsing would be to evaluate the nimble file as nimscript.

Advent of Nim 2020 megathread

2020-12-09 Thread cantanima
This probably isn't a big deal, but your code doesn't work on my input. I get /Users/user/common/Ada/AoC2020/Day9/day09.nim(5) day09 /Users/user/common/Ada/AoC2020/Day9/day09.nim(3) parse /Users/user/.choosenim/toolchains/nim-1.4.2/lib/pure/collections/sequtils.nim(3

cpp2nim.py - c++ bindings

2020-12-09 Thread shashlick
Both c2nim and nimterop use the Nim compiler's renderer.nim to convert an AST into Nim code so there's no difference there. c2nim parses C++ itself, whereas nimterop uses tree-sitter but both generate Nim AST. My rationale for using tree-sitter and relying on the C preprocessor is documented in

cpp2nim.py - c++ bindings

2020-12-09 Thread mantielero
My code is crappy, believe me. Nothing to do with `nimterop` or `c2nim`. No aspirations here to be a contender. The results are crappy as well. Let me show some examples: proc ` new`*(this: var gp_Quaternion, theSize: cint) {.importcpp: "` new`".} Run or

cpp2nim.py - c++ bindings

2020-12-09 Thread deech
I have the beginnings of [nice Clang bindings for Nim](https://github.com/deech/libclang_bindings), it should provide full bindings to `libclang` and there's the beginnings of a porcelain to make the interaction nicer. I even have a [small NimScript](https://github.com/deech/libclang_nim_bundle

Windows to Mac OSX cross compiler?

2020-12-09 Thread enthus1ast
Osxcross can cross compile to macos, either use it in a docker or you might also be lucky with msys on windows (but I think it's not worth the hassle better use a real linux or docker for this)

when (compiles do: import a): is very broken

2020-12-09 Thread Araq
Yes, true.

cpp2nim.py - c++ bindings

2020-12-09 Thread mratsim
Very interesting. I'll try to use it to kickstart my libtorch bindings effort at . If you want to see what I need to deal with git clone https://github.com/SciNim/minitorch cd minitorch nim c -r --outdir:build minitorch/torch_in

when (compiles do: import a): is very broken

2020-12-09 Thread Clonk
If `__LINE__` and `__FILE__` are included, having a `__PRETTY_FUNCTION__` equivalent as well from C++ would be nice.

Obtain type from proc definition

2020-12-09 Thread giannigianni
Thank you @inventormatt, it works! And thank you to @xigoi too, I'll look at your link.

Windows to Mac OSX cross compiler?

2020-12-09 Thread LeFF
Hello! Has anyone seen any working C cross compiler that hosts on Windows and compiles Macho files (targets Mac OSX)? I was using toolchains from musl.cc to target various Linuxes from Windows and it worked well. But I couldn't find any cross compiler that targets Mac OSX as of yet. I hoped Zig'

Windows to Mac OSX cross compiler?

2020-12-09 Thread Araq
So setup a CI, it's 2020.

when (compiles do: import a): is very broken

2020-12-09 Thread Araq
Please bring it on, add a `std / moduletraits` module featuring `whichModule`. Also add `__LINE__` and `__FILE__` like capabilities while you're at it. But these probably need an RFC so that we figure out how they should work wrt template expansions etc.

C++ wrap - doubbt on & symbol

2020-12-09 Thread Araq
> Should I use byref when wrapping the type gp_XYZ? I think so. Note that `byref` has nothing to do with `ref`.

any way to extra version info from .nimble file?

2020-12-09 Thread Araq
The **real** solution is to have an include file that both your code uses and is included in the `.nimble` file.

any way to extra version info from .nimble file?

2020-12-09 Thread cblake
You can also `staticRead` the `.nimble` file and parse it at compile time. I have an example of doing this in [cligen](https://github.com/c-blake/cligen) in `tests/Version.nim`.

any way to extra version info from .nimble file?

2020-12-09 Thread SolitudeSF
you can define `const NimblePkgVersion {.strdefine.} = ""` to access this information when building with nimble.

cpp2nim.py - c++ bindings

2020-12-09 Thread Araq
IMHO new tools won't cut it. If you want something better than c2nim, evolve c2nim further by giving it a parser based on libclang. Same applies for nimterop. You simply won't get far with code generation via nimcode = "{} = proc( {} ):output".format(name,inputs, output)