NIR

2023-11-03 Thread lxdong
Will mixed code with c++ interpretation slow down compilation time as well?

Array of type "proc" except I don't know what I'm doing

2023-11-03 Thread stoneface86
In your example, a_echo can be a regular proc definition. What you are doing is assigning an immutable variable a_echo to an anonymous procedure, which is of type Action. You could also use `fill` from `std/algorithm` for initializing the actions array instead of doing a plain for loop

NIR

2023-11-03 Thread Araq
I've found the lack of support for calling conventions a showstopper but since it mostly affects Win32, I might have been overly critical. That said, feel free to take my code and work on it but I won't.

Learning Nim - some problems with nested template / macro / generic code

2023-11-03 Thread janAkali
With this little change your second code example compiles and runs fine: import times template time(runs: int, code: untyped): void = Run [typed vs untyped parameters](https://nim-lang.org/docs/manual.html#templates-typed-vs-untyped-parameters)

Decimal operation

2023-11-03 Thread janAkali
1. I'm not an expert in nim-decimal, but apparently it's the default way. But you can always make a 'round' procedure (by wrapping 'quantize') if you're more comfortable with it. 2. It can't be pure because +, - , etc.. operators defined by nim-decimal rely on global decimal context (`Hint:

Array of type "proc" except I don't know what I'm doing

2023-11-03 Thread nimling
Just getting into Nim and coming from non-statically typed languages :) Thanks in advance for any advice! I wanted to pack some **proc** into an array (so they're indexable by an integer) and this is what I came up with which did actually work. I would like to do it the proper "Nim" way though.

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread sls1005
> I don't know what that means, or why it appears since I've declared unused > variables with no issues in the past. It means that you have to either assign it to a variable or to `discard` it explicitly or to mark the `proc` as `{.discardable.}`. However, your current implementation doesn't ac

My experiences with Nim

2023-11-03 Thread alexeypetrushin
> What I ended up with was just using include to merge all my tests together in > one file and executing that. A macro generates the include statements so I do > not have to update my tests/all.nim file. I do the same, or even write small tests in the same file as the code. All you need is to d

Decimal operation

2023-11-03 Thread nelsonqt
Nice - thanks for that

Figuro updates: Scrollpane and more

2023-11-03 Thread elcritch
Figuro now has a scrollpane along with vertical and horizontal layouts! Example: Scrolling is implemented as a regular widget and is much cleaner way than in Fidgetty. It was pretty straightforward to make. However, it required fixing a bunch of bugs in CSSGrid and the Figuro layout engine. An

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread Col
Fully agree but nor is there anything that differentiates it enough for a developer to say "Yes it's worth my time learning (on top of all the other languages learned over the years)." For my personal situation if I can present that we can be as productive as we are with Java but reduce cloud se

NIR

2023-11-03 Thread giaco
not sure which one, but whatever has the potential to improve tooling. I'd guess IC.

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread giaco
while I can understand how good Nim is good as-is, I also can share the experience of a couple of expert programmers dropping it in a day just for seeing it "brittle" IDE/debugging side "which reflects overall language potential" according to their personal opinion (that I don't share).

NIR

2023-11-03 Thread ASVI
Jit compilation for nim VM (as an example via libgccjit, initial support for which is implemented in this commit: ). Jit can be used as {.vmhook.} (vmjit

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread ImmortalWombat
There might be nothing wrong with Nim, like with D. Remember that there is also more competition than ever.

Decimal operation

2023-11-03 Thread ElegantBeef
Everything else but point 4 is beyond me... but if you want to make it a bit nicer you can define your own literal: import decimal proc `'dec`(s: string): DecimalType = newDecimal(s) echo 1e4'dec Run

Decimal operation

2023-11-03 Thread nelsonqt
Hi I've been learning nim and playing around with decimal from : I'm written some sample code below to calulate a finance thing called weighted average cost of capital. In the example below I wanted to round decimal to 0.733 and then convert that to

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread Charles
That's a syntax error, it doesn't tell you anything about what's returned, and ints don't implement __iadd__.

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread xigoi
How have you checked? ❯ py >>> a = 0 >>> b = (a += 1) File "", line 1 b = (a += 1) ^^ SyntaxError: invalid syntax Run

Learning Nim - some problems with nested template / macro / generic code

2023-11-03 Thread icebergg
I'm checking out Nim, have read most of the manual - there are a lot of things I like! I'm however having problems with nested template / macro / generic code, which I do not know why it doesn't work: import iterrr proc testIterrr() = let m = @[1, 2, 3].items.iterrr

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread xigoi
Nim is too different from C (particularly in terms of syntax) and many programmers seem to be under the impression that C = good, different from C = bad.

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread Charles
Oh I see, I understand better, it applies to all functions with a return value.

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread Charles
It does, although it also does the operation in place. I checked before writing it to be sure I wasn't misremembering. >From the docs: These methods are called to implement the augmented arithmetic >assignments (+=, -=, *=, @=, /=, //=, %=, **=, <<=, >>=, &=, ^=, |=). These >methods should atte

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread Isofruit
Yeah but that's the mistake, you **don 't** want it to return anything. `+=` is an operator that merges the right-hand value into the left-hand value. There is no third value being created, just 2 values being merged. Which means instead of returning, your first value should be mutable so you ca

My experiences with Nim

2023-11-03 Thread juancarlospaco
For that code size, just use `runnableExamples`.

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread Araq
In Python `+=` doesn't return anything either.

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread Charles
Oh I see, I expected all operators to return the result like they do in python. Thank you for the help, it works now!

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread Isofruit
You made a small mistake in your first `+=` proc. What you _want_ to do in a proc such as that is _mutate_ the existing input, not produce an output. You want to change the existing `VGALine` in `a` (and by extension: `line`) instead of making an entirely new one, right? You did the opposite an

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread Isofruit
Note the error is basically something you'd encounter here as well: proc x(): int = echo "Something" return 5 x() Run This will not compile because nim will throw the same error as you got. The reasoning is: If you call a proc that returns an outp

Error: expression 'x' is of type 'y' and has to be used (or discarded)

2023-11-03 Thread Charles
Hello, I'm trying to create range types with redefined operators but encountering some issues. My program writes characters to a VGA buffer that has 80 columns and 25 lines. I figured I'd write range types for the columns and lines which I named VGACursor and VGALine respectively, and redefine

My experiences with Nim

2023-11-03 Thread Isofruit
As somebody who tests their packages with both std/unittest (for snorlogue, nimword and tinypool) and testament I agree that some TLC is needed, mostly on the docs front for testament in my eyes. However, I'd note that the docs are present and understandable and I'm saying my statement more in

Best way to architect a Nim dll/so that is used by other Nim dll/so/executables

2023-11-03 Thread bbbscarter
In case it's helpful to someone else in the future, I ended up doing what @Demos suggested. It's a little hacked together, but seems to be working; I might put it into a proper shareable module at some point. Essentially you use `{.lib_api.}`: * On procedures, it generates a forward declarati

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread treeform
Getting to the top programming languages is somewhat random and often more an accident of history than a result of merit. That's why merely fixing a feature or any other single action will not suffice. Nim needs luck... and a killer library! Most languages reached the top not on merit: * C -

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread talavera
Nothing, Nada, Us?

My experiences with Nim

2023-11-03 Thread SuaveSteve
Hello, my Nimian Simians. I would like to share with all of you my thoughts ever since I started using Nim. First, some background. Python is my bread and butter but I have been itching to learn something else and more rigorous. So far, Nim has attracted me the most. After going through the tu

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread Lantos
I don't want nim to become mainstream, It's our little secret. 😄

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread bsljth
If there is one language that could effectively (and efficiently) replace JavaScript is Nim. I know, a hot take. Yet, think about it. Nim officially had the motto of being the "one language to rule them all" (though @Araq later rephrased it into: "good for everything language"). Isn't that wh

NIR

2023-11-03 Thread didlybom
I didn't explain why I voted for REPL first. The 4 options are very cool (and I would _[love](https://forum.nim-lang.org/postActivity.xml#love) to get IC sooner rather than later) but I think that out of all the options a REPL is the one that: 1. Would benefits newcomers to the language the m

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread haxscramper
Feature-wise, the main questions I see are: what our VS code extension story? Do we have LSP to go after top 4-5 most used generic editors, extensions for them? Like VSCode, Vim, Emacs. Writing our own IDE is an insane waste of time and effort. Moving next, package manager story? The 2.0 release

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-03 Thread haxscramper
The main issue with this sort of question, imo, is they are based on the assumption that fixing some specific technical problem will make people use this particular language. Work on moving their codebase, learning new technology, tooling, quirks and pitfalls. You need to know who you are selli