How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
so tl;dr suggestion would be to throw out all the cruft in the docgen and make it collect list of modules, write it out in JSON format and call it a day. Or do this for one module, in this case the user can write out a collection of `module3.json` and `module4.json` files like the original post

How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
nim doc and nim jsondoc at the moment seem to have duplicate logic for the implementation, `nimdoc.genJsonItem` and `nimdoc.genItem` do both write out result formats right away -- in JSON case it is code like let paramName = $n[paramsPos][paramIdx][identIdx]

How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
Note the specific examples in the docgen code above are merely to illustrate the point; the `DocModule` example on the comment earlier is a starting point, there are of course some additions possible and so on.

How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
I checked the current nim jsondoc output and it seems there is some terminology difference, because for type Enum* = enum value1 value2 value3 ## Some value Object* = object field1: int ## Documentation field2*: Enum

How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
I was talking about having some structure similar to the code below, where you construct the data that actually makes sense as a representation of the documentation format, and then you write it out in JSON form. Then, anyone is free to take the `doc_ir.nim` file and implement the rendering tool

How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
If runnable examples and other things are not important the simpler set of targets would still include the result JSON shema and a way for other tools to make sense of it. Some cleanup elements can still be omitted, like runnable examples triggered directly during doc generation, but in terms of

How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
Yes, but what format of the JSON should be, how it would integrate runnable examples, at what stage you think is appropriate to resolve links to other pages (iirc nim doc supports this now, but I'm not sure), how to organize the resulting JSON so extra tools can work with this without having to

How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
Since haxdoc was implemented I got some ideas about more lightweight approach to how things could be done, but the main objective is to get the data format right, this is a purely data transform issue. So the actionable steps I suggest would be to define a sensible data format, see how much wor

How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
RST parsing to the JSON format is something that can be done in a second part of the documentation generation. I think the best approach would be to split documentation processing into several phases: 1. Collect semantic information from the module, IR stores structure of types, names and so

How to correctly use nim doc when a project has unimported modules

2023-12-18 Thread haxscramper
But once there is a separate stage design like this it is possible to twist and turn it as needed, like integrating test runs into the nim doc (virtually no different with runnable examples yet overlooked), ingesting readme files from directories for more docs, operating on documentation in term

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

Why operator template doesn't work?

2023-05-05 Thread haxscramper
Because you defined < as a binary operator and you must call it as such, so a

Do you miss these compact syntaxes?

2023-03-18 Thread haxscramper
`fmt` can be replaced with `&` which makes is a single-char addition. Also stdlib has other formatting syntwxes which are pretty useful as well, like % from strutils, so forcing a single interpolation style in order to save one character of typing does not seem that useful

RST in nim.

2023-03-02 Thread haxscramper
Supported languages

A serious documentation for Nim

2022-12-31 Thread haxscramper
There is a pretty comprehensive tutorial for nim that is aimed st beginners, that is sadly missing from the official link list.

A serious documentation for Nim

2022-12-31 Thread haxscramper
Another thing that might happen is that large number of people who will be happy about new documentation. Also, archnim2 might provide their own improvements as well, increasing the overall quality of the docs.

A serious documentation for Nim

2022-12-31 Thread haxscramper
Yes, that is a good example because it is a lot more actionable. I did a search and apparently there are no open issues related to documentation content + Doing a quick search on google turns up a pa

A serious documentation for Nim

2022-12-31 Thread haxscramper
> Few days ago, I opened a thread, on this forum just to ask about a detail in > std/logging, because there was no explanation about it in the docs. This one Can > There is the logrotate tool on many *nix systems and i think the > RollingFIleLogger is

A serious documentation for Nim

2022-12-31 Thread haxscramper
Nim-lang conducts a yearly community survey with results available on the blog. [2021](https://nim-lang.org/blog/2022/01/14/community-survey-results-2021.html), [2020](https://nim-lang.org/blog/2021/01/20/community-survey-results-2020.html), [2019](https://nim-lang.org/blog/2020/02/18/communit

A serious documentation for Nim

2022-12-31 Thread haxscramper
See threads from 2019 and 2022

A serious documentation for Nim

2022-12-31 Thread haxscramper
> we should create a documentation committee with a dedicated forum of > discussion space Maybe instead start with figuring out what is wrong _exactly_? You say "documentation is hard". This is a general, non-actionable statement. If you said "module X has no examples for action Y" this would'v

Update on strict funcs

2022-12-12 Thread haxscramper
So effectively this change will cause the following changes to the experimental strict funcs: func a(x: var int) = discard func b() = var x = 1 var p = addr x a(x) # OK a(p[]) # FAIL, was OK before Run

Plans for improving tagged enum (ADT) syntax?

2022-11-27 Thread haxscramper
It might sound shocking, but I think in indicates that code is more often written to _do_ something than to store some data. # ❯ rg -g "*.nim" "^proc" | wc -l >>> 421213 # ❯ rg -g "*.nim" "^type" | wc -l >>> 52912 # ❯ rg -g "*.nim" "= object" | wc -l >>> 34198 # ❯ rg -g "

Looping Assertions

2022-11-01 Thread haxscramper
> But it'll then perform a bound check at the beginning of each loop, and a > overflow check at each end, which is no more efficient than assertions, and > still needed to be turned off. Bound checking and most assertions are turned off in release mode

Looping Assertions

2022-11-01 Thread haxscramper
> But it'll then perform a bound check at the beginning of each loop, and a > overflow check at each end, which is no more efficient than assertions, and > still needed to be turned off. Bound checking and most assertions are turned off in release mode

Looping Assertions

2022-11-01 Thread haxscramper
Seq with unchangeable length can be implemented as `type FixedSeq[T] = distinct seq[T]` with only certain overloads allowed, like `[]=` but not `add`

Looping Assertions

2022-10-31 Thread haxscramper
Iterate over the loop using indices instead of an iterator. And assertions are not "insered at the end of the loop" they are part of `items` iterator.

Nim 2 feature request - Custom operators

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

Nim v2: what would you change?

2022-08-11 Thread haxscramper
There is a built-in language feature called "stropping" that allows you to use any keywords as a regular identifiers

Mastering Nim: A complete guide to the programming language

2022-06-23 Thread haxscramper
> Part II: Nim language specification. I think a lot of people would be interested in actually _using this section as a reference_ (which might include searching for certain things) when needed, as opposed to the reading it once or twice.

Why I left the Nim community

2022-05-11 Thread haxscramper
Yes, most refactoring problems about compiler-related development. Minor cleanups in the standard library are of course a lot easier on the new contributors, and improve the "sustainability" part of the question. V2 thread talked a lot about new features of the _language_ , and those are relate

Why I left the Nim community

2022-05-11 Thread haxscramper
Replying to the [comment](https://forum.nim-lang.org/t/9132#59956) of @dom96 (and several previous comments from the same thread) in this thread as it already brought up the topic of "refactoring" on numerous occasions and @dom96 has indicated that it is an off-topic for "Nim v2: what would you

Nim v2: what would you change?

2022-05-11 Thread haxscramper
We have a ongoing discussion about that very topic on the adjacent thread, so I [replied](https://forum.nim-lang.org/t/9145#59958) there. Sorry for hijacking this one. Also replied to @ggibson

Nim v2: what would you change?

2022-05-11 Thread haxscramper
Nimble directory (just like playground) is not exactly official project, and nobody on the core developer team has a clear responsibility over them

Why I left the Nim community

2022-05-09 Thread haxscramper
Forgot to clarify (and can't edit comment anymore because apparently two hours is "post is too old"), but high-level overview of the compiler, data flow between subsections, logic behind certain edits and conditionals usually remains a mystery, and that's what makes understanding of the compiler

Why I left the Nim community

2022-05-09 Thread haxscramper
> Then follow that up with split forums. One for "Nim" and a less-pretty one > for "Nim compiler internals". There is an `#internals` channel on discord that is supposed to be used to ask about compiler questions. With certain amount of luck one might get a somewhat useful answer that would hel

Why I left the Nim community

2022-05-08 Thread haxscramper
Not "every" developer "will eventually run into exhaustion", and I doubt most people consider reasons you outlined as a major issue. For example, I'm having troubles understanding why do you think this trumps other reasons.

Want Nim online code playground to be mobile and desktop friendly.

2022-03-09 Thread haxscramper
Wandbox () also supports nim compiler, although it does not have the latest version of it. Aside from that, it has several advantages compared to the nim playground * Ability to pass compilation flags, and arguments to the compiled program * Support for multiple files

Variable compile-time import paths

2022-01-31 Thread haxscramper
when : import the/module else: import other/module Run

Nim 2.0 and backwards compatibility

2022-01-26 Thread haxscramper
> Will all those community packages stop working when nim 2.0 comes along Unlikely, except in cases where they depend on the explicitly deprecated functionality. Nim 2.0 will mostly focus on the things described in the roadmap > Or perhaps there wil

Preview of coming attractions?

2021-12-01 Thread haxscramper
Maybe it makes sense to just admit fusion has absolutely no maintainers, and find someone who is willing to do the job? Think about enabling people to do the work for you instead of singling out me just because I happened to raise the problem. "you have to be patient" \- yes, and everyone using

Preview of coming attractions?

2021-12-01 Thread haxscramper
Main point was - two weeks after fusion is still not tagged and still breaks the code on 1.6, but since it is "not part of the plan" I guess this can be ignored.

Preview of coming attractions?

2021-12-01 Thread haxscramper
I think I forgot to mention that `import fusion/btreetables` fails to compile on the 1.6 with `Error: undeclared identifier: ''` also because fusion is not properly tagged.

Preview of coming attractions?

2021-12-01 Thread haxscramper
Almost two weeks later, fusion is not tagged (surely it was hard to do), released roadmap does not even mention it, nimble is briefly described as "We hope to be able to ship a new Nimble with the 2.0 release but we are happy to ship it whenever it's ready." So I think that > I'm really sorry

importcpp constructor issue

2021-11-27 Thread haxscramper
And in general I would probably wrap things using dynamic linker and not `dynlib`, especially when it comes to the C++, because it is not really clear what it does in this case. dynlib might seem simpler to use though, since for dynamic linker you would also need to configure the `LIBRARY_PATH`

importcpp constructor issue

2021-11-27 Thread haxscramper
I haven't fully reproduced your error, but I've faced with similar problems in the \- that is, I need to somehow link with the C++ library. From what I can understand, `dynlib` does not properly support C++ name mangling, or it does so in some weird mann

Preview of coming attractions?

2021-11-18 Thread haxscramper
Making it a multitude of packages instead of one single package addresses none of the concerns I expressed above. It is just shuffling responsibility around, and further separating the efforts. `nim-lang/pattern-matching` \- It seems like my last idea was close enough > Or I were supposed to so

Preview of coming attractions?

2021-11-18 Thread haxscramper
With each step we are getting farther and farther away from my original goal - not in the stdlib because we should use "upcoming" let expressions (where is a roadmap). Not in the fusion because maintainer's incentive slowly withered away in complete silence. Now the solution is to make it a coll

Preview of coming attractions?

2021-11-18 Thread haxscramper
> I'm really sorry for your bad experience and I hope you'll come back. Sorry, but no, I sort of made up my mind before hitting the "Reply" on the first comment, since it was not a trivial decision for me, I really don't like to burn the bridges. Followed discussion just made it clear I no long

Preview of coming attractions?

2021-11-18 Thread haxscramper
**NO** , the proper solution is not to give me "more rights" \- have you even read what I said about fusion? > Half a month forward, zero reaction. Is fusion a part of the current nim > effort, or is it not - I don't know. Each time it was a waiting game, or I > had to personally come and push

Preview of coming attractions?

2021-11-18 Thread haxscramper
By the way, speaking of roadmap and project management - nimble "development has been outsourced, wasn't ready for 1.6.0 and I don't know the plan either" \- this happened moths after long discussion about added nimble features, subsequent

Readability problems

2021-11-14 Thread haxscramper
Well, it is a domain-specific language for parsing text, so if you are _not_ familiar with the subject it will look unreadable, but at the same time it is still much easier to write and maintain compared to dozens of handwritten loops, checks and conditions like `if str[idx] == '='`.

How to pass a "plain type" to a proc that expects a "ref type" in Nim ?

2021-10-27 Thread haxscramper
`ref object` and just `object` are different in nim - first one is a heap-allocated object while second one is stack allocated. You would have to copy the data using `var rval: rob; new(rval); rval[] = ob`

Nim receives $100k in Bitcoin donations

2021-10-25 Thread haxscramper
It would be nice to know list of current active/paid compiler developers, because to be honest even at this point I'm not entirely sure who "nim core development team" consists of, and what their roles are. I assume it is something like narimiran, Araq, xflywind, and timotheecour, but I can't be

Nim receives $100k in Bitcoin donations

2021-10-25 Thread haxscramper
If someone haven't seen this already - ("Setting up a Nim foundation")

How to add defaults on nim types?

2021-10-25 Thread haxscramper
As already indicated by previous comments > It's still usable, there are just sections that are "broken" It is not fully broken, but there are some parts that don't work as one might expect. They are related the original question, so that's why they were brought up. All linked issues/comments/R

code comments please

2021-10-25 Thread haxscramper
It is recommended to import all stdlib modules using `import std/` prefix, so `import streams` -> `import std/streams` an so on. `import os, sequtils, system` \- `system` should not be imported explicitly, it is already always added.

How to add defaults on nim types?

2021-10-24 Thread haxscramper
Edit: different styles of **default** initialization

How to add defaults on nim types?

2021-10-24 Thread haxscramper
> Any other alternative to types? No, there are no alternatives to types of course > So those mentions bugs still exist? Those are not bugs, that's how language was originally designed to be. I would also prefer to have a notion of constructor in the language, instead of having several differe

const loop unrolling, or const to static?

2021-10-24 Thread haxscramper
`static` macro parameter means that it is either a literal, or constant expression that can be evaluated explicitly. When you use `ArrayOfStrings[2]` you get second case - all necessary info to evaluate argument is in here. When you add a loop (regardless of any combination of `const` and `stati

How to add defaults on nim types?

2021-10-24 Thread haxscramper
Also from the linked RFC > large portion of type safety guarantees is invalidated - enum with offset, > ranges now can't really guarantee anything unless explicitly created with > `initT`. Any kind of value that has non-zero default requires special > attention - it is now your responsibility t

How to add defaults on nim types?

2021-10-24 Thread haxscramper
Maybe read linked comments? block: type R = range[10..13] doAssert R.default == 0 # broken var a: R doAssert a == 0 # broken type Foo = enum k1 = 10, k2 # not even enum with hol

How to add defaults on nim types?

2021-10-24 Thread haxscramper
It is going to be allowed in the future was accepted

The fate of Nim Editors

2021-10-19 Thread haxscramper
Why not? It is uses nimsuggest anyway, so it does not matter really. Maybe author wanted to try out something new, labeling it as a NIH syndrome is kind of strange

The fate of Nim Editors

2021-10-19 Thread haxscramper
https://github.com/nim-lang/RFCs/issues/300

The fate of Nim Editors

2021-10-19 Thread haxscramper
last commit 6 days ago

Documentation for Nim 1.6?

2021-10-16 Thread haxscramper
1.5.1 is a current development version, 1.6.0 is the next stable release vesion. Documentation for 1.5.1 contains all documentation for new modules, like

Documentation for Nim 1.6?

2021-10-16 Thread haxscramper
release changelog devel docs /

How to get n-th symbol of utf-8 string

2021-10-15 Thread haxscramper
https://nim-lang.org/docs/unicode.html#runeAtPos%2Cstring%2Cint

How to overload procedure correctly?

2021-10-15 Thread haxscramper
`proc sum(a: int, b: int): int = a + b proc sum(a: int | float, b: int | float): float = float(a) + float(b) echo sum(1, 2) echo sum(1.0, 2) echo sum(1, 2.0) echo sum(1.0, 2.0) ` Run

Question about procedure parameters

2021-10-15 Thread haxscramper
It does not matter whether you use let of var to declared variable inside of a procedure, it will all work the same. Procedure with `let nprinted = if nprinted == -1 : s.len else: min(nprinted, s.len)` is identical to `var nprinted = if nprinted == -1 : s.len else: min(nprinted, s.len)`, at leas

Nim 1.6.0 RC3

2021-10-14 Thread haxscramper
Again, putting changelog or release notes probably would not hurt anyone

Nanim: Inspired by 3b1b's manim, I created a GPU-accelerated framework for smooth animations in Nim!

2021-10-14 Thread haxscramper
Thanks a lot for working on such awesome project and sharing it here. I played around with it (not that I have any artistic skills, but it still was really fun). Everything worked flawlessly, including renderer part. > Hope you find it interesting or at least my animations somewhat pretty xP If

Nim 2.0 -- thoughts

2021-10-14 Thread haxscramper
https://github.com/arnetheduck/nlvm

Trailing commas in "command" syntax?

2021-10-12 Thread haxscramper
Probably something like commas: { a b c } Run or { commas: a b c } Run Makes a lot of sense, right

Trailing commas in "command" syntax?

2021-10-12 Thread haxscramper
It would be more annoying yo deal with object initialization, any multiline procedure calls, array and set literals and basically anything that spands more then one line.

FFI - std::string

2021-09-27 Thread haxscramper
If you don't want to wrap `std::string` yourself you can use one of the C++ standard library wrappers like You would need to explicitly convert nim string `"cubo.step"` in your code into `StdString` object.

block-level change default type of int literals?

2021-09-25 Thread haxscramper
It is needed because otherwise `asI` evaluates as nil as mentioned by @ggibson. I'm not sure if this is a bug or not, but with copyNimNode it does generate nil.

block-level change default type of int literals?

2021-09-25 Thread haxscramper
import std/macros macro intAs(asI, body: untyped): untyped = let asI = copyNimNode(asI) proc aux(node: NimNode): NimNode = case node.kind: of nnkIntLit: result = newCall(asI, node) of AtomicNodes - {nnkIntLit}: result = node else:

Nim 1.6.0 RC1

2021-09-20 Thread haxscramper
> Nimble is responsible only for the creation of a nim.cfg file that points to > the correct location of the installed packages with the standard --path: > option of the compiler (this is done by running nimble setup once within your > project). >From

Nim 1.6.0 RC1

2021-09-20 Thread haxscramper
> If it is executed in a package directory it adds cloned packages to the > special nimble.develop file. This is a special file which is used for holding > the paths to development mode dependencies of the current directory package. > It has the following structure: >From

Nim 1.6.0 RC1

2021-09-20 Thread haxscramper
Seems like 1.6 will be shipped with previous version of nimble

JsonNode should be Any

2021-09-20 Thread haxscramper
Any <-> JSON/XML/YAML can be implemented using compile-time introspection and serialization, see treeform/jsony for example. nimyaml also allows to unmarshall objects to and from. At the same time, solving this problem in general is hardly possible, becau

Nim 1.6.0 RC1

2021-09-20 Thread haxscramper
> For example we could roll-back the Nimble version that we ship with 1.6. This would be a preferred solution, since features like this have to be discussed on RFC level, and it takes time. See no reason why we should be delaying release of the language for weeks because of the "lockfiles PR" i

Nim 1.6.0 RC1

2021-09-20 Thread haxscramper
Though old nimble develop is literally a convoluted wrapper for symlink

Nim 1.6.0 RC1

2021-09-20 Thread haxscramper
> It sounds like creating a workspace.develop or nimble.develop in a parent > directory would support that workflow? And creating nimble package for every single small script that I compile, yes. `nim c` does not understand new develop configurations, and it should not, `--nimblePath` is dumb b

Nim 1.6.0 RC1

2021-09-20 Thread haxscramper
I often test my own packages in a separate files that are not part of any project - for various examples, while trying to cleanly debug things and so on. If I understand correctly, new develop mode is fundamentally unable to support this workflow without creating a new project and running everyt

Nim 1.6.0 RC1

2021-09-18 Thread haxscramper
No. User has to delete old package repository, new format is it not compatible with other one . I can't use any older compiler version with new repository format as well. In addition, 'nimble develop' has been remove and ther

Nim 1.6.0 RC1

2021-09-18 Thread haxscramper
Also it is not just "lockfiles", it adds half a dozen other features, and they were not discussed anywhere except "zah specifically requested". I did as for short list but no info was provided.

Nim 1.6.0 RC1

2021-09-18 Thread haxscramper
There is no migration guide, so this release as it stands now would be "we changed things that you use, now go figure out yourself how they are supposed to be used". So even if we **do** ship 1.6.0 with 0.14 nimble, this has to be accounted for.

Nim 1.6.0 RC1

2021-09-17 Thread haxscramper
Can we do the 1.6 release using old nimble before all of this is sorted out? The change is too breaking, so maybe it is a good idea to first figure out how to deal with it and then update nimble in one of the patch updates? People who want to try out latest nimble can always do `nimble install n

Might be a bug in compiler

2021-09-17 Thread haxscramper
type ConnectionRequest* = ref object of RootObj ConnectionStrBool* = distinct bool ConnectionSetRequest = ref object of ConnectionRequestT[ConnectionStrBool] ConnectionRequestT*[T] = ref object of ConnectionRequest proc execute*(req: ConnectionRequestT[bool]) = disc

Might be a bug in compiler

2021-09-17 Thread haxscramper
`type Connection* = ref ConnectionObj ConnectionObj* = object of RootObj ConnectionRequest* = ref ConnectionRequestObj ConnectionRequestObj* = object of RootObj ConnectionStrBool* = distinct bool ConnectionRequestT*[T] = ref object of ConnectionRequest ConnectionSetRequest = ref object of Conne

Might be a bug in compiler

2021-09-17 Thread haxscramper
Minimizing code before asking for question does **really** help when others try to solve your problem ... at least out pure pragmatism - debugging 124 lines is easier than 23, so more likely to get an answer import std/[asyncdispatch, times, options, strutils, sha1] type

How to create C defines from Nim?

2021-09-13 Thread haxscramper
The simplest solution would be to generate emit via macro - construct necessary string at compile-time and then generate AST for `{.emit.}`. Maybe there is a cleaner solution, though considering you are interfacing with C API that uses preprocessor hacks ...

How to convert range types 'a'..'z'?

2021-09-13 Thread haxscramper
Using `object` solves an issue, otherwise I'm not sure if tuples are convertible to each other like this. import std/sequtils type Check* = object priority: 'a'..'c' message: string converter toCheck*(check: (char, string)): Check = Check(priority

Is it possible to tell `import` to not create const with same name as imported module?

2021-09-11 Thread haxscramper
Maybe just name modules differently from variables, like stdlib does - options, macros, strutils, times ... Also i can't reproduce the issue anywhere but top-level: import std/strutils let strutils = "" # fails Run import std/strutils

Why is backward index operator [^1] not zero based [^0]?

2021-09-10 Thread haxscramper
I think that's because `mySeq[^1] == mySeq[mySeq.len - 1]`, so simply subtracts from `.len`

Nim should jump into Blockchain , Web3 and DAPP development trend .

2021-09-02 Thread haxscramper
Are you aware of and ?

  1   2   >