Re: nimkernel capabilities

2020-03-04 Thread Stefan_Salewski
> since I haven't seen Search for "nim kernel" at github, there is also [https://github.com/samanthadoran/Mero](https://github.com/samanthadoran/Mero) [https://github.com/pascalmouret/assyria](https://github.com/pascalmouret/assyria)

Re: what [T] means in nim?

2020-03-04 Thread Stefan_Salewski
See official tutorial part 2: [https://nim-lang.org/docs/tut2.html#generics](https://nim-lang.org/docs/tut2.html#generics)

Re: parallel: bounds checker

2020-03-03 Thread Stefan_Salewski
You may see Araq's reply in [https://forum.nim-lang.org/t/4827#30222](https://forum.nim-lang.org/t/4827#30222)

Re: How to get immidiate disk-usage

2020-03-03 Thread Stefan_Salewski
If this really should be not spam then you may see [https://forum.nim-lang.org/t/5861](https://forum.nim-lang.org/t/5861)

Re: About manual memory management(new to nim)

2020-02-29 Thread Stefan_Salewski
I new tried it, but what is wrong with the this straight forward approach: proc main(): int = var a: ptr int = cast[ptr int](alloc(sizeof(int))) echo cast[int](a) a[] = 10 echo a[] dealloc(a) a = nil return 0 echo main()

Re: Table with generic type

2020-02-29 Thread Stefan_Salewski
Maybe something like import tables, hashes type Node[T] = ref object parent: Node[T] children: seq[Node[T]] data: T Data = ref object name: string proc hash(d: Data): Hash = hash(d.name) proc

Re: Nim's float issue?

2020-02-28 Thread Stefan_Salewski
> it's a serious question, Maybe. I hoped he would come back so that we would know for sure, but he did not. Well sometimes my answers may be wrong or bad, so it may be better to do not answer at all and leave answers to the paid Nim devs, or at least native english speakers. In am none of

Re: Is this possible?

2020-02-27 Thread Stefan_Salewski
> please write Nim code like this Maybe I missed a lot, but I have no idea what that part of your answer may mean and how it may help for the initial question.

Re: Nim's float issue?

2020-02-25 Thread Stefan_Salewski
It`s a bit hard to believe that this is a serious question because of [https://nim-lang.org/docs/math.html#round%2CT%2Cint](https://nim-lang.org/docs/math.html#round%2CT%2Cint) But maybe you missed that and have no CS experience. The basic fact is that we can not present each decimal number

Re: Modify old code using new/finalizer to compile with gc:arc

2020-02-23 Thread Stefan_Salewski
That may work too. But currently I consider replacing compileOption("gc", "arc") with defined(gcDestructors) because I have seen use of defined(gcDestructors) in Nim stdlib code. I am not sure if that is best -- all the options are a bit confusing.

Re: Modify old code using new/finalizer to compile with gc:arc

2020-02-23 Thread Stefan_Salewski
From [https://irclogs.nim-lang.org/23-02-2020.html#14:16:11](https://irclogs.nim-lang.org/23-02-2020.html#14:16:11) [https://github.com/StefanSalewski/gintro/issues/66](https://github.com/StefanSalewski/gintro/issues/66) it seems that your when defined(gcDestructors): is the more correct test,

Re: Modify old code using new/finalizer to compile with gc:arc

2020-02-22 Thread Stefan_Salewski
Yes, something like that. I added --gc:arc support with finalizers some weeks ago, and destructor support yesterday. Note that we do not really need destructors for ARC, finalizers are ok also, I added them because of the subclassing problem, see Araqs reply to filcuc and my last edit in

Re: RayCasting Problem

2020-02-19 Thread Stefan_Salewski
c2nim can translate most basic C and even Cpp code, problems can be C macros and cpp classes, and somtimes it generates a div instead desired / for floating point division. But it save some work and avoids errors. When you change datatypes, you have to be careful, as float and integer

Re: RayCasting Problem

2020-02-19 Thread Stefan_Salewski
Have you done the transfer with c2nim tool? Seems that you did at least manual modifications: time : uint32 = 0 oldTime : uint32 = 0 time = getTicks() var diff : uint32 = time - oldTime var frameTime : float = float(diff) / 1000.0 Run Time and

Re: Why whitespace?

2020-02-18 Thread Stefan_Salewski
> "Why spaces instead of tabs?" There are two valid reasons for spaces: myproc( a: int; b: float ) = Run This formating scheme would not work with tabs. And github inserts 8 spaces for a tab, which looks bad. For me both arguments

Re: Nimrod Combinatorics Module of Reimer Behrends does not work with --gc:arc

2020-02-17 Thread Stefan_Salewski
Thanks for all your support.

Re: Nimrod Combinatorics Module of Reimer Behrends does not work with --gc:arc

2020-02-17 Thread Stefan_Salewski
Indeed it is partly my own bug, I call in generator script gen.nim unintentionally something like var s = newSeq[int]() try: for x in combinations(s, 1): echo x except: discard Run Of course makes no sense with empty seq,

Re: Nimrod Combinatorics Module of Reimer Behrends does not work with --gc:arc

2020-02-17 Thread Stefan_Salewski
Thanks for confirming that a combinations() iterator is not available in std lib yet. Have just tried to explore Mr Behrends module, but I do not understand the code nor the error messages when compiled with --gc:arc. OK, then I will fix oldgtk3 for now and wait with combinations() iterator.

Re: Nimrod Combinatorics Module of Reimer Behrends does not work with --gc:arc

2020-02-17 Thread Stefan_Salewski
You think it is still an ARC issue? I assumed that the problem is just that the code of Mr Behrends is 6 years old now. But generally I still hope to have that combinations() iterator from a more reliable source -- std lib or maintained nimble package.

Re: How does one check if a string is numeric?

2020-02-17 Thread Stefan_Salewski
Yes, the Rosetta example seems to be outdated unfortunately, but one gets the idea. You may also consider [https://nim-lang.org/docs/strscans.html](https://nim-lang.org/docs/strscans.html) or [https://nim-lang.org/docs/parseutils.html](https://nim-lang.org/docs/parseutils.html), that may be

Re: How does one check if a string is numeric?

2020-02-17 Thread Stefan_Salewski
Is isDigit() really deprecated? I can not imagine a reason. [https://github.com/nim-lang/Nim/blob/devel/lib/pure/strutils.nim#L144](https://github.com/nim-lang/Nim/blob/devel/lib/pure/strutils.nim#L144) For the question, google points us to

Nimrod Combinatorics Module of Reimer Behrends does not work with --gc:arc

2020-02-17 Thread Stefan_Salewski
I was just testing if installing gintro works when generator script is compiled with --gc:arc already. (Of course that will be needed only when ARC will become default for Nim.) First trivial issue is with glib.nim from oldgtk3 generated by old c2nim years ago, const #

Re: Why does the this code work?

2020-02-15 Thread Stefan_Salewski
Well, we may ask: Why do we have openArray proc parameter type at all, when varargs works for multiple arguments, for a seq and for an array? So varargs should be able to fully substitute openArray parameter type. Maybe varargs has more overhead, or maybe there exists cases where we want to

Re: What's the difference between varargs[T] and openArray[T]?

2020-02-15 Thread Stefan_Salewski
For an openArray parameter you can pass an array or a seq, but only a single one. For varargs parameter you can pass multiple arguments. I think the explanation at > [https://nim-lang.org/docs/manual.html#types-open-arrays](https://nim-lang.org/docs/manual.html#types-open-arrays) is fine, but

Re: Call for QT bindings

2020-02-13 Thread Stefan_Salewski
Please stop spreading these wrong and unfriendly remarks! > but there isn't any uptodate gtk3 bindings as far as I am concerned. You did it already in [https://forum.nim-lang.org/t/5657#35169](https://forum.nim-lang.org/t/5657#35169) > Same pattern goes for gtk3. The only upto date gtk binding

Re: Newbie With Several (Likely Dumb) Questions

2020-02-13 Thread Stefan_Salewski
Note that there are many tutorials available, the "Nim Days" is already advanced and for special topics. See [https://nim-lang.org/learn.html](https://nim-lang.org/learn.html). The official Tutorial part 1 and 2 are a good start. For your first question: Some people coming from Python have not

Re: Comparison Rust vs Nim binary sizes for IOT applications (just an FYI if you're interested)

2020-02-12 Thread Stefan_Salewski
To get small executables with Nim you may try nim c -d:danger --gc:arc -d:useMalloc -flto myprog.nim Run Im best case use also gcc10, it can generate smaller binaries than gcc9 with -flto. (It shrinks my chess game to 105k.) Also there was a tutorial by Mr Felsing

Re: Nim problems. 1 internal, 1 mine

2020-02-07 Thread Stefan_Salewski
> found my suspicion confirmed. cast[PResult](s.x) had Nim copy the content (32 > bytes) rather than simply Great. It would be nice if you could push minimal example code for that behaviour to Nim issue tracker, it may be a bug. I personally avoid casts myself, but I would not assume it

Re: Nim problems. 1 internal, 1 mine

2020-02-07 Thread Stefan_Salewski
> I need no optimization help. But you ask exactly for this -- for help optimizing the C -- Nim interface. You know C well, and in the Nim cache directory there is all the C code visible, so you could invest it. I don't think that even the brightest Nim devs can just guess the problem.

Re: Nim problems. 1 internal, 1 mine

2020-02-07 Thread Stefan_Salewski
For your first problem: It should be obvious that warnings of the C compiler makes not much sense for Nim generated code, as warnings are mostly for human errors. Would you care for such warnings when Nim would generate assembly directly? Even extremly ugly or verbose C code is fine as long as

Finding dead code in messy files -- first attempt with macro

2020-02-06 Thread Stefan_Salewski
For really cluttered files like [https://github.com/StefanSalewski/gintro/blob/master/tests/gen.nim](https://github.com/StefanSalewski/gintro/blob/master/tests/gen.nim) it is not easy to find code segments which are never executed. In the past I added 'echo' or 'assert false' statements when I

Re: Parallel statement: procedure returning string

2020-02-06 Thread Stefan_Salewski
I think your code should not compile at all in its current form, as result = ch[0] is an incompatible assignment, string to float. Generally parallel processing is restricted in Nim currently with default GC, as each thread has its own heap ans so passing data is difficult. I never used

Re: How to refer to a dynamically determined array

2020-02-05 Thread Stefan_Salewski
No, you may read his post more carefully, he wrote:

Re: How to refer to a dynamically determined array

2020-02-05 Thread Stefan_Salewski
When your container should be dynamically sized, then you can not use an array, as in Nim and legacy C an array is a fixed size block of memory. You will have to use a pointer to array, and you have to dynamically allocate the block of memory where the array lives. We have in Nim a data type

Re: Equivalent of VBA With structure

2020-02-01 Thread Stefan_Salewski
$ nimble search with cascade: url: https://github.com/citycide/cascade (git) tags:macro, cascade, operator, dart, with description: Method & assignment cascades for Nim, inspired by Smalltalk & Dart. license: MIT website:

Re: cairo2 wrapper needs help to complete

2020-01-29 Thread Stefan_Salewski
I know a bit more about gtk then about cairo. For gtk we have for example [https://developer.gnome.org/gtk3/stable/GtkGrid.html#gtk-grid-get-child-at](https://developer.gnome.org/gtk3/stable/GtkGrid.html#gtk-grid-get-child-at) where we get back objects from gtk. For cairo I have to inspects API

Re: cairo2 wrapper needs help to complete

2020-01-29 Thread Stefan_Salewski
I told you recently in your Nim cairo issue that there is some sort of high level cairo available in gintro for some years now, being not much testing, but working with ARC now. So what is wrong with that one or what do you miss? And what are you planing to do with your new cairo -- standalone

Re: Game unlock gui written with gintro

2020-01-27 Thread Stefan_Salewski
Nice to hear that. For memory leaks or corruption I generally test with --gc:arc, -d:useMalloc and valgind, and generally get some leak reports. Not only for gintro but also for pure Nim programs, see [https://forum.nim-lang.org/t/5839](https://forum.nim-lang.org/t/5839) for example. But I

Re: Game unlock gui written with gintro

2020-01-27 Thread Stefan_Salewski
I have just shipped gintro v0.7.0 with \--gc:arc support, so you may test your app with it. See top of readme in [https://github.com/StefanSalewski/gintro](https://github.com/StefanSalewski/gintro) for details. There are some serious changes, so it may not work for you out of the box. But we

Calling =destroy on parent class

2020-01-24 Thread Stefan_Salewski
type O1 = object of RootObj i: int R1 = ref O1 proc `=destroy`(x: var O1) = echo "destroy" type O2 = object of O1 j: int R2 = ref O2 proc `=destroy`(x: var O2) = `=destroy`(O1(x)) proc main = var r =

Re: Finalizers questions

2020-01-22 Thread Stefan_Salewski
The fact that currently finalizers have to be defined in the same module as the corresponding object makes subclassing of objects by user impossible. For example >

Re: Nim will silently auto convert a float64 to a float32 and loose precision... is that good? Thoughts?

2020-01-20 Thread Stefan_Salewski
The result of your code is not really surprising: As you specify the type Elem as an or type, you get finally two instances of vec2() proc. One produces an object containing float32 fields, and one producing an object containing float64 fields. The decision to use which of then is here taken

Re: Is this a minor --gc:arg issue?

2020-01-20 Thread Stefan_Salewski
I know that :-) The point is that only the bottom most code above compiling with --gc:arc give us the desired compile-time error. The topmost code compiles always without error, the bottom most code compiles with default gc. Well, it is indeed good enough, our actual code should most of the

Is this a minor --gc:arg issue?

2020-01-20 Thread Stefan_Salewski
This code compiles with default gc and with --gc:arc: type Language* = ref object impl*: pointer proc gBoxedFreePangoLanguage*(self: Language) = discard proc languageFromString*(): Language = var l: Language new(result)

Congratulations to all the Nim devs, RTree now works with --gc:arc!

2020-01-20 Thread Stefan_Salewski
Not only ~/Nim/tests/generics/trtree.nim but also the extended one with bulkloading and nearest neightbour search from [https://github.com/StefanSalewski/RTree](https://github.com/StefanSalewski/RTree). And fully unchanged! Running with valgrind we get $ nim c --gc:arc

Re: Wrapped C++ code is leaking memory

2020-01-20 Thread Stefan_Salewski
Creating bindings can be more difficult than programming in the target language. I can program in C and a bit in C++. But creating Ruby bindings for C/C++ was not easy. Low level C bindings can be generated with tools like c2nim, nimterop and similar, high level bindings are not that easy

Re: Wrapped C++ code is leaking memory

2020-01-20 Thread Stefan_Salewski
When you call it from C++ valgrind is happy? And you are using --gc:arc ? Have you tested storing Nim objects in std::vector before and that works fine? I can not really help you, as I do know not much about C++ wrapping. But there was a thread about std::vector mapping recently, and the core

Storing Nim objects in C lib -- seems to work fine (with --gc:arc)!

2020-01-20 Thread Stefan_Salewski
type Object* = ref object of RootRef impl*: pointer type InitiallyUnowned* = ref object of Object type Widget* = ref object of InitiallyUnowned proc finalizeGObject*[T](o: ref T) = echo "finalizeGObject" proc main = var

Re: Nim will silently auto convert a float64 to a float32 and loose precision... is that good? Thoughts?

2020-01-20 Thread Stefan_Salewski
For me it is silently. Mixing float64 and float32 unintentionally can be dangerous for precision and have disadvantage for performance. May we allow that mixing only when lenientOps is imported or can compiler give us warnings at least?

Re: Finalizers questions

2020-01-20 Thread Stefan_Salewski
> i would deprecate finalizers I may agree, but i think automatic calling of destructors for references does only work with devel compiler and --gc:arc? At least this test was only working with arc some weeks ago: [https://forum.nim-lang.org/t/5786](https://forum.nim-lang.org/t/5786) So code

Re: Book for beginners

2020-01-20 Thread Stefan_Salewski
There is no buy-able beginner book available beside Dom's "Nim in Action", but there are many good tutorial-like beginner docs available now, see [https://nim-lang.org/learn.html](https://nim-lang.org/learn.html)

Re: Using Nim without garbage collection.

2020-01-18 Thread Stefan_Salewski
See [https://www.reddit.com/r/nim/comments/empsdf/using_nim_without_garbage_collection](https://www.reddit.com/r/nim/comments/empsdf/using_nim_without_garbage_collection)/ there someone asked in exactly the same wordings.

Finalizers questions

2020-01-17 Thread Stefan_Salewski
Now that finalizers work fine with --gc:arc there are two questions left: [https://nim-lang.org/docs/system.html#new%2Cref.T%2Cproc%28ref.T%29](https://nim-lang.org/docs/system.html#new%2Cref.T%2Cproc%28ref.T%29) >Note: The finalizer refers to the type T, not to the object! This means that for

Re: Who would I implement simd to do fast md5 checksums ?

2020-01-16 Thread Stefan_Salewski
[https://irclogs.nim-lang.org/23-12-2019.html#16:10:45](https://irclogs.nim-lang.org/23-12-2019.html#16:10:45) 16:10:45 FromDiscord the best simd wrapper is here: [https://github.com/numforge/laser/blob/master/laser/simd.nim](https://github.com/numforge/laser/blob/master/laser/simd.nim)  But

Re: Check if a procedure exists for a given type at compile time

2020-01-12 Thread Stefan_Salewski
A basic test is generally "when compiles()". But I think your case can not really work: The user of your lib would import your lib, and on the other hand your lib would import drive() proc from user module. So you have cyclic imports. Maybe your lib can define and export a proc var of type

`=destroy` is called for ref types when compiled with --gc:arc :-)

2020-01-09 Thread Stefan_Salewski
I think I heard about that in nim forum long time ago, but tested only with default gc, where destroy is not called. But with ARC it is called indeed currently, and gc_ref/unref seems to work also, so gintro and other packages using finalizers may survive. type O = object

Re: Nim now has Godbolt Compiler Support!

2020-01-05 Thread Stefan_Salewski
That is great. But my feeling is that there are two problems still: First, when I visited that page for the first time, then there was a proc square() available for testing, but there was no ASM code for it. Seems the reason is that nim compiler generates code for it only when it is called, so

Re: How to get left most 8 bit's value from a 32 bit integer ?

2020-01-03 Thread Stefan_Salewski
The optimizing C compiler generates generally very good code for all the cases, but when you really need utmost performance you may inspect the generated assembler code. The cast to array may be a good solution when you need indeed bytes as result, but when you need ints as result, only with

Re: How to get left most 8 bit's value from a 32 bit integer ?

2020-01-02 Thread Stefan_Salewski
> i did not understand what is happening there, There is nothing special. First it has not to be a template, a proc would do. And you have to know only masking and shifting. You shift the bits right, and then mask all but the lower 8 bits. Same as in C. Another way is casting to array of bytes

Re: Game unlock gui written with gintro

2020-01-02 Thread Stefan_Salewski
Congratulations, the first real gintro/GTK3 app. And even with Windows support. Great work!

Re: nimble always install @#head for url

2020-01-01 Thread Stefan_Salewski
I think that is an old known issue: [https://github.com/nim-lang/nimble/issues/318](https://github.com/nim-lang/nimble/issues/318)

Re: FFI constants

2019-12-30 Thread Stefan_Salewski
Also see [https://github.com/nim-lang/Nim/issues/4441](https://github.com/nim-lang/Nim/issues/4441)

Re: can use zip library on Linux but not on Windows

2019-12-29 Thread Stefan_Salewski
See [https://forum.nim-lang.org/t/5353](https://forum.nim-lang.org/t/5353) (I just asked google)

cdt, crash with --gc:arc, no crash with default gc

2019-12-26 Thread Stefan_Salewski
Have just done a short test why cdt module will crash with arc. Bellow is the stripped down code. Problem seems to be that initVector() creates a Vector3 while initDelaunayTriangulation() expects a Vector2. I always admitted that cdt is untested, that is the reason that it is not in nimble.

Re: Introducing --gc:arc

2019-12-25 Thread Stefan_Salewski
> "gtkmm" which is a C++ wrapper and I'm quite sure it uses C++ destructors. That is a fine hint. I don't know much about gtkmm, so I am not sure if they really use C++ destructors or just plain gtk internal ref counting as C does. Will ask Mr E.Bassi at gtk forum. Found comment of mratsim:

Re: Introducing --gc:arc

2019-12-25 Thread Stefan_Salewski
Just tested [https://github.com/StefanSalewski/cdt](https://github.com/StefanSalewski/cdt) That one is indeed not really tested yet, so I did not make a nimble package out of it to not pollute the nimble database. And it is again a bit complex. # with import fix: import dt,

Re: Introducing --gc:arc

2019-12-25 Thread Stefan_Salewski
> That test is also part of our test suite and is so complex that it doesn't > run on 32 bits, nor in C++ I was not aware that it is in test suite. But I was aware that it does not compile with C++, and that nimsuggest has big problems with it. Will try to investigate which problems with 32

Re: Introducing --gc:arc

2019-12-25 Thread Stefan_Salewski
Did just a first test. The RTree test.nim from [https://github.com/StefanSalewski/RTree/tree/master/tests](https://github.com/StefanSalewski/RTree/tree/master/tests) compiles but running the executable gives an assertion error. Funny. Unfortunately gintro apps seems not to compile, seems that

Re: Cannot build old project - TChannel problem

2019-12-25 Thread Stefan_Salewski
You may look for available symbols at [https://nim-lang.org/docs/lib.html](https://nim-lang.org/docs/lib.html) I think most P and T prefixes have vanished, was a legacy from Pascal notation. Channel is available, TChannel not, so I assume TChannel is replaced with plain Channel.

Re: Why is -1 mod 5 not equal to 4? (it is -1)

2019-12-23 Thread Stefan_Salewski
> I know that there is mod and %%. There is also floorDiv() and floorMod(), maybe you like that better: [https://nim-lang.org/docs/math.html#floorDiv%2CT%2CT](https://nim-lang.org/docs/math.html#floorDiv%2CT%2CT)

Re: Problem with C interop/X11 bindings

2019-12-22 Thread Stefan_Salewski
Why that keycode.int16 in Nim code? Seems that C-code passes cint.

Re: understanding risk of shadowing

2019-12-22 Thread Stefan_Salewski
Is trunc(float(n mod 10)).int not identical to plain n mod 10? And you may use for i in countdown(5, 0) if you like.

Re: Most efficient way to convert a uint64 to a seq of bytes

2019-12-21 Thread Stefan_Salewski
Well, I wrote that above is [only] my personal view. I am in no way part of the the Nim team, only an observer. Obviously you have a different point of view, that is fine. But what do you think when you see a lot serious unanswered questions on stackoverflow? Are you not thinking that this

Re: Most efficient way to convert a uint64 to a seq of bytes

2019-12-21 Thread Stefan_Salewski
[https://stackoverflow.com/questions/tagged/nim-lang](https://stackoverflow.com/questions/tagged/nim-lang) I just saw that you polluted stackoverflow with lots of mostly un-anwered, duplicated questions, at the same time advertising yourself with a Dr degree, giving the questions a serious

Re: Can't understand the compiler error message

2019-12-20 Thread Stefan_Salewski
of wmu_DrawControl : # This line is causing the error ! Run The value after of keyword in case statement have to be a constant, but you define it in module a with let, which is not a const def.

Re: Most efficient way to convert a uint64 to a seq of bytes

2019-12-19 Thread Stefan_Salewski
More compact source code you may get with something like var a: array[32, byte] var p: ptr uint64 var myUint64: uint64 = 123456 p = cast[ptr uint64](addr a[8]) p[] = myUint64 Run but so you have no influence on endianess and of course you have to

Re: How to use private variables when you put all types in one module

2019-12-19 Thread Stefan_Salewski
We had discussed that in the past, seem there is still no better solution: > [https://forum.nim-lang.org/t/4745#29623](https://forum.nim-lang.org/t/4745#29623)

Re: Most efficient way to convert a uint64 to a seq of bytes

2019-12-19 Thread Stefan_Salewski
It should be obvious that for high performance you should avoid many add() operations for sequences. add() is a not trivial proc call, even when inlined it has to check if buffer is full and needs reallocation, and it has to increase len field. What was not that obvious for me is how much

Re: What’s your favorite programming language and why?

2019-12-18 Thread Stefan_Salewski
Funny question of a new forum user, isn't it? So lets wait for nice new spam links:

Re: Arrays and Sequences in nim

2019-12-18 Thread Stefan_Salewski
> This is a very interesting point. And to make it more precise: When we access an arbitrary element of a array/seq base address + index * element_size is calculated to determine its memory address and access it. If multiple elements are accessed one after the other, then a compiler is

Re: Arrays and Sequences in nim

2019-12-18 Thread Stefan_Salewski
Maybe one additional note: When we access elements of an array, that generally occurs with an offset to stackpointer. Stackpointer is generally fixed while we are inside a proc, and stackpointer is generally located in a register, so to access an array element a offset plus stackpointer is

Re: Arrays and Sequences in nim

2019-12-18 Thread Stefan_Salewski
I think that question has been answered many times already, and I am nearly sure you know it already. At least you are no newbie, I have seen you name in this forum for at least a few months already :-) Nim array is basically a C array located on the stack, so just a fixed block of memory. As

Re: Any way to force a specific identifier name in C code?

2019-12-17 Thread Stefan_Salewski
Are you looking for [https://nim-lang.org/docs/manual.html#foreign-function-interface-exportc-pragma](https://nim-lang.org/docs/manual.html#foreign-function-interface-exportc-pragma)

Re: A pure nim GUI game for Linux & Windows

2019-12-17 Thread Stefan_Salewski
> to sell only a few thousand copies Good joke! To sell 100 with current Nim community size may be possible, maybe 200 with a chinese translation. A free book may have indeed 1k readers. My guess is that manning sold some hundreds of NimInActions indeed, but that was when Nim was new and had

Re: A pure nim GUI game for Linux & Windows

2019-12-17 Thread Stefan_Salewski
Outplace is new in devel, but I wrote "shuffle does the trick". I only used outplace in the example to generate the mutable test array from the range. And note that NiGui depends on GTK on Linux, so your earlier statement "pure Nim, no depencies" is only valid for windows. There are some GUI

Re: cairoimpl.nim error

2019-12-16 Thread Stefan_Salewski
@cndkhuong have replied to your issue already at github: [https://github.com/StefanSalewski/gintro/issues/60](https://github.com/StefanSalewski/gintro/issues/60) If you wrote something here as a new forum user it may take some time until text will become visible.

Re: A pure nim GUI game for Linux & Windows

2019-12-16 Thread Stefan_Salewski
> it takes me 4 lines to choose 4 unique random colors from a sequence of 17; shuffle() should do the trick, not only in Nim: import sequtils, random, sugar var a = toSeq(1 .. 17).outplace(shuffle())[0 .. 3] echo a Run The other points you miss in NiGui

Re: Editor with nimsuggest support for libs with generics?

2019-12-16 Thread Stefan_Salewski
Thanks for testing. So I think I will consider using your neovim. I have used GVim some years ago, so I know at least the most basic vim commands. My gentoo box has to install a lot of additional packages for neovin, that is the reason why I have not tested neovim for Nim already. Other reason

Editor with nimsuggest support for libs with generics?

2019-12-15 Thread Stefan_Salewski
My own NEd editor works really bad when many generics are used, so I wrote the rtree module with plain gedit without any special Nim support. Unfortunately my editor has the same problems when I only import rtree module -- for a file with only 700 lines of code and gtk3 and rtree import it

Re: indentation

2019-12-14 Thread Stefan_Salewski
Currently I am using for my editor and mostly for the whole desktop display "Source Serif Pro Semibold" downloaded from the Google Webfont collection. The space glyph is still small, but large enough. Some years ago I had another proportional font with really tiny spaces, with it two char

Re: indentation

2019-12-14 Thread Stefan_Salewski
Thanks for clarification, I was indeed a bit surprised by your former post. Two spaces for indentation is indeed fine. One exception is for some proportional (none monospace) fonts with tiny spaces. And yes, I am using proportional fonts for code, they work great. Aligning lines of code like

Re: Practical examples showing how macros lead to better code?

2019-12-12 Thread Stefan_Salewski
Also see [https://www.reddit.com/r/nim/comments/d90z2w/practical_examples_showing_how_macros_lead_to](https://www.reddit.com/r/nim/comments/d90z2w/practical_examples_showing_how_macros_lead_to)/ and maybe ignore the spam links which will be inserted soon in the initial post.

Re: I made an idea incubator cli app: Nimspire

2019-12-10 Thread Stefan_Salewski
We know already: [https://www.reddit.com/r/nim/comments/e1j4ot/i_made_an_idea_incubator_cli_app_nimspire](https://www.reddit.com/r/nim/comments/e1j4ot/i_made_an_idea_incubator_cli_app_nimspire)/

Re: Recommended GUI library?

2019-12-09 Thread Stefan_Salewski
> Same pattern goes for gtk3. The only upto date gtk binding lacks any form of > API reference, and it's been a couple years. We had the discussion (again) some days ago at GTK forum:

Re: Fastest way to check for int32 overflows

2019-12-09 Thread Stefan_Salewski
> Anyway, why are i32 integers the fastest when performing calculations? Some CPU may have no 64 bit data type at all, like some ARM and embedded chips. So for int64 addition we would get two operations at least, one plain addition and one add with carry. Even for a CPU with 64 bit support a

Re: Is it possible to browse the nimble.directory?

2019-12-08 Thread Stefan_Salewski
> lists each tag Unfortunately not all packages have an optimal set of tags. For tagging, once my nimble publish was rejected due to too many tags, then I may had a nimble publish fail maybe because I typed the tags too slowly, then I tried gain with only one fast typed tag and nimble publish

Re: Is it possible to browse the nimble.directory?

2019-12-07 Thread Stefan_Salewski
See also [https://github.com/nim-lang/Nim/wiki/Curated-Packages](https://github.com/nim-lang/Nim/wiki/Curated-Packages) [https://github.com/VPashkov/awesome-nim](https://github.com/VPashkov/awesome-nim)

Re: Help with set

2019-12-05 Thread Stefan_Salewski
> 2\. why You have to accept that compilers may not see x = {1..9, 15, 45..78} as one entity, but as an assignment, where the right side is evaluated first and then assigned to the var on the left. And {1..9, 15, 45..78}is evaluated as a set of integers, which is not compatible to a set of

Deprecation warnings

2019-12-04 Thread Stefan_Salewski
With a fresh Nim devel I am getting Hint: glib [Processing] /home/stefan/gintrotest/tests/glib.nim(68, 13) Warning: use `csize_t` instead; csize is deprecated [Deprecated] /home/stefan/gintrotest/tests/glib.nim(69, 12) Warning: use `csize_t` instead; csize is deprecated

Re: Nim is the friendliest language to start

2019-12-02 Thread Stefan_Salewski
Basically I agree -- for someone with at least a minimal computer science background reading Araqs tutorial part I and II is enough to start, and that takes only a few hours. Learning macros, async, parallel processing is not that easy. And fully unskilled people seems to have some more

<    1   2   3   4   5   6   7   8   9   >