Re: Nim Community Survey 2019

2020-02-20 Thread miran
> any chance to re-open? Nope. The survey is over. * * * > One thing I wanted to mention, is that the pair of "no" answers in "Have you > made contributions" was a very weird choice > > (...) > > I had the exact same reaction as akavel regarding the "Have you made > contributions?“

Re: Pegs at Compiletime.

2020-02-20 Thread jyapayne
You might be able to use npeg, since it's a pure Nim library: [https://github.com/zevv/npeg](https://github.com/zevv/npeg)

Re: Creating Stream from a file using nimbass?

2020-02-20 Thread shashlick
Try passing diag.getPath().cstring.

Re: I have a super doubt

2020-02-20 Thread aksq
Thanks :3

Re: Nim new Playground/Pastebin of Spanish group

2020-02-20 Thread aksq
Muy interesante.

Re: I have a super doubt

2020-02-20 Thread aksq
I thank you very much for your time to help me

Re: Nim Community Survey 2019

2020-02-20 Thread dom96
The VS Code plugin is community supported. I do agree that it would be nice to have an official plugin.

Nim new Playground/Pastebin of Spanish group

2020-02-20 Thread juancarlospaco
Hello!!, so we created a new web for our tiny Spanish-speaking community here, thats also a Pastebin, thats also a Playground, has some good features like 120 Examples, machine code and AST of your code and others, we added QR Code SVG URLs recently too, feel free to visit, should not break too

Re: private type in public API is allowed

2020-02-20 Thread Araq
I don't remember if it was discussed before but I don't see the problem. Never had a bug because of it, in the worst case you can use `typeof` until your dependency got fixed.

Re: Nim Community Survey 2019

2020-02-20 Thread timothee
oups, guess I'm a bit late; I tried to fill [https://nim-lang.org/blog/2019/12/20/community-survey-2019.html](https://nim-lang.org/blog/2019/12/20/community-survey-2019.html) but it says it's closed; any chance to re-open? otherwise no big deal

Creating Stream from a file using nimbass?

2020-02-20 Thread drewin
Hello! Nim beginner over here, playing around with wNim and nimbass to learn nim by creating an audio player. The problem I have is that, no matter how I try to do it, I can't seem to get an audio file to be correctly made into a stream. The nimbass documentation says that the file path, on

Re: I have a super doubt

2020-02-20 Thread drifter
There is the book "Nim in Action". If you go to the nim home page and scroll down you will see.

Pegs at Compiletime.

2020-02-20 Thread solo989
The only thing stopping pegs from being used at compiletime seems to be that it uses a cstring for it's buffer and accesses the \0 character which causes an index error at compiletime and is ignored at runtime. How would I go about disabling index checks in the pegs.nim file? I tried {.push

private type in public API is allowed

2020-02-20 Thread tim_st
When type T is defined private in file test.nim and a public proc p (returns T) is defined in this file too, and test is imported in test2.nim, test.p can be used there but test.T can't and at the same time test.p returns T. I saw that this is forbidden in rust

Re: How to use pointer to mmaped file?

2020-02-20 Thread cblake
You can probably use `cstring` if on a C backend, but if you wanted to index some other element type than `char` (like `int` or `Foo`) you can also do let foos = cast[ptr UncheckedArray[Foo]](mmaped_file.mem) if i * Foo.sizeof < mmapped_file.size: doSomethingWith foos[i]

Re: I have a super doubt

2020-02-20 Thread treeform
I also would recommend Kiloneie's videos: [https://www.youtube.com/watch?v=5tVIsDYPClA](https://www.youtube.com/watch?v=5tVIsDYPClA) They start with the very basic and work up.

Re: How to use pointer to mmaped file?

2020-02-20 Thread readysloth
Thank you, that solves my issue :)

Re: How to use pointer to mmaped file?

2020-02-20 Thread enthus1ast
You must cast the pointer to a datatype.

How to use pointer to mmaped file?

2020-02-20 Thread readysloth
Hello guys! I have a quick question to resolve. I mmap some file from disk with memfiles module as streams and it works great, but some cases involve indexing mmaped file. Here is what i tried to do: var mmaped_file = memfiles.open("file", mode = fm_read_write) var mem_pointer

Re: reader macro

2020-02-20 Thread andrea
Do you produce your AST at runtime? Because macros are run at compile time, so that's too late. It sounds like you are trying to use Nim macros like a JIT, if I understand correctly

A 'made with Nim' website?!

