Nim 2 feature request - Custom operators

2022-09-15 Thread elcritch
TIL you can do infix unicode operators! Just one `--experimental:unicodeOperators` away. Then you can define an appropriate unicode operator like say "⊘": proc `⊘`(a, b: int): int = a + b 1 ⊘ 2 Run Though editor support for Julia includes converting pseudo-latex n

Hot reload & Alternatives - Mac Support (ARM and x86)

2022-09-15 Thread geekrelief
You're on the right track. As @carterza says doing it with dynlib is doable, I created a hot reloading system for gdnim, a fork of godot-nim. Don't use nimble as a build system, it wasn't designed for that. For gdnim and NimForUE we have a custom build script. For NimForUE we build a host and gu

Custom macro inserts macro help

2022-09-15 Thread Hlaaftana
If you do `echo val.treeRepr` instead of `repr`, you get the output ProcDef Ident "f" Empty Empty FormalParams Empty IdentDefs Ident "x" Ident "int" Empty Pragma Pragma ExprColonExpr

Nim 2 feature request - Custom operators

2022-09-15 Thread Hlaaftana
The problem is backticks mean "turn operators into identifiers" not "turn identifiers into operators" in Nim, unlike Haskell. The operator behavior is tied to the parser so it is nontrivial, occasionally impossible to make operator behavior depend on things that use semantic checking, which hap

Enum union type and "Kind" pattern in recursive types

2022-09-15 Thread Hlaaftana
> Was wandering if nim has the same limitation (as the size of the node must be > known at compile time) This isn't true, you can just set the type size to the maximum of all the branch sizes. I can only think of black magic ways to truly implement this and even then there are problems like ge

How would i safely turn a image from a url to a uri.

2022-09-15 Thread Nlits
I tried some things and the image never renders. It works when I save the data directly. Current code: let host = parseUri(url) var client = newHttpClient() client.headers = newHttpHeaders({"Referer": $host}) let rq = client.get(url) var m = newMimetypes() let su

Custom macro inserts macro help

2022-09-15 Thread CircArgs
I'm trying to learn macros and am playing with `fusion/matching` too. Here, I've attempted to basically create a macro that stupidly inserts an exising pragma: import macros, options, strformat import fusion/matching macro exportc_pragma(prefix: string, val: untyped): u

Any way to prevent GC from collecting some values?

2022-09-15 Thread morturo
Thanks man, that's what I need.

Hot reload & Alternatives - Mac Support (ARM and x86)

2022-09-15 Thread carterza
Previous iteration of my engine did this - It's totally doable with `std/dynlib`. If you're compiling to C++, expect a more difficult time.

Nim 2 feature request - Custom operators

2022-09-15 Thread Tuatarian
I've run into times where a proc is most naturally expressed as an operator, for example, something like a signed modulus, or checking if a point is in a polygon defined by an array of points (as opposed to checking if the point is in that array). I know there's ways around most of these issues,

Nim 2 feature request - Custom operators

2022-09-15 Thread haxscramper
this has already been considered and rejected

Enum union type and "Kind" pattern in recursive types

2022-09-15 Thread elcritch
You might be able to do this with concepts. They let you add arbitrary constraints to a generic type. I’m not sure if it’d work while still resolving to the base Node type for storage.

Any way to prevent GC from collecting some values?

2022-09-15 Thread elcritch
You can call GC_ref/GC_unref on it to manually bump it. However it’d probably be better to put it in a global table or array for later access. That’ll keep it from being lost by accident and leading to memory leaks.

Any way to prevent GC from collecting some values?

2022-09-15 Thread morturo
I need to pass some data to an external env as a pointer and use this pointer later, but GC will collect this value since there is no ref.

Dr. Chaos released!

2022-09-15 Thread carterza
I feel like there was a huge missed opportunity here to name this Professor Chaos.

Hot reload & Alternatives - Mac Support (ARM and x86)

2022-09-15 Thread turmoil
This is for the development process, aiming to obtain an interactive experience. This would not be there for production. I may want to do something similar with a plugin system, if that's possible, though I'm not planning to implement that. At the moment the only way I can see how to do the abo

Show Nim: New Pixie 5.0 release with significant performance improvements

2022-09-15 Thread pietroppeter
> A slightly different approach? from what I understand from [this chapter](https://github.com/treeform/pixiebook/blob/master/context.md) of the new pixiebook linked above (very nice!), the context based api is for people familiar with JS Canvas or Cairo, but everything (and possibly more) shou

Enum union type and "Kind" pattern in recursive types

2022-09-15 Thread axyz
hi, I have a question about usage of enums to model a tree structure (e.g. AST). type NodeKind* = enum Sheet, Comment, Rule, AtRule, Decl Node* = ref NodeObj NodeObj* {.acyclic.} = object case kind*: NodeKind

NimConf 2022 - registrations

2022-09-15 Thread miran
Just a reminder that the deadline for submitting the title of your talk is **this Sunday** (September 18th).