Re: Installing Nim to non-standard directory

2018-05-01 Thread shashlick
Koch is the official tool to build and "koch boot" is the command. Details here: [https://github.com/nim-lang/Nim#compiling](https://github.com/nim-lang/Nim#compiling) You don't install _to_ somewhere, you clone /download to a location and build in place.

Re: Installing on Windows issues

2018-05-01 Thread shashlick
What's the actual path set in settings? Both the current user and the global path? And what's the Nim directory location? What's the output from finish.exe?

Re: Installing Nim to non-standard directory

2018-05-01 Thread cdunn2001
> you clone/download to a location and build in place. That's what I thought. That's a problem for enterprise software.

Re: Total noob, statically allocated circular buffer on microcontroller question

2018-05-01 Thread planhths
Hey! [This](https://github.com/notTito/nim-100days/blob/master/structures/ringbuffer_concurrent.nim) could be what you want.

Installing Nim to non-standard directory

2018-05-01 Thread cdunn2001
I don't see "install.sh" anymore. I think I need to run "niminst", but "koch tools" does not build it. How do I build niminst? Or better: How do I install Nim to a non-standard directory from a source build? "nim-install my-directory" I'm sure there is a doc-page I've missed.

Re: Installing Nim to non-standard directory

2018-05-01 Thread cdunn2001
I found "tools/niminst/niminst". (Not sure when/how I built that.) But how do I use it? * [https://nim-lang.org/docs/niminst.html](https://nim-lang.org/docs/niminst.html)

Re: Statistics for standard library usage

2018-05-01 Thread JohnAD
Adding a short opinion regarding what should be in the standard library for v1.0. Keep in mind my background is mostly python, however, I'm still a newb with Nim. One of Python's selling points is the large standard library that is distributed. But one of it's flaws, however, is that it only ha

Re: Installing on Windows issues

2018-05-01 Thread Libman
> Just grab the zip and extract them to some directory. It is an emerging tradition for modern Windows developers, in sheer child-like optimism, to run choco install nim first - and then die a little inside when they see the version number... It is an important ritual, to psychologically prepar

Re: Total noob, statically allocated circular buffer on microcontroller question

2018-05-01 Thread jba
That's perfect. Thank you.

Re: Total noob, statically allocated circular buffer on microcontroller question

2018-05-01 Thread mratsim
Yes, N is automatically inferred at compile-time. I also don't think you need to use the heap but a heap object initialized once and never deallocated works fine too I guess. Here you can find a definition from scratch of a custom static array type but that works like a seq from the outside. I

Re: Total noob, statically allocated circular buffer on microcontroller question

2018-05-01 Thread jba
Thank you for the reply. My concern was that the method has the N generic parameter in it. Does the compiler just figure that out and so the usage is as simple as something like: #--- circBuffer.nim import ringbuffer var myBuf*: RingBuffer[N: 8, T: uint8]

Re: [RFC] Adding @ prefix (or similar) to import

2018-05-01 Thread Udiknedormin
Oh, probably. I thought that by "attach" you mean: type Shape {.inheritable.} = ref object ... area: proc(Shape): float type Square = ref object of Shape ... proc newShape(...): Shape = ... area = areaShape proc newSquare(...):

Re: Statistics for standard library usage

2018-05-01 Thread GULPF
I agree that a big standard library is useful, and that there are areas that could be expanded (e.g I think the stdlib should include a `heap` implementation). But it only works if there are contributors interested in maintaining the modules. For some of the current modules, that's not the case.

Re: [RFC] Adding @ prefix (or similar) to import

2018-05-01 Thread Araq
I think you over-interpret my proposal. My proposal is mostly a "scoping extension", the existing overloading mechanisms continue to work.

Re: Statistics for standard library usage

2018-05-01 Thread dataman
> I am against reducing standard library. Fully agreed! To the contrary, I would prefer to expand it.

Re: VS Code linting broken?

2018-05-01 Thread Lando
@nucky9: same versions of VS-Code and Nim here. @honhon: checked for leftover/crashed nimsuggest instances, none found. Vs-Code's Nim plugin starts multiple nimsuggest instances, one for every folder (Nim package) in the workspace. The problem remains even after a fresh install of Nim and VS-Co

Re: Is there any problem with the code in atomic.nim for tcc?

2018-05-01 Thread mashingan
async lib is single thread.

Re: Perfecting Nim

2018-05-01 Thread Araq
> @[] and "" don't have to actually differ from nil, it could be an > implementation detail. Pretty much like option[ref T not nil] can be > implemented as ref T. Yep. And that's how it will be done.

Re: Statistics for standard library usage

2018-05-01 Thread cdome
I am against reducing standard library. Many developers find C++ useless without boost, python has huge stdlib and its main advantage of python. Dead code elimination on Nim makes less of a pain to import large libraries. Installation of third party libraries is always a pain. Corporate firewall

Re: [RFC] Adding @ prefix (or similar) to import

2018-05-01 Thread Udiknedormin
@Araq Well, I don't think it's possible to use generics in this solution. As far as I know, Rust's trait objects are implemented in a similar manner and they lack generic methods (that's one of the reasons why it's often advised to use generic traits rather than generic methods within non-gener

Re: cannot call a proc without brackets

2018-05-01 Thread Udiknedormin
@mashingan No, it's not about number of arguments. See that: proc fun(x,y: int) = echo x+y proc gun(x,y: int): int = x+y fun 1, 2 # works fine let x = gun 1, 2 # doesn't compile let x = gun 1: 2 # compiles (!), although it looks weird Just like GULPF sa

Re: Statistics for standard library usage

2018-05-01 Thread Udiknedormin
@GULPF That's very interesting, actually! I never thought I'm SO mainstream using so many macros.

Re: Perfecting Nim

2018-05-01 Thread Udiknedormin
@didlybom But strings and sequences ARE already treated a little differently than plain reference object types, aren't they? The most trivial example being: strings have their literals and sequences (and arrays) have `openArray` but neither string nor sequence has object constructor. So what no

Re: Is there any problem with the code in atomic.nim for tcc?

2018-05-01 Thread slangmgh
Yes, it works for thread, async.

Re: Total noob, statically allocated circular buffer on microcontroller question

2018-05-01 Thread Stefan_Salewski
> running Nim code on a medium size MSP430 32K Flash, 4K RAM. The > MSP430F5510-STK board from Olimex. Interesting. Can you access all the registers already? Do you use GC? Your project based on [https://github.com/lonetech/nim-msp430](https://github.com/lonetech/nim-msp430) ? Circular buffer

Re: Total noob, statically allocated circular buffer on microcontroller question

2018-05-01 Thread cdome
type RingBuffer*[N: static[int],T] = ref object #N=size, T=type buf: array[N,T] head, tail: int proc add*[N, static[int],T](self: var RingBuffer[N,T], data: T) = # some stuff and I don't think you need ref object for your use case.

Re: Is there any problem with the code in atomic.nim for tcc?

2018-05-01 Thread mashingan
Threads using TinyC never works for me on Windows, iirc.

Re: Is there any problem with the code in atomic.nim for tcc?

2018-05-01 Thread slangmgh
TinyC on Windows works well. The TinyC compile speed and code optimization is not as good as vc, but it is so small, the total size of tcc compiler and header/lib file is no more than 2M. It can compile the nim compiler successfully!

Re: Is there any problem with the code in atomic.nim for tcc?

2018-05-01 Thread Araq
Unlikely but I never got TinyC to work on Windows.

Total noob, statically allocated circular buffer on microcontroller question

2018-05-01 Thread jba
Hello, I am a young embedded software engineer, small microcontrollers almost exclusively, C exclusively. I'm very excited about what I see in Nim, but I am having trouble translating some concepts that I could do in my sleep in embedded C or assembly. I wonder if I'm just trying to shoehorn in

Re: Installing on Windows issues

2018-05-01 Thread slangmgh
Just grab the zip and extract them to some directory. [https://nim-lang.org/download/nim-0.18.0_x64.zip](https://nim-lang.org/download/nim-0.18.0_x64.zip)

Is there any problem with the code in atomic.nim for tcc?

2018-05-01 Thread slangmgh
The _cas code in `atomic.nim` for `tcc` of windows is disabled. elif defined(tcc) and not defined(windows): when defined(amd64): {.emit:""" static int __tcc_cas(int *ptr, int oldVal, int newVal) { unsigned char ret; __asm__ __volatile__ (

Installing on Windows issues

2018-05-01 Thread honhon
I'm not a window guy and I've found installing Nim easy on Linux and Mac however I tried to install Nim on a windows test machine and found it difficult. Its still now working. I tried both the download on the website and choosenim. The nim installer seems to think the path is set but it definit

Re: VS Code linting broken?

2018-05-01 Thread honhon
Maybe restart vscode or check that there are not any nimsuggest servers still running/crashed.

Re: idiomatic name for object setup

2018-05-01 Thread JohnAD
Thanks! I'll change the libraries to match up with these guidelines on the next release.

Re: Guessing the module -- works, but is there a even better way?

2018-05-01 Thread Hlaaftana
`compiles` takes an expression argument, not a string argument. I myself don't know a way to do this other than to do something like: import macros, times, tables macro m(o: typed): untyped = let oti = getTypeInst(o) let s2 = oti.toStrLit.strVal let s2ident

Re: idiomatic name for object setup

2018-05-01 Thread dom96
I guess the NEP needs a link to this document: [https://nim-lang.org/docs/apis.html](https://nim-lang.org/docs/apis.html) **TL;DR:** You should define a ` newFruit` procedure which performs the "setup". That answers #1 and #3. (Note that for non-ref object the convention is `initFruit`) As for

Guessing the module -- works, but is there a even better way?

2018-05-01 Thread Stefan_Salewski
[EDIT] Well, does not even work correctly, expected result would be "times.DateTime". "When compiles()" give the same. import times, macros macro m(o: typed): untyped = #let ot = getType(o) let oti = getTypeInst(o) #let s1 = $ot.toStrLit let s2 = $oti