Init procedure naming convention for non-GC memory

2022-06-25 Thread arnetheduck
In your example, one can assume that copying the handle is "wrong" \- let's say it's a file handle - you're not supposed to copy file handles around because they don't have copy semantics in C (you're supposed to `dup` copies) - using `ref object` correctly represents that situation in nim. The

Mastering Nim: A complete guide to the programming language

2022-06-25 Thread brainproxy
I've ordered a copy and look forward to reading it. Thank you for the time and effort it took to write it! I'm happy to have purchased a hard copy to support your work. I would also love to see it available as an e-book. Being able to display a learning resource for a programming language side-

Back to the basics (of research) - Concurrent data-structures in 2.0 ?

2022-06-25 Thread Bosinski
Hello evbd, afaik Martin Odersky once described a app as _a flow of typesafe transformations_. These days one might like to add _efficient multiprogram type transformations in a shared-memory environment_. Recently i've spent some time to look at a couple of research-papers (and some lecture v

Setting compiler-style defines in normal code?

2022-06-25 Thread elcritch
Thanks! That’d work.

Mastering Nim: A complete guide to the programming language

2022-06-25 Thread Araq
> Started reading the book, to report typos and similar stuff do we wait for > the repo of code and then open issues there? For now please tell me about these typos via email. There cannot be many as every important snippet did run through the compiler...?

Deploy DLLs

2022-06-25 Thread Patitotective
I still can't get windy to work with . I need to convert this and this to windy .

Nim v2: what would you change?

2022-06-25 Thread EyeCon
I think backticks are a good compromise between the ease of style-insensitivity and the need for conforming to the FFI names. While we're at it, we should also consider allowing initial and final underscores as well as consecutive underscores when a backtick-enclosed identifier is used.

Unexpected empty sequence

2022-06-25 Thread xigoi
It would be annoying to have things like `JsonNodeRef`.

Unexpected empty sequence

2022-06-25 Thread dee0xeed
> According to the style guide, yes. " _When naming types that come in value, pointer, and reference varieties, use a regular name for the variety that is to be used the most, and add a "Obj", "Ref", or "Ptr" suffix for the other varieties. If there is no single variety that will be used the mo

Mastering Nim: A complete guide to the programming language

2022-06-25 Thread tcheran
@pietroppeter Typos? Araq has compiled the book with -d:releaseNoTypos... ;)

Mastering Nim: A complete guide to the programming language

2022-06-25 Thread andreslowrider
purchased; looking forward to reading it!

Unexpected empty sequence

2022-06-25 Thread sls1005
According to the [style guide](https://nim-lang.org/docs/nep1.html), yes.

Unexpected empty sequence

2022-06-25 Thread dee0xeed
> In the 2nd case, obj is the name of a variable on the stack, with an address > (of an object allocated on > the heap) stored in it. You can view ref as > auto-managed pointers in other language. Ok. Then there is a question. Is doing like this type TheObject = object

Unexpected empty sequence

2022-06-25 Thread sls1005
In the 2nd case, `obj` is the name of a variable on the stack, with an address (of an object allocated on the heap) stored in it. You can view `ref` as auto-managed pointers in other language.

Mastering Nim: A complete guide to the programming language

2022-06-25 Thread pietroppeter
Started reading the book, to report typos and similar stuff do we wait for the repo of code and then open issues there?

Mastering Nim: A complete guide to the programming language

2022-06-25 Thread tcheran
That's pretty outreageous! I checked, and Masterig Nim is available on amazon co.uk .it, .fr... and not .de??? I hope it's temporary. However for european potential buyers, you may consider alternatives to .com. I'll probably buy it too... I'm just a bit scared about print quality. I really hope

Unexpected empty sequence

2022-06-25 Thread dee0xeed
> With Stage as a ref type instead, the seq is an array of pointers under the > hood So, if we have something like type SomeObj = object ... var someSeq = seq[SomeObj] Run then var obj = SomeObj() someSeq.add(obj) Run

Unexpected empty sequence

2022-06-25 Thread dee0xeed
> As you discovered, a pointer to a member of a seq can become invalid when the > seq is resized This remembered me one case that happened a lng time ago. I reallocated some array of some structs, but forgot to change some pointers, which pointed to the elements of that array. But! In case

Unexpected empty sequence

2022-06-25 Thread dee0xeed
> Just using a pointer that you get before changing seq length is unsafe Yes, yes, yes, now it's absolutely obvious for me, and I just take addresses of sequence elements after the sequence is filled completely and (in case of my code) will never change anymore.