Why is docgen not producing the 'dochack.js' file? Nim v1.6.8-2.0.2

2024-03-23 Thread amadan
Currently it only copies the dochack file [when the index is built](https://github.com/nim-lang/Nim/blob/devel/compiler/docgen.nim#L1801) (i.e. having `--project` or `--buildIndex`). Honestly should probably generate it every time since it is used for more than searching now

gc/malebolgia bug?

2024-03-12 Thread amadan
You can also use [cursor pragma](https://nim-lang.org/docs/destructors.html#the-cursor-pragma) inside the function so that it doesn't mess with the ref counts let svec {.cursor.} = svec[] Run

Set JS as backend for nimsuggest/nimlangserver

2024-02-12 Thread amadan
You can create a `config.nims` file and then write in it switch("b", "js") Run So that JS is set as the backend for the project

LLdb: Is there an .lldbinit file available for Nim's own types?

2024-02-06 Thread amadan
There is this python script that is included which iirc sets up pretty printers for most types Sadly I've never used lldb so don't know how to use it

`nph` opinionated formatter v0.4

2024-02-05 Thread amadan
When talking about doc conventions do you mean like javadoc style documentation for properties?

Feedback on site: Scroll to Top or Update Design for Docs

2024-01-29 Thread amadan
In devel the results are positioned so they are always visible (e.g. search for something here ) Although imo the current floating design doesn't look good. @georgelemon you can create a `nimdoc.cfg` file and override the [doc.fil

Is there a more elegant approach

2023-12-31 Thread amadan
One way I can think of is using [max](https://nim-lang.org/docs/system.html#max-procs-all) type PageNo = 1 .. 100 var a: PageNo = 1 a = max(PageNo.low, a - 1) a = max(PageNo.low, a - 1) echo a Run

Escape characters for fmt

2023-12-20 Thread amadan
Would the better design be implemented in the compiler or still be implemented as a macro?

How to await a list of async procedures

2023-12-18 Thread amadan
You can add all the futures to a sequence and then call [all](https://nim-lang.org/docs/asyncfutures.html#all%2Cvarargs%5BFuture%5BT%5D%5D) on it like var futs: seq[Future[Something]] for sitemapIndexEntry in getSitemapIndexEntries(sitemapContent): futs &= getEntries(s

Hello `nph`, an opinionated source code formatter for Nim

2023-12-10 Thread amadan
Very cool! Would auto variable renaming like what [nimfmt](https://github.com/FedericoCeratto/nimfmt) has be considered semantic refactoring? Think a feature like that would stop people complaining about style insensitivity and also allow quick fixing of `StyleCheck` hints

Github action to build documentation

2023-11-09 Thread amadan
Very possible and something I want to do. My two current ideas are * Using action cache: This is the least hacky method, but since the archives expire it means you'd need to do a full documentation rebuild if you come back to a project after a while. * Store a compressed version of the site

Github action to build documentation

2023-11-08 Thread amadan
I made a Github action to make all my docs building be done in CI and thought I'd share it in case anyone is interested Can be added to an existing workflow by adding this step (Full working example is in the repo's readme) - name:

Why does ref object have this behaviour?

2023-08-08 Thread amadan
One thing to note is that you are echoing the address of the variable, not the actual address you are pointing to (this is why the address in the proc stays the same) If you just do `cast[int](yourVar)` then you'll see the addresses line up

Please help me with httpclient on Nim

2023-07-18 Thread amadan
If you have already parsed the URL using [parseUri](https://nim-lang.org/docs/uri.html#parseUri%2Cstring) then you can also use the [?](https://nim-lang.org/docs/uri.html#%3F%2CUri%2CopenArray%5B%5D) operator on it like let client = newHttpClient() let route = "https://httpbin

W3C Compliant HTML Parser to replace current std/htmlparser

2023-07-07 Thread amadan
@nrk linked their parser which is HTML compliant If it could be broken out into its own library then it would be really handy

Best Web Framework Features?

2023-05-22 Thread amadan
One thing I like in frameworks is being able to make it handle getting all the values from the request that I need without me needing to handle things like the value missing. e.g. I can annotate a route in some way that it is expecting a header with the name "Foo" and it will throw a 400 if its

Scan syntax tree for procedure calls

2023-04-12 Thread amadan
One thing to note about using effects though is that it only tells you that a write or read _might_ be called proc read(): string {.tag: [Read].} proc somethingElse() = # This has the Read tag, but read() is never actually called if 2 + 2 == 5: read()

Scan syntax tree for procedure calls

2023-04-08 Thread amadan
Probably best to go with 1 since it is the clearest. But I wondered if it could be done with effects and seems it can be done import std/[tables, typetraits, genasts, macros, effecttraits] type ReadsDB = object of RootEffect WritesDB = object of RootEffect

Cheerp 3.0? C++ to WASM compiler

2023-03-15 Thread amadan
Shouldn't using the [codegenDecl](https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-codegendecl-pragma) pragma work for making a function `[[cheerp::genericjs]]`?

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) =

anonymous records / subtyping ?

2023-02-28 Thread amadan
tuples can also be named let x = (id: 20, lastname: "something") echo x.id # Echo 20 echo x.lastname # Echo "something" Run But like Araq said, if you know what the data is like ahead of time then using objects is likely better

anonymous records / subtyping ?

2023-02-28 Thread amadan
Think you might be looking for [tuples](https://nim-lang.org/docs/manual.html#types-tuples-and-object-types) let x = (20, "something") echo x[0] # Echo 20 echo x[1] # Echo "something" Run

Proc type won't match despite identical signatures

2023-02-26 Thread amadan
If I make the signatures really precise then it matches. Is there a reason you need to use `is`? It still matches fine even without the added pragmas import std/tables import karax/[karaxdsl, kbase, vdom] type Context = ref object of RootObj urlPa

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

2023-02-17 Thread amadan
Really cool to see (impressive) real world numbers from a framework! Have you tried running any stress tests to see what the max performance from the single server is?

Nim version 2.0 RC1

2022-12-21 Thread amadan
when (NimMajor, NimMinor) >= (1, 9): # New stuff Run Then you can put anything for devel + 2.0 in that block

`cast` broken?

2022-11-25 Thread amadan
Issue is the size of the datatypes is different. An int in Nim is 64 bits while a c int is 32 bits (on my system, your mileage may vary). If you instead cast to `cint` then it works since you'll be casting to the same size as the integer that you emitted

How to create a mutable object prefrably without ref

2022-11-24 Thread amadan
You can make the parameter in the function be bar type MyObj = object prop: string proc doitWithObj(myObj: var MyObj) = myObj.prop = "hallo" var x: MyObj x = MyObj() x.prop = "bon jour" echo x.prop doitWithObj((x) e

Nimble on Termux uses invalid temp folder

2022-11-16 Thread amadan
While looking at the docs it seems you can also use `--define:tempDir:/some/temp/path/` when compiling nimble so use a different temp dir

Nimble on Termux uses invalid temp folder

2022-11-15 Thread amadan
You can probably just clone the repo or use it has a submodule and then add it with --path when compiling But best to use the termux package since it has fixes for this unless you specifically need devel. If not then you can apply this patch file before building devel

Native compile option?

2022-08-12 Thread amadan
You can use `--passC` for that which passing arguments to the c compiler e.g. `nim c --passC="-march=native -O3"`