Cheap exceptions, opinionated error handling

2024-05-29 Thread doofenstein
I suppose additional error information have to be given as return values? > `proc p(args): T {.raises: ErrorCode.}` is translated to `proc p(args): > (ErrorCode, T)` when T is an integral type (int etc.). [...] This seems to > produce the best code for the common architectures (x86, x86_64, ARM,

Any suggestions on how to use nimsuggest?

2024-05-10 Thread doofenstein
Yes, nimsuggest is meant to be integrated into editors/IDEs. The stdin mode is mostly there for debugging.

How do I emulate ruby's super() for a subclass object's constructor.

2024-05-02 Thread doofenstein
One way to do this would be to separate out the initialisation and object creation into to procs: proc initParent(p: ParentObj, value: int) = p.parentField = value proc newParent*(value: int): ParentObj = new result result.initParent(value) # This

Unicode operators / Arrays, which size is know at run time

2024-05-01 Thread doofenstein
Sequences are dynamically sized arrays (, ). I recommend you checking out a tutorial (like the one linked) to learn about fundamental Nim data types like sequences. Unicode operators c

Oversight or intentional?

2024-03-20 Thread doofenstein
To elaborate on Araq's answer, in Nim like in many other programming languages such as C++ or Java there is a fundamental difference between these two cases. Your first example shows a regularily defined procedure while the latter does two things at once. It defines a variable and assigns to it

ref types and the align pragma

2024-02-20 Thread doofenstein
C and C++ have `aligned_alloc ` for a while now, which should work everywhere as long as the compiler is somewhat up to date (C11/C++17).

nimsaem extension stops working correctly when there's an error in the code

2023-09-05 Thread doofenstein
I cannot reproduce, the errors are displayed fine. Is it possible that you have a project file set up which isn't the file you're working on/is not imported/included by it?

nimsaem extension stops working correctly when there's an error in the code

2023-09-05 Thread doofenstein
that sounds like a bug in the Nim compiler error output parsing, we've had those a few times. Can you please provide me with some (ideally minimal) code which triggers this behaviour?

Some of Nim's convention needs to change in order for it to succeed

2023-07-23 Thread doofenstein
I'm sorry for not engaging much on a level of content. Posts like this, which if I'm mean boil down to "Nim should be more like programming language X" where X is Python, C++, Julia, Rust or whatever appear here from time to time. And they always put me wondering how these changes should be real

procs: forward declaration

2023-06-16 Thread doofenstein
well with treeform's example it actually does that, but that's only because once `mylibFunction` is inlined the proc call with appear. If you add anything more complex inbetween (like a echo in my case) it doesn't work anymore, because C compilers don't seem to reason at such grand scheme about

procs: forward declaration

2023-06-16 Thread doofenstein
if you like paying for the indirect branch I guess...

slice 3D Tensor into 2D Tensor in arraymancer?

2023-05-14 Thread doofenstein
You can get rid of a remaining dimension which is just 1 by reshaping it. import sugar import arraymancer var imgIn = read_image("narg.png").permute(2, 1, 0) # chw2whc echo "imgIn.rank = ", imgIn.rank echo "imgIn.shape = ", imgIn.shape let

Can I quick get table last key value use like at(idx) function?

2023-04-24 Thread doofenstein
last as in key with the highest value or last inserted?

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-30 Thread doofenstein
well as you can see in the code I sent, the most common way is to pass in an object marked with var. Then both this object and all of it's members are guaranteed to survive this stackframe and can be returned again in mutable form. This is e.g. also what `Table` does, where you pass in a `var Ta

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-30 Thread doofenstein
you forgot to pass a value for key in your example, though that's not the reason this error appears (it's there even when you fix it). To return `f[key]` as a `var string`, it needs to be an value which can be modified (an l value is what you would say in C land). But your `[]` proc returns jus

Any bad consequence of redefining equality for ref types?

2023-03-30 Thread doofenstein
Yes, for once if you have a ref object with cycles it can lead to an infinite loop or stack overflow. The other issue would be that it goes against the default semantics of ref objects in Nim, which a lot of code relies on, assuming you want to replace it in system.nim. I don't think it's an i

Help with macro/template-style transformation

2023-02-21 Thread doofenstein
> P.S. I'm pretty sure the macro is already wrong. However, the most baffling > thing of all is that after having echo ed v[0], at compile-time, it complains > that it cannot evaluate it... in the very next statement. Is this a bug? it's not a bug, the variables marked with {.compileTime.} and t

