Re: is it possible to write a converter which only convert 0 to nil

2019-01-25 Thread Araq
Please write `nil`. Sometimes programming is about working with the programming language rather than fighting it all the time. (Though fighting can be plenty of fun too.)

Re: Nim Advocacy & Promotion Strategies

2019-01-25 Thread lscrd
> There is no var keyword that you have to use when first create a variable. My > "implicit var" proposal was for Nim to behave the same way for b = 2 as for > var b = 2. You'd still get b type-inferred as int with static checking like > in Crystal (or like with b := 2 in Go). But there are

Re: len [0, 1, 2] fails

2019-01-25 Thread Araq
It used to be parsed as `len[0, 1, 2]` (array indexing) but now it is supposed to work, so please create an official bug report.

Re: is it possible to write a converter which only convert 0 to nil

2019-01-25 Thread oyster
hi, Stefan_Salewski You find the lazy bone in me exactly, thank you for the explaination. Now the original Code( in [FreeBASIC](https://www.freebasic.net/) ) #include once "fltk-c. bi" sub QuitCB cdecl (byval self as Fl_Widget ptr,byval userdata as any ptr)

Re: Nim Advocacy & Promotion Strategies

2019-01-25 Thread Libman
Latest example legal PITA from the Big Dot Com languages: [Apple is indeed patenting Swift features](https://news.ycombinator.com/item?id=18997302) > Nim is widely regarded as having too many features (which is quite unfair), > so I don't think more syntax sugar is gonna cut it. I thought the

len [0, 1, 2] fails

2019-01-25 Thread juanv
let x = [0, 1, 2] a = len([0, 1, 2]) # ok b = len @[0, 1, 2] # ok c = len x # ok d = len [0, 1, 2] # fails Run Why?

Re: Code substitution with templates

2019-01-25 Thread solo989
Both of these work and are probably what he intended to do. template someCode(name: untyped): untyped = var fname {.inject.} = "Mark" var age {.inject.} = 44 type name = object fname: string age: int someCode somename Run

Code substitution with templates

2019-01-25 Thread solo989
I think this is the code he was referring to. template someCode(name: untyped): untyped = var fname = "Mark" var age = 44 type name = object fname: string # Error: cannot use symbol of kind 'var' as a 'field' age: int # Error: cannot use symbol of

Re: is it possible to write a converter which only convert 0 to nil

2019-01-25 Thread Stefan_Salewski
In Nim you can define procs with same name but different parameter list, so this compiles: type Fl_Widget = int Fl_Callback = int proc setCallback*(wgt: ptr Fl_Widget; cb: ptr Fl_Callback; pdata: pointer = nil; num: cint = 1):

Re: [release]binding for FLTK C dynamic library

2019-01-25 Thread oyster
The style is the last thing to consider. The first thing is to make a full and corrected binding with all examples written in nim without any problem, so I have to keep the original lower/upper case in code in order to refer to the original header files( there are both C and FreeBasic) and

Creating DLL With Nim Without nimrtl.dll?

2019-01-25 Thread Tristano
Hi, I wanted to enquire about the creation of DLLs in Nim and the requirement to include nimrtl.dll in the final project. I've read in the compiler documentation that: > Nim supports the generation of DLLs. However, there must be only one instance > of the GC per process/address space. This

Re: [release]binding for FLTK C dynamic library

2019-01-25 Thread oyster
updated. now most of the problem codes are: 1. OpenGl related 2. FreeBasic macro, or in other word, C's #define related. So that almost no function has EX in the name can run 3. Fl_Shared_ImageImages related

Re: [release]binding for FLTK C dynamic library

2019-01-25 Thread miran
> I do hope someone, who knows nimlang well, can join or give suggestions Here's a suggestion: don't use upper first letter for proc and variable names :P

is it possible to write a converter which only convert 0 to nil

2019-01-25 Thread oyster
The C code int setCallback(Fl_Widget* wgt, Fl_Callback *cb, void *pdata=NULL, int num=1); Run can be translated into proc setCallback*(wgt: ptr Fl_Widget; cb: ptr Fl_Callback; pdata: pointer = nil; num: cint = 1): cint

Re: Use continue statement on parent loop

2019-01-25 Thread lqdev
I just solved my issue by adding another variable. Thanks anyway

Re: Use continue statement on parent loop

2019-01-25 Thread GULPF
If your goal is continuing to the next iteration of the outer loop this works: for i in 0..<10: block innerloop: for j in 0..<5: if j == 3: break innerloop Run

Re: Use continue statement on parent loop

2019-01-25 Thread kaushalmodi
I was thinking the same, though you wouldn't need to use a label if breaking out of just the current loop, right?

Re: Use continue statement on parent loop

2019-01-25 Thread kaushalmodi
The manual does not define `continue` to have an argument. To better understand the problem, let's say you have `echo $i, " ", $j` in the innermost loop. What do you expect that to print out if the code worked as you expected? I'm wondering if you meant to use `break` instead.

Use continue statement on parent loop

2019-01-25 Thread lqdev
Hello, I'm trying to use a continue statement in the following fashion: block first: for i in 0..<10: for j in 0..<5: if j == 3: continue first Run However, the compiler reports that `continue` cannot have a label. How can I achieve this?

need help about a proxy server

2019-01-25 Thread bung
I'm devloping a web proxy server ,runs on my local machine. [https://github.com/bung87/proxy/blob/master/src/proxy.nim#L19](https://github.com/bung87/proxy/blob/master/src/proxy.nim#L19) I got this message when I refresh page quickly. Exception message: Too many open files