Cheerp 3.0? C++ to WASM compiler

2023-03-15 Thread elcritch
Oh, thats the pragma for that. Still it'd not really work since Nim includes extra codegen like frame setup. Maybe if you turned off debug info, and others.

Cheerp 3.0? C++ to WASM compiler

2023-03-15 Thread amadan
Shouldn't using the [codegenDecl](https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-codegendecl-pragma) pragma work for making a function `[[cheerp::genericjs]]`?

Can Nim do Type States?

2023-03-15 Thread dwhall256
> How do y'all handle failures, like say integer overflow or a sensor returning > erroneous date, or plain old bit flips? Integer overflow is a feature, not a failure . Floating point exceptions, now _those_ keep us up at night. Some groups prefer software floating point libraries over

Can Nim do Type States?

2023-03-15 Thread dwhall256
> The DO-178 standard was mainly defined for the C language and I don't think > it is strictly applicable for other languages ​​like Nim. C, Ada and C++ are the three most prevalent languages used in aviation and the DO-178 standard is applied to those and any other who is willing to qualify

Slicing a string of characters from a starting point until all is selected.

2023-03-15 Thread Naterlarsen
Wow, I see. That helps a ton! Thanks for the help.

Trying To Slice the Characters Where Needed.

2023-03-15 Thread Naterlarsen
Thanks for the help. Appreciated.

Slicing a string of characters from a starting point until all is selected.

2023-03-15 Thread Yardanico
Nim's slicing syntax is different but not that far off: let mystr = "Hello world!" echo mystr[5..^1] # prints " world!" Run

Slicing a string of characters from a starting point until all is selected.

2023-03-15 Thread Naterlarsen
I am trying to slice a section of a string to obtain a specific section of that string. Here is an example in Python: import os my_string = "filesizec:\\users\\nate\\desktop\\thepark.jpg" new_string = my_string[8:] print(new_string) file_size =

Can Nim do Type States?

2023-03-15 Thread dwhall256
> malloc is very different from "meta programming" though, malloc is all about > runtime flexibility (allocation of unknown sizes with unknown lifetimes), > meta programming is about raising the level of abstraction so that programs > become shorter. Understood. I jumped ahead in my thoughts

Cheerp 3.0? C++ to WASM compiler

2023-03-15 Thread elcritch
Ok, some last notes in case others are interested in it. Installing Cheerp was much quicker / easier than either `brew install llvm` or emscripten's setup. It appears the Cheerp/clang++ works well with Nim output and strips any unneeded items. For a basic hello-world the `.wasm` output is only

Export C library components when using `--app:lib`

2023-03-15 Thread elcritch
Thanks guys! Not sure what was happening the other day -- likely I wasn't calling nimc right. I just tried @shirleyquirk's test and it ran fine. Nice! Now back to my regularly schedule how can I abuse Nim. ;)

Trying To Slice the Characters Where Needed.