Help with macro/template-style transformation

2023-02-21 Thread doofenstein
it would be helpful if you'd post your current progress.

Nim vs the 6 languages I learned before it

2023-02-13 Thread doofenstein
this is a little known feature, but the vscode plugin actually supports this via folding comments (which original came from Visual Studio with C++? Atleast I've encountered them there the first time): #region let iCanBeFoldedIn = 0 #endregion Run

Immutable pointer type?

2023-02-13 Thread doofenstein
you can do something like this: type ImmutableWhatever = ref object of RootObj iAmImmutableData: int iAmImmutableToo: string MutableWhatever = ref object of ImmutableWhatever # getter proc iAmImmutableData(self: ImmutableWhatever): int = self.i

How to ref value types in tables?

2023-01-29 Thread doofenstein
the problem with that is that almost always when code like this is used the passed proc will be a closure. I think the proper solution will be that once views are stable enough an `Option[var T]` can be returned.

32 vs 64 bits

2023-01-16 Thread doofenstein
the compiler will have to split up each arithmetic operation into atleast two 32-bit instructions. Though unless you're doing nothing but arithmetic, I wouldn't matter all that much about the performance impact of it, compared to things like algorithmic complexity, cache friendliness, amount of

Delete items in a seq while iterating over it?

2023-01-05 Thread doofenstein
what I usually do is something like this: var i = 0 while i < myseq.len: if deleteCond: myseq.del i else: i += 1 Run it also works with both delete and del, but is admitedly not that pretty.

Assigning array to itself with different order

2023-01-01 Thread doofenstein
that looks a lot like bug to me. This is the generated C code: bytes[0] = bytes[(((NI)1))- 0]; bytes[1] = bytes[(((NI)0))- 0]; Run E.g.

Question about the let statement

2023-01-01 Thread doofenstein
the reason is, because other parts of the object aren't stored on the heap (length and depending on the runtime also capacity iirc). Another reason is that seqs behave exactly like regular non heap objects in that they have copy instead of reference semantics. So the internal pointer of a seq i

Trouble with Nim debugging in VS Code

2022-12-19 Thread doofenstein
it's a bit of an unfortunate thing to say, but it's not going to get much better than this. If you haven't been using --debugger:native already, that does makes some things like breakpoints work atleast in theory. Though if you have ever debugged C++ code, you know that when turning on the slig

Nimsugest Goes out of control

2022-12-02 Thread doofenstein
Unfortunately that's known behaviour for nimsuggest (in fact it used to be worse). If you haven't already setting up a project file, do that. If that doesn't bring any improvement, I fear it's time to say adieu nimsuggest, it's not the most reliable tool in the world (the addon has an option to

Macros Masking Common Errors

2022-10-10 Thread doofenstein
hm I like the concise mismatch error, though looking at it, it would be cool if the parameter where the mismatch happened would additionally be marked via formatting, e.g. by coloring it's name in red or something like this.

Is a Java-style GC possible?

2022-09-22 Thread doofenstein
> Is this really the case? AFAIK arc/orc doesn't do any locking but I haven't > been keeping up with it much. Any further reading on how this locking > operates? when you create a ref object with gc:arc/gc:orc it calls [nimNewObj](https://github.com/nim-lang/Nim/blob/80a0dc295bab6d7699c0da13b6b

Is a Java-style GC possible?

2022-09-20 Thread doofenstein
that benchmark is already a bit famous among Nim people because of how terrible it is (though it's not even the worst of all the benchmarks on the site). It measures nothing but allocation, deallocation and GC speed, which especially in a language such as Nim where value types are are very commo

Nim compiler options for Z80 C compiler?

2022-09-11 Thread doofenstein
> I wouldn't worry about the output size, any decent optimizing compiler should > produce optimal code from Nim output. problem is that said thing doesn't really exist for those 8-bit micros. For once when compilers started to get become acceptabably near handwritten C code those CPUs where alr

How to check whether parseFloat leads to missing precision

2022-07-27 Thread doofenstein
the code shouldn't work, for once if you just strip the decimal point you can get such a big integer value that converted to double it will probably be Inf. Ignoring those cases, I think a decimal number without the decimal point might fit or fit not a double, but then not fit or fit exactly wit

OverflowDefect when executing fibonacci sequence with 'memoization'

2022-07-20 Thread doofenstein
I don't think it really has anything to do with your particular implementation. The fiboncci sequence grows very fast, so naturally at some point values won't fit an int in Nim (which is fixed in size to be equal to the size of a pointer, so likely 64-bit for you) has anymore. When So what are

could not load: lua(|5.1|5.0).dll

2022-06-11 Thread doofenstein
if you're using msys2 you can install the appropriate package (probably ) and you're good to go.

Optimize parsing large file line-by-line

2022-04-18 Thread doofenstein
oh stringifying chrom and checking for that, that's clever!

Optimize parsing large file line-by-line

2022-04-18 Thread doofenstein
import parseutils, tables proc parse_bim(bim: string, chrom: int): Table[string, seq[string]] = var snp: seq[string] = @[] a1: seq[string] = @[] a2: seq[string] = @[] i = 0 while i < bim.len:

System.sink & System.lent

2022-04-07 Thread doofenstein
If you use a template as an inline function you need to be extra careful to avoid double evaluation of parameters. Also there are some situations like with var return parameters where in Nim it's impossible to replicate the exact behaviour of a (inlined) proc with a template until views are stab

how to make a enum with wrapped ordinals

2022-03-25 Thread doofenstein
I don't think there's a function in the standard library for this, how about this: proc incWithWrap[T: enum](v: var T) = if v == high(T): v = low(T) else: inc v Run

Must check to decide whether this current iteration in a loop is the last

2022-02-23 Thread doofenstein
for an arbitrary iterator that's not possible unless you first save the results of every iteration into a seq. Though say if you iterate about a seq, you can do this: for i, item in pairs mySeq: if i == mySeq.len-1: echo "last" Run or if you iterate over

real type of openArray?

2022-01-05 Thread doofenstein
openArray is not a type class, a proc which accepts an openArray (and doesn't have anything else which could make it generic) is not generic. Instead it's a type to which seq and array implicitly convert, the original type is lost, the same way after converting a float to an int you can't recove

rust's dbg! macro equivalent in nim

2021-12-25 Thread doofenstein
I don't think so, though it should be very easy to replicate: import macros macro dbg(val: untyped): untyped = let lineInfo = lineInfo(val) exprStr = repr(val) quote do: let val = `val` echo `lineInfo`, ": ", `exprStr`, " = ", val #

Happy Christmas

2021-12-11 Thread doofenstein
well since I'm a gen-z I can appreciate your christmas wishes and as a sign of decency I'll return them. Judging from your previous comments, I assume you're glad if I add a happy holidays for all the people who don't celebrate christmas hehehe. This thread is going to be locked so fast.

What is 'block' in this code

2021-12-10 Thread doofenstein
seems like you're looking in the wrong place. It looks like you're searching the standard library, if you want to learn about the core language, look into the manual:

Errors with Option[T] on 1.4.8

2021-11-28 Thread doofenstein
this sounds a lot like a compiler bug which has been fixed. As a workaround you can try `self.focused.reset()`.

Evolving the moderation of the Nim communities

2021-11-19 Thread doofenstein
fully equiped with the knowledge that this will only escalate this further, you are aware that this language literally has a literal dictator? Besides I don't get your version of "freedom" (and the usage of boogy words such as "cultural marxism doesn't help with that). Rules which apply to ever

How do I inject a NimNode directly instead of going through a macro or template?

2021-11-11 Thread doofenstein
does a typed/untyped parameter do what you want to do? macro x(val: untyped): untyped = val echo x("hallo") # generates the ast echo "hallo" Run Note that while the type of the parameter is written as untyped/typed it's actually of type NimNode. The dif

[Imageman][nimgl] Loading texture

2021-11-01 Thread doofenstein
vert[vertCount*cfloat.sizeof*2+i*cfloat.sizeof] Run if you index an UncheckedArray, it's indexed per element not per byte, so the multiplications by sizeof(cfloat) should be unnecessary. Otherwise I can't really find anything wrong. If this doesn't fix the problem, I highly r

[Imageman][nimgl] Loading texture

2021-11-01 Thread doofenstein
is this your entire code?

Nested Tables

2021-10-30 Thread doofenstein
the downside to this is that in C++ this code: ++ #include #include int main() { std::map test; test[42]; printf("test %d\n", test.size()); } Run prints 1. Eventhough there's no visible assignment at any point a new tab

Nested Tables

2021-10-30 Thread doofenstein
the problem you're having probably that you're trying to do exactly this in Nim: nested[key1][key2][key3] = [1, 2, 3] Run right? The thing is that if you're writing this: table[key] = value Run you're calling this function:

Nimsuggest issue with the VS Code extension and nim 1.6.0

2021-10-29 Thread doofenstein
you need to specify a project file via the "nim.project" setting.

Setting object value by providing key as string?

2021-09-14 Thread doofenstein
If your string is a compile time constant you're code is from a quick glance only missing one thing. You just need to change the type of field to static[string] and remove the stringification (just field instead of $field). Though if the string is not known at compile time this is not that easy.

The NaN story, short version

2021-09-14 Thread doofenstein
> Also, the whole notion of "Not a Number" feels like some sort of broken > legacy concept. Like you set a variable type as let v: number but the type > system doesn't guarantee that and it also can have a type of "not a number". > It's as strange as if you use let v: string and the v also could

String related Segmentation Faults

2021-07-27 Thread doofenstein
> Every single segmentation fault is essentially triggered in this exact place: > that sounds a lot like a heap corruption. So it's probably either some code wrtinig more into a cstring than

build long strings, speed.

2021-07-27 Thread doofenstein
try proc povVec2*(a:Vec2):string {.inline.}= result = "<" result.addFloat a.x result &= ", " result.addFloat a.y result &= ">" Run This could save atleast a few allocations.

How to return an object of a particular type following a value.

2021-07-06 Thread doofenstein
I would do something like this: type VecLen = enum vecLen2 vecLen3 vecLen4 V*[T] = object case n: VecLen of vecLen2: v2: array[2, T] of vecLen3: v3: array[3, T] of vecLen4: v4: array[4, T] proc my_retu

Use break statement inside of called proc

2021-06-22 Thread doofenstein
you can use an exception to do this: proc foo() = raise newException(CatchableError, "?") try: while true: foo() except: echo "terminated" Run Though without knowing what exactly you want to do, I would rather return a value an

Recursive iterator to unpack arbitrarily nested sequence

2021-06-17 Thread doofenstein
I'm not sure if this is what you're looking for, but I came up with this: import macros macro genIteratorBody(typ: typedesc, source: typed): untyped = var seqType = getType(typ)[1] curIterItem = source curIterBody = newStmtList()

strformat on the fly

2021-06-09 Thread doofenstein
it's not just a matter of security, it's also plain not possible with the way how Nim currently works. Nim is not a scripting language where every variable is just an entry in a hash table. Things like variable names etc. are lost once compiled, it's not possible to look up a variable by it's na

sequtils insert sink problem

2021-06-04 Thread doofenstein
it works fine for me if I add `import sequtils` as the first line.

c2nim -- minor update

2021-05-24 Thread doofenstein
great, I just threw some headers at it and it required significantly less fixup then previously!

How to make Nim more popular

2021-05-12 Thread doofenstein
idk about the spanish Wikipedia, but the german wikipedia has quite strict relevance criteria. E.g. while in the english Wikipedia every minor Star Wars character has it's own article, in german Wikipedia there's only one big characters from the Star Wars universe article.

Sequences, Type Inference, and Inheritance... I am slightly lost.

2021-05-11 Thread doofenstein
`(typ)variable` looks like a C cast, but it's only an expression in braces which evaluates to a function in command syntax (once the braces evaluate it's equivalent to `typ variable`). This matters because the proc call has a different priority compared to C casts. Compare for example cases like

VSCode extension?

2021-05-10 Thread doofenstein
because it's actively being developed and it's written in Nim!

Sequence item del vs. delete?

2021-05-05 Thread doofenstein
it's in the documentation as well. for delete: > Deletes the item at index i by moving all x[i+1..] items by one position. > > > This is an O(n) operation. for del > Deletes the item at index i by moving all x[i+1..] items by one position. > > > This is an O(n) operation. so del is faster, b

What is the correct way of mapping C functions with return type "const char *"?

2021-05-04 Thread doofenstein
I'm not familiar with the API, but the thing with returned const char* values is that you don't own the memory the pointer is pointing to, so it can change the value whenever it wants to in proceeding functions, if it doesn't want to continously leak memory by always returning new memory (it doe

char type: echo ASCII code for 'space' and 'single quote'

2021-04-25 Thread doofenstein
to print the ASCII code you need to convert it to an integer type: import strutils # for toHex echo ord('\'') echo int('\'') echo toHex(ord('\'')) # prints as hexadecimal Run Note that repr is mostly meant for debug purposes, so I wouldn't rely on it to get

XML parsing performance

2021-04-24 Thread doofenstein
what can help as well is putting the code into a function, so that the variables become local instead of global, which gives the compiler more optimisation opportunities, like so (I also changed some stylistic things :D): import streams, parsexml, times proc main() =

Nim convention for multiple imports?

2021-04-17 Thread doofenstein
I love the block syntaxes in Nim, so what I do is this: import first, second, third, a, b, c, d Run Everything is neatly sorted, but there's no visual clutter which would be there if everything was prefixed with an import statement. Usually I

Performance against Python: find substring in string

2021-04-07 Thread doofenstein
stories like this happened a few times like this before in this forum, where someone compared the performance of Python and Nim with string operation. When you're doing string operations in Python the vast majority of work is done by well optimised routines written in C, so the performance will

array sample slower than indexing into rand(size-1)

2021-03-21 Thread doofenstein
opps right I have similar results, for me it's 0.7 and 0.07 I misread the number by one magnitude haha

array sample slower than indexing into rand(size-1)

2021-03-21 Thread doofenstein
I can reproduce the slowness by approximately the same factor. Though when building with lto enabled (--passC:"-flto") sample is for some reason even a bit faster.

relative "based/biased" long pointers and data structures over it

2021-03-03 Thread doofenstein
I see. Hm that complicates things. Idk how practical that would be, but how about something like this: type PMemPtr[T] = distinct int var pmemHeapStart: ByteAddress proc `[]`[T](pmemPtr: PMemPtr[T]) = cast[ptr T](cast[ByteAddress](pmemPtr) + pmemHeapSt

relative "based/biased" long pointers and data structures over it

2021-03-02 Thread doofenstein
I might be wrong but I think you're thinking too complicated 😀 Accessing non traced data is pretty straightforward in Nim and it's done all the time when interacting with external C/C++ code. See: (and especially the foll

Any way to avoid nested case statements for proc taking two variant objects?

2021-02-20 Thread doofenstein
writing a macro to perform this operation would really not be that hard (for reference, this is my macro: it does a bunch of other things related to instruction decoding as well). Though I agree that a

Any way to avoid nested case statements for proc taking two variant objects?

2021-02-20 Thread doofenstein
oh I had a similar problem when decoding powerpc instructions. What I ended up with was a macro which among other things "unrolled" the branches using a table. This would look kind off like this for your example: const offsets: array[Sym, int] = [ord(high(Sym))+1, 0, 0, #[ecetera]#]

generic functions : syntax / deduction / debugging

2021-02-06 Thread doofenstein
the issue is that static[Natural] already is a value not the type of the value: func `*`[ArrSize: static[Natural], T:typedesc]( elems: array[ArrSize, T], times: static[Cnt]): array[Cnt * ArrSize, T] = Run Though there's another issue. Writing typedesc is not the

Morgenstern-ish documentation

2021-01-24 Thread doofenstein
for an automatic translation it's really not bad. I would translate as something like "afterall man is a visual creature — pretty things are what I wish for"

Ignore part of tuple without warnings

2021-01-23 Thread doofenstein
those terms and phrases come all directly from the Nim manual, that's why you probably see them a lot here

Google Summer of Code, Feb 19, 2021

2021-01-16 Thread doofenstein
I think partially what @jasonfi was talking about was about lazily resolved functions like hash and ==. If you're object doesn't define those, only once you use table procs which use those you get an error and also one which seems to come from inside the standard library, instead of your code. T

How to deal with Enums with same names?

2020-12-26 Thread doofenstein
what you often see in Nim code is to prefix enums so that you just don't have two enums with the same name in the same module. If you have two enums from separate modules but with the same name you can distinguish them by the module name. See the Nim style guide for official projects:

collect for seq[set[int8]]

2020-12-10 Thread doofenstein
this works as well: import sugar let s = collect(newSeq): for i in 0..2: set[int8]({}) Run or import sugar let s = collect(newSeq): for i in 0..2: var x: set[int8] # do some kind of operation on x x

pop for a set - is there something prettier?

2020-12-07 Thread doofenstein
on the topic of bit set iteration it's currently very inefficient, because it checks every element instead of using count leading/trailing zeroes.

Alternative term for addr

2020-12-04 Thread doofenstein
`addr` is a reserved keyword in Nim. I know I can just put it in backticks to use it as an identifier or don't use the abbreviation and write address, but that looks rather ugly in my eyes :D. I'm writing an emulator so I deal with variables named like this constantly. For example for type typ

Writing a string into a source file compile time

2020-12-03 Thread doofenstein
you can use a [strdefine](https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compileminustime-define-pragmas): const FirmwarePath {.strdefine.} = "defaultPath.elf" const FirmwareData = staticRead FirmwarePath Run then compile with nim c -d:Firmwa

recursive iterators - is there a recommend workaround?

2020-11-26 Thread doofenstein
Nim "efficiency, expressiveness, and elegance (in that order of priority)." So from that perspective the hard separation into inline and closure iterators makes a lot of sense, as closure iterators are a lot more heavier than inline iterators, it's opt-in.

Set base address of sequence

2020-11-25 Thread doofenstein
seqs are exclusively managed by the Nim runtime, so even if you managed to create a seq with the base pointer to your external memory the runtime could try to free it etc. UncheckedArrays are probably what you're looking for. proc doSomethingWithPtr(x: pointer) = let x = cast

NimSuggest Not Working with Karax's or Jester's Macros

2020-11-22 Thread doofenstein
> Do you know any workaround for that? > >unfortunately no, though it used to > be worse > > Huh, didn't know about nim check. Tried running it on my Jester > files, no errors pop. Great! > >But with Karax files, it's a disaster. > Screens and screens of errors. > >Also, AFAIU nim check can't be

NimSuggest Not Working with Karax's or Jester's Macros

2020-11-22 Thread doofenstein
nimsuggest crashing/getting hung up in an endless loop are things I experienced myself and read other's have experienced as well. And checking for errors via nimsuggest is also not that accurate, which is why often `nim check` is often used for that.

Open-ended slices

2020-11-17 Thread doofenstein
instead of nil you could use something like this: type PositiveInf = object NegativeInf = object proc `..`(a: typedesc[NegativeInf], b: int) = discard proc `..`(a: int, b: typedesc[PositiveInf]) = discard which then can be used like this: 0..Posit

Open-ended slices

2020-11-16 Thread doofenstein
how about `..>=x` for an open range closed to the left?

Kernel Matrix Calculation in Nim

2020-11-11 Thread doofenstein
> For example my SIMD definition for SSE2 and AVX512 mtrix multiplication which > allows me, in thousand of lines of Nim code to be as fast as 50x more pure > assembly lines in OpenBLAS Can you please elaborate on that? I looked into your code and since you're using intrinsics you're dependant

Reference Variable (C++ jargon) - is there such a beast?

2020-11-08 Thread doofenstein
fortunately views can put pointers back to their place. They're only very recently implemented and still experimental and thus this example below (which I think is correct) segfaults at runtime 🙁: {.experimental: "views".} proc test() = var x = 42 y: v

Idiomatic function call coding style?

2020-11-03 Thread doofenstein
the way I usually go about this is: to use dot calls for cases when a function "belongs" to an object (like in the object oriented sense). to use normal calls for cases where all parameters are "equal" (e.g. min(a, b), distance(a, b), intersection(first, second)). Though yeah it all comes down

template expanding to multiple sequence members

2020-10-28 Thread doofenstein
I think that's not possible with Nim's templating system, because a template can only expand into a single NimNode, while this would require expanding into two sibling NimNodes. Idk what you want to archieve, but how about something like this? const lut = static: var result:

design of large modular projects in nim?

2020-10-25 Thread doofenstein
> AFAIK only nim.nvim and nimlsp uses nimsuggest correctly :P I've verified > this fact with the compiler source. what exactly do you mean by that? There isn't much which can be done wrong, except for the one nimsuggest process/per file relict vscode-nim has which doesn't happen if a project fi

design of large modular projects in nim?

2020-10-25 Thread doofenstein
if you're using vscode make sure you specify a project file.

What is the carbon footprint of the NIm?

2020-10-22 Thread doofenstein
wouldn't measuring how much energy a (compiled) program consumes require calculating first how long it executes? I'm not too much into theoretical computer science, but that sounds the halting problem.

Views of a non thread local var

2020-10-19 Thread doofenstein
It's not possible to make a view of a [non thread local variable declared as var](https://nim-lang.github.io/Nim/manual_experimental.html#view-types). So the following code doesn't compile: {.experimental: "views".} var someArray = [0] proc main() = let viewO

Nim's vision

2020-10-16 Thread doofenstein
this has been already discussed a few times, where Nim's place on "the market" is. Nim is often compared to Python (and that's also where some people seem to come from), even though it doesn't have that many similarities besides the syntax. I for example come from C++, so my original reason to p

  1   2   >