2020-02-20 Thread Divy
Hi, I'm really interested in making a website showcasing projects made with Nim. What do you all say?

Re: How to package a nim program in an APK file

2020-02-20 Thread treeform
Can you compile your apk with Android studio without docker? Does it run? I would try docker approach after I got that to work.

Re: reader macro

2020-02-20 Thread jdn
Awesome, thank you very much for the links. Converting my AST to Nim AST is not my issue. It is putting that Nim AST into a macro to get it to compile which I'm struggling. I think I follow the basic logic in your compile macro although I haven't tried to sort out with my code. I'll report back

Re: How to package a nim program in an APK file

2020-02-20 Thread sschwarzer
The output is hard to read. You can use literal (code) formatting by putting triple backticks on a line before and after your code, [as in Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting). Syntax highlighting also works.

Re: Can't pass varargs to echo

2020-02-20 Thread Araq
Like this: import macros template a(x: varargs[typed, `$`]) = unpackVarargs(echo, x) a "a", "b", "c" Run

Re: How to package a nim program in an APK file

2020-02-20 Thread juancarlospaco
[https://github.com/akavel/hellomello#helloworldapk-built-with-nim-and-no-android-studio](https://github.com/akavel/hellomello#helloworldapk-built-with-nim-and-no-android-studio)

Re: Can't pass varargs to echo

2020-02-20 Thread gemath
Since `echo` takes a `varargs[typed]` parameter and these are the only exception to the "take a `varargs` parameter which already is an `openarray` as the list of args itself" rule, I don't see how to do this. A single parameter passed to `echo` will always be interpreted as the first of the

Re: How to package a nim program in an APK file

2020-02-20 Thread iwcoetzer
I am one step closer, I created a new docker container - after pulling this image: docker pull bitriseio/android-ndk Then I installed the following in that container: apt-get update apt-get install clang apt-get install mingw-w64 apt-get install -y curl curl

Re: Zig as C compiler for Nim. How to feed him the code

2020-02-20 Thread cumulonimbus
It's been a decade or so since I've used Windows, but IIRC at least one of cygwin/mingw32/mingw64 contained a linux cross compiler in the repository.

Re: How to use integer generics in types?

2020-02-20 Thread mratsim
You need static int type MatchPool[N: static int] = object # Here, N is an integer vals: array[N, int] var mp = MatchPool[3](vals: [2, 4, 1]) Run If N is not known at compile-time you have to use a seq (or a custom container with a runtime

Re: Nim Community Survey 2019

2020-02-20 Thread mratsim
`not nil` enforces compile-time checks which provides stronger guarantees. I'd say it's a first step towards Nim proving formal properties of a language. For example when interfacing with low-level pointer based API, you might want to say return a `ptr T not nil` from malloc (because if it was

Re: How to use integer generics in types?

2020-02-20 Thread xflywind
You can use static[int]. If you want to use array in runtime, maybe use UncheckedArray[int] or just seq[int] type MatchPool[N: static[int]] = object # Here, N is an integer vals: array[N, int] var mp = MatchPool[3](vals: [2, 4, 1]) Run

How to use integer generics in types?

2020-02-20 Thread adnan
type MatchPool[N] = object # Here, N is an integer vals: array[N, int] var mp = MatchPool[3](vals: [2, 4, 1]) Run Also, can I create new MatchPool of certain int in runtime in the heap?

Re: Nim Community Survey 2019

2020-02-20 Thread didlybom
According to the survey, Visual Studio Code is by far the most used editor for nim work. However the VSCode nim plugin is quite out of date. The latest version, 0.6.4 was released in September, before nim 1.0.0 was released. It also does not support (AFAIK) using nimpretty and is missing other

Re: Nim Community Survey 2019

2020-02-20 Thread c0ntribut0r
Me too. Is opening an issue a contribution? Is writing a library a contribution? Also I liked to read raw responses as you posted in 2017 survey: [https://nim-lang.org/blog/2017/10/01/community-survey-results-2017.html](https://nim-lang.org/blog/2017/10/01/community-survey-results-2017.html)

Re: reader macro

2020-02-20 Thread mratsim
Proc with a "NimNode" input are automatically compile-time, otherwise you can tag them with {.compiletime.} pragma. Regarding implementing your own AST with an Expr AST -> Nim AST, you might also be interested into my step-by-step experiments into writing a compiler in Nim macros:

Re: Nim Community Survey 2019

2020-02-20 Thread didlybom
I had the exact same reaction as akavel regarding the "Have you made contributions?“ question. The wording of the last answer was very odd.