Re: volatileStore ptr T question

2018-05-03 Thread GULPF
I don't think the special handling of integer literals works reliable (or at all?) for generic procs.

volatileStore ptr T question

2018-05-03 Thread jba
The below code throws an error on compilation. Not that MC_STOP and the other constants are defined like: const MC_STOP* = (0x) # Timer A mode control: 0 - Stop const OUTMOD_VAL_4* = (0x0080) # PWM output mode: 4 - toggle proc setupTimerISR() =

Re: Generated assembly for imported modules on MSP430

2018-05-03 Thread jba
So marking them as inline and then recompiling didn't work. With the way the compiler currently works the extra bytes wasted seems unavoidable. I think maybe it ends up not being a big deal because larger programs will have modules that likely need initialization of some kind. Can anyone tell m

Re: Generated assembly for imported modules on MSP430

2018-05-03 Thread jba
Thanks for the response. I have read that and partially implemented it where it made sense for my use case. I'm think this is a different problem however. I have already removed everything that isn't referenced, which is the main point of the article. The functions that are being called are refe

Re: Few mixed up questions

2018-05-03 Thread DTxplorer
To use C code in Nim I compile the C files with -c option (on GCC), then I use {.link: "your_binary.o".} pragma in Nim files and simple {.importc.} for each function or type. Maybe there is uses cases where importing headers is necessary but I haven't encontered this case for the moment. (maybe

Re: Installing Nim to non-standard directory

2018-05-03 Thread Araq
You're supposed to use a package manager to do the distribution over `usr/bin/local` and friends. > That's a problem for enterprise software. How so? Not requiring `sudo` to install it is an advantage.

Re: Few mixed up questions

2018-05-03 Thread mratsim
My own spin: 1\. Object are allocated on the stack while ref objects are allocated on the heap by the garbage collector. `let a = foo` will copy the object in the first case but will copy the reference to the object in the second case, so `a` and `foo` are completely distinct for object but the

Re: Statistics for standard library usage

2018-05-03 Thread Araq
> Is this an official source of things? If so, I'll create PRs for both > [https://github.com/nim-lang/website](https://github.com/nim-lang/website) > and > [https://github.com/nim-lang/packages](https://github.com/nim-lang/packages) > to add references. If not official, I'll just update the wi

Re: Statistics for standard library usage

2018-05-03 Thread Araq
> It would contain less code, therefore less bugs It would also be less useful. > Nim language reference would be smaller and therefore compiler implementation > easier The language is not its stdlib. > It would be easier to develop a test suite that signals the > production-readiness of Nim

Re: Few mixed up questions

2018-05-03 Thread mashingan
I'll answer to best what I know * 1\. object is preferable if you want value-type, while ref object is for reference-type (it's obvious from the name tho, ). I usually use reference-type when it's costly to create it such as IO, Files, memory etc. When using ref object, new is required altho

Few mixed up questions

2018-05-03 Thread ErikCampobadal
Hello! Been using nim for a few days, been reading a lot and feel really happy right now! Few questions (I myself come from high level languages although I've used few c) 1\. What is best to use: ref object or object and why. If using ref object, is "new" always needed? 2\. What's the differe