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.)
> 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 cas
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.
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)
flMessageT
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
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?
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
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 k
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): cin
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 exam
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 in
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
> 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
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
I just solved my issue by adding another variable. Thanks anyway
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
I was thinking the same, though you wouldn't need to use a label if breaking
out of just the current loop, right?
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.
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?
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
Addi
20 matches
Mail list logo