Re: completely new to programming

2017-11-13 Thread random898989
Agree with @jibal! Read the "Learn Nim in Y minutes" for an overview of the language. Read "Nim tutorial I and II". Peruse the documentation for an overview of the library capabilities. And as you do, try writing and running some Nim code in the process. Rosetta is a good place for exercises as

redirecting in jester from outside the routes block

2017-11-13 Thread random898989
Can someone please help me understand why calling baz() doesn't really seem to redirect in "/bar" (and falls through ending up responding "uh oh")? I thought templates expanded verbatim inline? import jester, asyncdispatch, htmlgen template baz() = redirect "/foo"

Re: cannot import windows

2017-11-13 Thread Tiberium
You should do "import oldwinapi/windows", not "import windows".

Re: atomics: Why is interlockedCompareExchange8 "safe"?

2017-11-13 Thread Araq
Can't really remember but it was likely something like "argh this needs to compile **now** and I know my data is aligned at an 8 byte boundary".

Re: completely new to programming

2017-11-13 Thread mikra
very difficult question; sure it depends on your personal situation. For absolute beginners I recommend first learning BASIC and then glance at ASSEMBLER(if you are interested in I would start with the 6502; there are some free emulator/simulators there) and then try Nim (why not). For the first

Re: Heterogeneous object pool with Timed Eviction

2017-11-13 Thread cdome
I found it useful when I worked my memory caches: [http://antirez.com/news/109](http://antirez.com/news/109) [https://arxiv.org/pdf/1512.00727.pdf](https://arxiv.org/pdf/1512.00727.pdf)

Re: atomics: Why is interlockedCompareExchange8 "safe"?

2017-11-13 Thread monster
@cdome Great! @Araq So, is/was (I'm assuming the '8' version is going to be used in the future), the call safe? I cannot imagine it would have been used at all, if it caused random memory overwrite. Maybe the 'compare' part of the call makes this safe? But then, why even bother offering 8/16/32

Re: completely new to programming

2017-11-13 Thread jlp765
**@puwad**, what are you goals in programming? career, recreational, have something you want to write/build, web development, ... ?

Re: completely new to programming

2017-11-13 Thread Stefan_Salewski
> I say this as someone who spent decades writing C code So you did exactly what I suggest Of course it is difficult to make suggestions to puwad as we don't know him. But starting with Nim TODAY for a real beginner is really hard. And Nim in Action is not a book teaching Nim for beginners. Th

Re: bytes to hex string

2017-11-13 Thread jlp765
Have a look at `toHex()` in strutils which for anything bigger than a byte, you can specify the number of Hex chars to produce, and for a byte will output two hex chars. so maybe as the equivalent of one of your %x try (untested) "$1$2$3$4" % [toHex(b[0]), toHex(b[1]), toHex(b[2]),

Re: completely new to programming

2017-11-13 Thread jibal
If someone starts out looking at and liking Nim, I think advising them to learn C is completely wrongheaded. (I say this as someone who spent decades writing C code and was on the ANSI C standards committee.) I suggest starting at [https://nim-lang.org/documentation.html](https://nim-lang.org/do

Re: completely new to programming

2017-11-13 Thread Stefan_Salewski
> completely new to programming My personal view is that starting with some simple C is a good decision for absolute beginners. It is no waste of time, as every serious programmer will need some C knowledge. And C is close to assembler, so you really learn how computers work internally. You sh

cannot import windows

2017-11-13 Thread frogEye
I have installed oldwinapi and it exists in .nimblepkgs folder. But when I am trying to import windows its giving me an error as Error: cannot open 'windows' Run Any help will be highly appreciated.

Re: atomics: Why is interlockedCompareExchange8 "safe"?

2017-11-13 Thread Araq
Thank you, you rock!

Re: Hiding sideeffect from compiler

2017-11-13 Thread Araq
There is a way to hide this, but I don't know if it's a good idea for your use case. proc sideEffect(a, b: string) = echo a, b proc lacksSideEffect() {.noSideEffect.} = cast[proc (a, b: string) {.nimcall, noSideEffect.}](sideEffect)()

completely new to programming

2017-11-13 Thread puwad
Hey guys! I'm not experienced programmer but i read some code examples at [http://rosettacode.org](http://rosettacode.org) for many languages at point of readability and then I thought that Nim code is most clear to understand and maintain in future. But here no courses to complete beginners if

bytes to hex string

2017-11-13 Thread random898989
Ok this is embarrassing but what's Nim's equivalent of printf? In particular stringifying a bunch of bytes as a hex string? I see a format proc in strutils but it seems to only accept string varargs. I was trying to put together a crude guid generation function I have in Golang (see below) but I

Re: Help wrapping a C++ module

2017-11-13 Thread jlp765
Might want to flag procs as `cdecl` with `--cdecl`

Re: Help wrapping a C++ module

2017-11-13 Thread shashlick
I was using _c2nim_ to do the conversion and since I wasn't providing the _\--header_ flag, it wasn't putting in the _{.importcpp.}_ pragma itself. A global _{.push importcpp.}_ wasn't working since these were under the _fts_ namespace. For some reason, it was thinking _fuzzy_match()_ was a proc

Re: atomics: Why is interlockedCompareExchange8 "safe"?

2017-11-13 Thread jwollen
Had various issues with the vcc version too. Just made a [pull-request](https://github.com/nim-lang/Nim/pull/6735)

Re: question about templates / namespaces / modules

2017-11-13 Thread jackmott
yep, looking for a nice runtime solution.