2023-03-15 Thread shirleyquirk
I could only find the documentation for [slicing a seq](https://nim-lang.org/docs/system.html#system-module-seqs), but it works the same way: let s = "1234567890" echo s[0..4] echo s[5..^1] Run

Trying To Slice the Characters Where Needed.

2023-03-15 Thread Naterlarsen
When sending or receiving strings in nim, I'm not sure how to slice the part of the string I want to use. Example in python: import os enter_some_characters = input(str("Enter a string of 10 characters > ")) first_group_of_characters = enter_some_characters[:5]

Export C library components when using `--app:lib`

2023-03-15 Thread auxym
That's odd and might be a bug, as the docs specify: > The compile pragma can be used to compile and link a C/C++ source file with > the project I've persoally used `{.compile.}` in the past and haven't had a problem, Nim was building and linking the requested C files as requested.

Example of simple parser?

2023-03-15 Thread pietroppeter
[nim-markdown](https://github.com/soasme/nim-markdown) might qualify for your reuqirements. It has a [dev guide](https://enqueuezero.com/markdown-parser.html) that gives you a simple example on how to write a parser. Also it is pretty flexible in the sense that you might be able to customize

testament + valgrind: importing asyncdispatch or threadpool causes valgrind to throw?

2023-03-15 Thread noah
I ensured both `--m:orc` and `--define:useMalloc` were set in both [configuration and testament.cmd directive](https://github.com/nirv-ai/boat/pull/10/commits/9e508ef58e113cf2696cb8c6603bbf288f19a471) unfortunately, [all

Make Nim docker images official?

2023-03-15 Thread Isofruit
FYI to those reading here, I applied for the "nimlang" organization on dockerhub (which contains the docker images produced by the [nimage](https://github.com/moigagoo/nimage) project) to be admitted into dockers FOSS program. This should be possible as nimage itself and thus the nimlang

Moderator updates

2023-03-15 Thread Isofruit
Happy to provide support in the future, though more likely behind the scenes by helping with organizing than anything else ^^'

Moderator updates

2023-03-15 Thread pietroppeter
Thanks @pmunch and thanks for the good work done so far to Nim team and moderators ❤️! Happy and excited to be serving the community in a more official capacity (still a volunteer and still doing this in my free time ;)). Looking forward to work together with other moderators and present and

.o files going missing before linking?

2023-03-15 Thread Araq
Never heard of this issue before, sorry. I would suspect Windows AntiVir too, but if Linux is also affected ... who knows.

testament + valgrind: importing asyncdispatch or threadpool causes valgrind to throw?

2023-03-15 Thread Araq
Use `--mm:orc -d:useMalloc` with Valgrind in order to avoid false positives.

Trying to understand: is it better if IndexDefect is CatchableError or not

2023-03-15 Thread Araq
> how to catch everything is still actual. By using `try: except :`

A list of programs

2023-03-15 Thread Yardanico
that's because it's language and not lang :) [https://github.com/search?q=language%3ANim+stars%3A%3E100=repositories=advsearch=stars=desc](https://github.com/search?q=language%3ANim+stars%3A%3E100=repositories=advsearch=stars=desc)

A list of programs

2023-03-15 Thread PMunch
Unfortunately a lot of the apps in use in businesses seems to be closed source internal tools. But releasing a larger GUI application in Nim would indeed be a nice selling point.

Moderator updates

2023-03-15 Thread PMunch
Hi everyone, it has been more than a year since [our last announcement](https://forum.nim-lang.org/t/8629#56234) regarding community management, it's a bit longer than we would've like. But we feel like the changes from last year was a success inn our goal of better moderation. However we can

A list of programs

2023-03-15 Thread noah
testament includes a [set of pkgs](https://github.com/nim-lang/Nim/blob/devel/testament/important_packages.nim) that each nim version is tested against packages listed here should ideally have regularly updated release tags, so that: * we're testing recent versions of the

Make Nim docker images official?

2023-03-15 Thread moigagoo
I'm calling docker build with the appropriate tags. The tags are defined by the config file and the version passed to the build binary.

Export C library components when using `--app:lib`

2023-03-15 Thread shirleyquirk
maybe this is too naive a toy example, but it works: `clib.c` int sum(int a,int b){return a+b;} Run `nimlib.nim` {.compile:"clib.c".} #proc sum(a,b:int32):int32{.importc.} ## as @auxym says; if it's not static, it's exported ## even

Export C library components when using `--app:lib`

2023-03-15 Thread cblake
> in the Nim object cache but don’t seem to be[..]linkedin Maybe add `--passL:foo.o` ?

Make Nim docker images official?

2023-03-15 Thread elcritch
Oh nice, I’d have to dive into it more. Are you calling docker build or using docker buildx?

testament + valgrind: importing asyncdispatch or threadpool causes valgrind to throw?

2023-03-15 Thread noah
In all my testament specs I set `valgrind: true` however, if I import `std/asyncdispatch` or `std/threadpool` into file A * e.g. [this file](https://github.com/nirv-ai/boat/blob/bug/valgrind-fails-on-asyncdispatch-and-threadpool-import/src/boat/private/FileManager.nim) and then import file

A list of programs

2023-03-15 Thread elcritch
There’s a few TUI apps I believe.

Example of simple parser?

2023-03-15 Thread elcritch
The CSV parser in the stdlib is pretty straightforward example as well.

Export C library components when using `--app:lib`

2023-03-15 Thread elcritch
> If so, you shouldn't need to do anything. C doesn't have namespaces, as long > as the symbols are not static, they should be accessible (you'll need to > write a header file with prototypes though). That’s what I thought too. But Nim didn’t seem to be including the compiled C files. They’re

Make Nim docker images official?

2023-03-15 Thread jpalomaki
@Isofruit Thanks for the heads up So that change would affect the existing `nimlang` dockerhub organization: , wouldn't it? As to official images, they seem to be hosted under the `_` namespace, so I am not sure if they are connected to any particular docker

TinyRE - Tiny Regex Engine for Nim

2023-03-15 Thread marwal
I just started with Nim and I'm trying to do the things I did in Python. Can I get groups with tinyRE? var ppl = """olle=7, pelle=12, lisa=21, ringhals=42""" myMatches = match(ppl, reG"(w+)=(d+)") echo myMatches.groups # @[["olle",7], ["pelle",12], ["lisa",21],["ringhals,42]]

A list of programs

2023-03-15 Thread inv2004
@alexeypetrushin The search result looks pretty broken for me: OffensiveNim 2.2k nim-plotly 164 There are a lot of Nim projects in between

Make Nim docker images official?

2023-03-15 Thread Isofruit
I would like to extend what jpalomaki wrote: It'll likely also required a paid dockerhub subscription, as docker will no longer allow free tier team organizations as per an email sent out yesterday. Any free-tier organization currently operating (like the one the current nim-lang images are

Example of simple parser?

2023-03-15 Thread Willyboar
You can also check this great and relative gist:

Example of simple parser?

2023-03-15 Thread auxym
FWIW, if you're only interested in writing a simple recursive-descent parser that outputs an AST, you can stop after chapter 6 (out of 30). The rest of the book is about writing an interpreter and bytecode compiler.

Trying to understand: is it better if IndexDefect is CatchableError or not

2023-03-15 Thread inv2004
To closed the thread. I think that my initial problem and reaction came from the bad code in parsing like split()[idx] and it is just forced me to rewrite it better way with scanf after it I did not find any important [idx] and which fails - definitely bug and have to be fixed - thank you for

Export C library components when using `--app:lib`

2023-03-15 Thread auxym
If I'm understanding correctly, you are compiling a static or dynamic library, in which you are including C code using {.compile.}, and you want whatever is in those C files to be accessible to C code that is linked against your lib (or Nim via importc I guess)? If so, you shouldn't need to do

.o files going missing before linking?

2023-03-15 Thread exelotl
Hey! Some team members on my project are having an issue where linking sometimes (seemingly at random) fails because the .o files that were supposed to be produced by the Nim compiler aren't there. An example of what this looks like: The missing files in this case are ones whose .c sources

Make Nim docker images official?

2023-03-15 Thread PMunch
I've got some Dockerfiles for the playground as well, one which just builds a specific version, and one which also installs a list of packages.

Make Nim docker images official?

2023-03-15 Thread moigagoo
> Looks like you only have one dockerfile setup? No, I have a number of flavors available. There's slim image with just the compiler, a larger image with nimble, an onbuild image to be used as a base for apps. There are two base images too: Ubuntu and Alpine. The Dockerfiles are generated from

A list of programs

2023-03-15 Thread alexeypetrushin
Good way to find interesting repos [https://github.com/search?q=lang%3ANim=repositories=advsearch=stars=desc](https://github.com/search?q=lang%3ANim=repositories=advsearch=stars=desc)

A list of programs

2023-03-15 Thread Araq
There are not many around, I think. FOSS is generally about combining the poor type safety of C with the worse type safety of Python and Ruby. ;-)

A list of programs

2023-03-15 Thread Clonk
There is

A list of programs

2023-03-15 Thread grd
Is there a list of professional grade, actively maintained programs written in Nim? I know Awesome Nim but I don't know any programs that are primarily written in Nim, that are FOSS and with a GUI. I mean something like a calculator, database, editor and you name it, for Linux, Windows and / or

Nim ORC example benchmark

2023-03-15 Thread alexeypetrushin
I made a wrong title mentioning the benchmark. My question was not so much about the benchmark part, but more about understanding how to use it. I figured out how to use it in single thread mode, but still don't understand how it's supposed to be used in multi-thread mode.

Cheerp 3.0? C++ to WASM compiler

2023-03-15 Thread elcritch
Well got the hello world working: @ElegantBeef \-- I forgotten about that. Though oddly LLVM on macos doesn't support wasm outputs. Well at least last time I tried it. Does LLVM/Clang support the POSIX conversion too?

Cheerp 3.0? C++ to WASM compiler

2023-03-15 Thread elcritch
> there is also a lack of multi-threading etc That's preferred for my use case. I want to run user functions on an embedded device.. Though I think you can use web workers with WASM to provide multi-threading.

Nim ORC example benchmark

2023-03-15 Thread Araq
So write a better benchmark? :P

Cheerp 3.0? C++ to WASM compiler

2023-03-15 Thread Araq
It's not only POSIX calls, there is also a lack of multi-threading etc.

Nim ORC example benchmark

2023-03-15 Thread alexeypetrushin
In the ORC example benchmark from the [Post about ORC](https://nim-lang.org/blog/2020/12/08/introducing-orc.html) the request doesn't use sessions. I wonder how this example would look like, when request would need a) create sessions on demand b) Read/write to sessions made of complex GC data

How to reproduce the release build of Nim?

2023-03-15 Thread PMunch
Something like this?