Can I add Procs to Enums in Nim like in Python or Rust?

2023-03-04 Thread z_____________
Enums are just like any other type. You can "attach" procs to them like you can any other type. Here's the equivalent of that Python enum code: import std/strformat type Mood = enum Funky = 1 Happy = 3 func describe(mood: Mood): (string, int)

Can I add Procs to Enums in Nim like in Python or Rust?

2023-03-04 Thread amadan
Declaring it outside the type is what you would do. I'm a bit uncertain what you are looking for, but this kinda translates the two kinds of calls you have in the python example type Colour = enum Red Green Blue proc someColour(x: Colour) =

Can I add Procs to Enums in Nim like in Python or Rust?

2023-03-04 Thread Lite3000
Here is Python syntax for adding methods to Enums in Python. Declaring enumerations in Python is like declaring a class, but that class automatically has type checking as well as other features, which reduces the complexity of the code: The Rust language can also attach functions to enums throu

Nim enters top 50 programming languages list on TIOBE Index!

2023-03-04 Thread olmikul
Nim is back to the top 100. Even before stable 2.0 release ;)

RST in nim.

2023-03-04 Thread Nlits
More broken RST: ReStructuredText (rst): plain text markup hello world Run When I use it somehow turns into: > Hello world Can someone please tell me how to conf

QRgen - A QR generation library fully written in nim

2023-03-04 Thread yeabsira
this is so cool, who did this?? am going to use it for my project thanks keep it up

NimForUE

2023-03-04 Thread jmgomez
A few things have happened since the last update: * Virtual functions implemented: This is how a uClass looks like now, you can mix ufuncs, nim funcs and virtual funcs. It's the override block. For const there is a pragma that allows you to specify them uClass ANimCharacter of

How to chain anonymous proc with UFCS?

2023-03-04 Thread konradmb
Thank you very much for this solution. Nim forum really needs e-mail reminders for responses. I've found about your answer only by casually looking at threads in my profile.

Nim in production: 350+ HTTP requests per second on a very modest VM

2023-03-04 Thread jasonprogrammer
I pushed my progress on the static file and routing changes to [a GitHub repo](https://github.com/jasonprogrammer/meira), in case anyone would like to contribute.

Make nimble task depend on "build"

2023-03-04 Thread elcritch
> Nice to know. And thanks for pointing out staticExec! Glad to help! > You are right. And if a need arise I can always use Nix which I'm already > using to prepare my project specific devenvs with Nim and > gcc--none- toolchains and other tools. Nice! I've tried Nix but just can't seem to qui

Ants: YAML inspired configuration using Nimscript / Nim

2023-03-04 Thread elcritch
Sometimes you're just curious how far you can push an idea. So I kept tweaking until I was able to make an `ants` file which is also syntactically correct YAML! Behold: #? replace(sub = "!", by = "") | replace(sub = "#.. ", by = "") #.. import ants/language_v1, cimport_options

nimqt - bindings to Qt

2023-03-04 Thread grd
And then it went silent... But I have a question: Can you give me a status about QML? Are you planning of integrating `nimqt` with QML?

Make nimble task depend on "build"

2023-03-04 Thread WizardUli
> Note that calling "nimble build" or more directly "nim c" will only rebuild > files when they change. Nice to know. And thanks for pointing out `staticExec`! > Eh no need for all that complexity. You are right. And if a need arise I can always use Nix which I'm already using to prepare my pr

import module just for comptime use

2023-03-04 Thread PMunch
Yes, this issue is very annoying. Especially for modules like OS which explicitly throws an error.. I made an dssue about it here, but alas nothing has come of it so far