overload operator `+=` for private member

2023-11-19 Thread aEverr
add proc m*(o: var Obj): var int = o.m Run

proc/func/method: syntax

2023-11-15 Thread aEverr
for 2: this would then be inconsistent with variable declaration, which I think was the reason the syntax is like this in the first place for 3: I don't think this is important as there are still other syntax elements which make it significantly different from Python

Nim boilerplate

2023-10-11 Thread aEverr
your concepts are wrong, saying that type CircleShape = concept a a.r buildCircleProps(a) Run means that for anything to match CircleShape, it must already have a buildCircleProps defined for it. if you do not want that, you remove the build() lines an

Table lookup problem

2023-07-11 Thread aEverr
bug exists on 1.6.14, but not on devel it seems

macro compile-time comparison with define-pragmas

2023-05-15 Thread aEverr
For getting the source file name

Mr. Rumpf, why didn't you went along with the Python standard library?

2022-12-19 Thread aEverr
because nim is not specifically aimed to be similar to python in every sense

Get time at compile-time

2022-12-07 Thread aEverr
There is which is the time when the compile is initiated.

Ways to tweak the output of the JavaScript backend

2022-10-11 Thread aEverr
For specifically removing the numbers? No, not that I know of

Wierd behaviour with table

2022-05-07 Thread aEverr
you have to also `import tables` inside module b

AI’s opinions on Nim

2022-04-27 Thread aEverr
nlvm confirmed for upstreaming in the future

Compiler ignores my `if` a throws an error

2022-04-17 Thread aEverr
The type of I and the return type MUST be known on compile time. Nonetheless, this can be fixed by replacing the if with a when (converting the run time check into a compile time check)

Hopefully simple Nim syntax question

2022-04-14 Thread aEverr
in the first lastStoneWeight, `proc lastStoneWeight(stones: var Stones): int`, it requires a var. `var stones = weights.mapIt(Stone(weight: it)).toHeapQueue` makes a var or a variable to a mutable value, okay, and you pass it. `result = lastStoneWeight(stones)` but here, `lastStoneWeight(weigh

Simple linked list questions: Correct proc signature for first()

2022-03-17 Thread aEverr
`proc first[T](list: var SomeLinkedList[T]): SomeLinkedNode[T]` also `result = list.head[]` must be `result = list.head`, you musnt dereference it otherwise you get the `Obj` version which isnt the return type you list

best practice or guidelines on using log in a library?

2022-02-07 Thread aEverr
with regards to “convince”, you make a good library and advertise it then people will use it. what’s wrong with manually editing the libraries you need info from? You don’t really have the choice to otherwise I believe

closure and for loop problem

2022-01-16 Thread aEverr
needs closure scope capture

Thoughts on error vs fatal log levels?

2022-01-12 Thread aEverr
If your program has no choice at all but to exit, use fatal If your program can recover in some way from the error, use error

What approach can I use to fix a number of parameters in some functions?

2021-12-19 Thread aEverr
excerpt: using c: Context n: Node counter: int proc foo(c, n) = ... proc bar(c, n, counter) = ... proc baz(c, n) = ... proc mixedMode(c, n; x, y: int) =

Error: identifier expected, but got: paramStr(1)

2021-12-12 Thread aEverr
declared is a compile time construct, paramstr is a runtime construct. declared cannot take information from paramstr

More nim newbie woes, this time echo fmt Possible AOC2021 spoiler

2021-12-08 Thread aEverr
Try updating Nim or using a stable version, it seems like you are using a nightly which may be broken

proc doSomething(msg="", opt=-1)

2021-11-10 Thread aEverr
No, because that would require the lexer to know beforehand about procedures and other context. Also no because that would break older code that might have depended on this, and no, scanning public repositories for use of such does not act as proof, nor does “it makes no sense”

Indentation in Nim

2021-11-05 Thread aEverr
what exactly is your point? you just rebutted both of your options

include std/prelude vs import std/prelude (and other small prelude oddities)

2021-11-05 Thread aEverr
There is no need to special case the module, you can re export modules imported (acting like an include without being an include) but for some reason prelude doesn’t do this

The fate of Nim Editors

2021-10-19 Thread aEverr
usually the completion plugins themselves implement "statistical completion", usually called buffer complete or something like that for vim (at least it was called that in nvim-compe).

Direct I2C device access with pure Nim

2021-09-18 Thread aEverr
You probably need to flush the file before closing though I’m not sure if it is already automatically done if closing

Does Nim have anything equivalent to Ruby's puts, or Python's print, or Perl's say?

2021-08-25 Thread aEverr
Does echo not already put a new line after the string you echo?

A look at Dart's null safety syntax

2021-08-17 Thread aEverr
i believe the "none" and "some" functions are needed because of the type system nim has

Template or macro for heterogeneous tuple expressions?

2021-07-18 Thread aEverr
You can probably use an implicit generic (`tuple` with no generic parameters) and use

documentation for the `do` keyword?

2021-05-26 Thread aEverr
it is found in the experimental manual albeit it being used often tldr do w/o parens is just a code block, do with parens is an anon. procedure let a = do: # or block: 0 let b = do () -> int: # or proc (): int = 0 Run

How to get the compile time as a const string?

2021-05-24 Thread aEverr
There is already a constant with the compile time

Why is there no compile error when accessing uninitialize variable

2021-03-31 Thread aEverr
"uninitialised" variables are actually default(/zero)-initialised if nothing is set, so it's equivalent to `var theValue = default(int)` and so

`sleep_async` behaves as if it's blocking, strange

2021-03-25 Thread aEverr
im getting the expected output with the same code and parameters, more data would be needed to determine what is wrong

Splat operator in Nim?

2021-03-13 Thread aEverr
Your seq is impossible, sequences are single type only

Sorting array by object key

2021-03-08 Thread aEverr
did you export `d`? `d*: OrderedTable[...]` (note the asterisk)

echo doesn't work correctly

2021-02-12 Thread aEverr
echo adds a new line, use stdout.write() instead

Why does JSON serializing a table not work properly?

2020-11-18 Thread aEverr
ah good point, using numbers is valid for js objects but not json i assume.

Why does JSON serializing a table not work properly?

2020-11-18 Thread aEverr
looking at , there is no toJsonHook for Table[int, string]; this means you have to provide one, unfortunately.

Alternative to float

2020-08-30 Thread aEverr
float64 is the equivalent to double in nim if you truly want to avoid float errors, perhaps consider using a decimal library, there should be a few of those on github

How to know where a proc is defined - or: Newbie tries to get used to unqualified imports

2020-08-26 Thread aEverr
hello, you cannot use UFCS with qualified imports which is why it is not recommended echo nimdata.collect(nimdata.fromRange(nimdata.DF, 0, 10)) Run

"||" operator ? : Is there a corresponding operator for iterables ?

2020-07-28 Thread aEverr
Where do you see this || operator? I have never seen such an operator in Nim...