Re: Nim's popularity

2020-06-17 Thread moerm
"Vala" \- I think that tells us next to nothing. Simple reason: unlike Nim Vala was linked to Gnome, i.e. a major (well, kind of) and well known name. When Mozilla (Rust) burps the planet trembles, when Gnome (Vala) burps, the world notices it ... and when Nim burps (or sings a nice song for

Re: New entry on Nim blog...

2020-06-17 Thread moerm
Dafny is a quite nice and actually useable tool but unfortunately .Net only.

Re: New entry on Nim blog...

2020-06-17 Thread moerm
You are all welcome @cantanima I disagree. Reasons, mainly: a) Ada is intrinsically harder to work with. Likely reasons are its age (decades older than Nim) and some almost anal typeing problems, probably also due to its age; in a way J. Ichbiah had to try to emulate SA in the language

Re: if error

2020-04-10 Thread moerm
NaN is floating point. So something = if (condition): foo else: bar can't work if 'foo' is of different type than the type of 'bar'. You can use if (condition): Cell(x:j+1, y:i) else: Cell(-1, -1) or another "special Cell" to indicate what you wanted to indicate using NaN.

Re: Nim 1.2 is here

2020-04-03 Thread moerm
Great, thanks so much Araq and Nim team! I particularly love the SA/H3 and the .localPassC pragmas. Quick question related to that: Assume that I have a Nim file which needs a C file compiled but with different C compiler parameters than the Nim file. Is there a way to tell which compiler

Re: Announcement: The Nim compiler is rewritten in Python with some modules optimized in C

2020-04-01 Thread moerm
I'm strongly opposed to that plan! While I fully agree that Nim (currently) does a lot of uncool stuff (e.g. static typing) I do not consider Python and C good choices. Instead of Python we should be bold and directly walk into where the future is: AI based image interpretation instead of

Re: help information sécurité

2020-03-30 Thread moerm
Just a sidenote: NO! The true news is that GCC finally gets at least some very limited static analysis capabilities. Clang/llvm is light years ahead. Please note that my statement is only addressing static analysis and not GCC in general!

Re: help information sécurité

2020-03-30 Thread moerm
YAY! That's extremely good news. Thanks a lot! I particularly love to see _full_ H3 - incl. 'invariant'. Are there also plans to provide quantors ('forall', 'exists' (plus negation))? Even hotter: Are there plans to provide a _compile time_ interface to Z3? I'm asking because that would be the

Re: Strange (maybe memory related behaviour)

2020-03-29 Thread moerm
The echo statement might trigger a call to getFrameWidth(). Try to do an "old style" echo like 'echo "Width: " & $width' directly after a getFrameWidth() call and assigning its result ("let width = getFrameWidth(...)".

Re: help information sécurité

2020-03-27 Thread moerm
Yes, that's the list I meant. Thanks. Note however that that list is extremely "generous" and most entries are just more or less reasonable _linters_ rather than static analyzers/verifiers.

Re: help information sécurité

2020-03-22 Thread moerm
I'll provide more info once I'm finished doing some verification of Nim C output. "constant time stuff" \- no, I don't know such a tool. Static verifiers are only looking for code correctness, e.g. proper mem. boundaries, reachability, loop invariants, etc. If you want to verify things like

Re: help information sécurité

2020-03-22 Thread moerm
**NO! NOT less secure than C** \- but less secure than _formally verified_ C. That is a _very significant_ difference. "Normal" C code, i.e. C code that has not been formally designed and verified is considerably less secure than normal Nim code. The point is that for C - unlike for most

Re: help information sécurité

2020-03-22 Thread moerm
I'm working in the field and Nim is my "everyday job language". Translation: Nim is _considerably less qualified_ than Ada (much harder to master), Eiffel (unattractive for some other reasons), and even Ocaml (less attractive for multiple reasons), let alone F star (which however is

Re: Nim problems. 1 internal, 1 mine

2020-02-07 Thread moerm
Thanks but I don't assume it's a Nim Bug. It rather looks like a mistake I made.

Re: Nim problems. 1 internal, 1 mine

2020-02-07 Thread moerm
Thanks. In fact I doubt the proposition that warnings are only for humans. For example stating "noreturn" but actually returning _should_ be considered as at least questionable. Sure, one can do a lot of trickery but I have learned (the hard way) that good code is clean code and I would never

Re: Nim problems. 1 internal, 1 mine

2020-02-07 Thread moerm
Sorry, I meant the prng itself. Also while I understand that one might read it as an optimization it actually was a question where I made an error that led to "anti-optimization". Well, whatever, I went the cumbersome path and found my suspicion confirmed. `cast[PResult](s.x)` had Nim _copy_

Re: Nim problems. 1 internal, 1 mine

2020-02-07 Thread moerm
Hmm, frankly, I'm not satisfied by the "it's just warnings" answer as we are not talking about "variable declared but unused" bla bla. But I'll leave it at that because my point isn't about creating a fuzz. I _know_ for a fact that some warnings should be taken seriously and that it's no matter

Nim problems. 1 internal, 1 mine

2020-02-07 Thread moerm
Hello I noticed that compiling fails (Nim 1.06) with `{.passC: "-Werror -pedantic".}` i.e. when I follow my C habit to be stringent with code and ask gcc to treat warnings as errors also in the Nim generated code. It seems the culprit is stdlib_system.nim.c. Error 1 `error: ISO C forbids

Re: Begginer's question - pointers and refs

2019-03-19 Thread moerm
I disagree, at least regarding the question in the title. A ref is always preferable unless one _needs_ a pointer. And the heap vs. stack is not Nim specific.

Re: Strange bug in (open)array handling?

2019-03-18 Thread moerm
Solved ... kind off The line `c = bufx[k]´´ above was followed by ``key[j] = c` (which already was a split for debugging and was originally `` key[j] = bufx[start + j]``) and `key` was a `newStringOfCap(64)` var. @Araq whom I want to thank and laud for his friendly help in our chat for

Strange bug in (open)array handling?

2019-03-18 Thread moerm
I have a strange problem with Nim (both 19.2 release and 19.9[most current] nightly. const MEG64 = 1024 * 1024 * 64 var somebuf: array[MEG64, char] # some large buffer # ... proc char_arr_stuff(bufx: openArray[char], start: int) = var j = 0

Re: Passing a pointer to an array to a c function!

2019-03-16 Thread moerm
Update: The results I talked about yesterday were obtained with Nim simply -d:release compiling but with quite some optimization for the C reference code. Today I cleaned up some minor lose ends and did some polishing (for both, C and Nim) and set Nim to compile with --opt:speed plus some

Re: Passing a pointer to an array to a c function!

2019-03-15 Thread moerm
I don't know about graphics stuff, but 1. I found c2nim very helpful. Preprocessing C source beforehand is a very small price to pay. 2. (and not directly related) **CONGRATS** to the Nim developers! I just finished porting a (very time sensitive) modern fast hashing algorithm to Nim and

Re: Newbie question about reading asynchronous text file line by line

2019-02-12 Thread moerm
The problem is that there seems to be no check for EOF. This here works: import asyncdispatch, asyncfile, os proc main() {.async.} = var filename = "test.txt" var file = openAsync(filename, fmRead) let fileSize = file.getFileSize() while

Re: len [0, 1, 2] fails

2019-02-11 Thread moerm
cblake, tim_st et al Yes. I never liked Nims easy going in some points like the one that shows its ugly head here. Simple reason: ambiguity - as in "not _evidently and strikingly_ clear" \- is known to be one of the major infectors in software, comparable to rats in a city. My personal rule,

Re: how to pass a C array to C function?

2019-02-11 Thread moerm
I'm a bit careful and general in my reply because I don't know the library you use. First, in Nim an array has a known and fixed size. If you need a dynamic array have a lot of seq. Basically you should differentiate between two cases: * 1) The C func has a size parameter directly following

Re: Debugging - again

2019-02-09 Thread moerm
> Geany is a (more or less dead) zombie, PRs are not getting merged. Ts, their last release was in january. It seems though that the Nim support project did indeed end up somewhere between the taiga and a black hole. For your other point: OK, OK, I see it and you are right. When I said "all" I

Re: Debugging - again

2019-02-08 Thread moerm
I know vim - and I also know that many strongly dislike it (and others like it). For the kind of basic tool set for _everybody_ that I have in mind any editor with a "religious" follower or a "religious" hater group seems to be a bad choice. That also means that it's not about "the best

Re: Debugging - again

2019-02-08 Thread moerm
1) Thanks for the hint! Now with the "trick" setting a breakpoint at a proc does work. Great. Unfortunately though, the gdb problem is still there. Maybe it's a version thing; I'll try a more current Gcc/Gdb later and will let you know in case that works. Btw. the Nim version on FreeBSD is

Re: Debugging - again

2019-02-08 Thread moerm
First, thanks for your constructive and friendly reaction. I have a module, let's call it F.nim with, say, proc "fsysctl" that calls into FreeBSDs sysctl. Module F is imported into and called by, let's call it prog.nim. Within prog.nim I have a "tmain" proc that sets up some variables and then

Debugging - again

2019-02-08 Thread moerm
I have wasted 2 days now hunting down a problem on FreeBSD and in particular to get some acceptable way to debug my Nim code in the first place. Result so far: about the only way to debug Nim code known to me is the bloated perverse Visual Studio Code monstrosity - which isn't available on

Re: questions on binding C DLL

2019-01-18 Thread moerm
Re question 1: Where does that `void Fl_Widget_TrackerDelete(Fl_Widget_Tracker* & wt);` declaration come from? I doubt that it's coming from FLTK and I'm not surprised that c2nim doesn't digest it. Are you sure that the `&` is really there before `wt`?

Re: questions on binding C DLL

2019-01-17 Thread moerm
We are not in your head nor do we have the C (or Basic?) source code in front of us. So if you throw some code line at us without any context it'll be hard for us to help you. Also note that the intersection of Nim and Basic developers is probably very small (as opposed to Nim and C) so asking

Re: the ignoring of _ make some translation need more work

2019-01-16 Thread moerm
The following _does_ work: // file ccall.c int some_weirdly_named_func(int p) { return(p += 10); } Run # file ccaller.nim {.compile:"ccall.c".} proc weirdCcall(p: cint) : cint {.importc:"some_weirdly_named_func".}

Re: I do not perceive the advantages of Nim over C #

2019-01-15 Thread moerm
Although this thread is rather old I'll answer anyway because certain attitudes and questions come up again and again. It might be useful to have something to link to instead of saying it again and again. Front-up: My first gut reaction to the OP was "Oh well, if he likes C# so much, why

Re: "Nim needs better documentation" - share your thoughts

2019-01-14 Thread moerm
I'm somewhat torn between the two camps. My compromise: the Nim way for _short_ proc docu (1 - 2 liners) plus, if more than a couple of lines are needed I add something like `More Info: `Details `_`. This allows me to stay Nim style and still have a clear link to more elaborate proc docu.

Re: New "Learn Nim" page

2019-01-10 Thread moerm
I don't think that's largely a question of what's your need and goal. If you want programming as a hobby Python might a be better choice. If on the other hand you plan to do programming more seriously learning Nim is probably a better investment. Reason for my opinion: Nim is a quite easy to

Re: New "Learn Nim" page

2019-01-10 Thread moerm
I'll add something to juancarlospaco's helpful explanation: var k: array[10, int] for i in k.low .. k.high: k[i] = (i + 1) * 10 if k[i] mod 2 == 0: echo k[i] Run Note the `.low` and `.high` in the loop. That's a good way to avoid index

Re: Nim vs D

2019-01-10 Thread moerm
I agree with some points but that > The NIM project founder is sort of a one person show in development and > promotion. is plain wrong. Not having a large organization like Mozilla behind it Nim can obviously not compete with some "competitors" in terms of how many full time developers it

Re: New "Learn Nim" page

2019-01-10 Thread moerm
Nice! Thanks, Nim team!

Re: "Nim needs better documentation" - share your thoughts

2019-01-10 Thread moerm
I agree with Araq's statement and in some cases talking bad about language XYZ indeed is trying to lift up ones own or preferred language (or at least strongly looks like it). But there's a big fat "but": Better languages, at least to some significant degree, are often created _because_ of bad

Re: Nim Advocacy & Promotion Strategies

2019-01-07 Thread moerm
use their favourite editor. But I also know that the "is there an IDE for it?" question is one very many do ask. Go, Zig, ... you name it, just look at stackoverflow, HN, quora, etc ... that question is very prominent.(And again: I personally don't care that much for an IDE. But the disc

Re: Nim Advocacy & Promotion Strategies

2019-01-07 Thread moerm
Besides the fact that almost always the large IDEs also join in once a language already has a solid base and uptake I fully agree with you. Again: My point was _not_ that the Nim team should create our _own_ IDE. It just so happened to be the case that two IDEs were made (and went quite far) by

Re: Nim Advocacy & Promotion Strategies

2019-01-07 Thread moerm
> There is not much professional behaviour in your posts here, some would call > you a troll, consider this to be my first and only warning. My engagement is honest and my motivation is constructive. That's why I also tried to help with concrete problems of users (like just today in the dll

Re: Nim Advocacy & Promotion Strategies

2019-01-07 Thread moerm
My point wasn't that Nim must have its _own_ IDE. My point was that having an IDE is a major point wrt uptake and that Nim just happened to have some considerable effort going into 2 IDEs but left them unfinished. Well noted, my line isn't what _I_ personally like or want but what is generally

Re: still no success binding DLL's callback function

2019-01-07 Thread moerm
Here is your problem: Fl_Callback* = proc(widget: ptr Fl_Widget, pData: ptr any) # ... proc ButtonClick (button: ptr FL_WIDGET, arg: ptr any):**cint {.cdecl.}** = Run In other words, `Fl_Callback` is not cdecl and its return type is void while `ButtonClick`

Re: Nim Advocacy & Promotion Strategies

2019-01-07 Thread moerm
So? We do not at all disagree on that. You basically just worded differently what I meant (modulo some minor points like "imperative" vs. "imperative with some functional"). I'm _not_ for relaxing those points. Quite the contrary. I was addressing another question, namely whether fully

Re: Nim Advocacy & Promotion Strategies

2019-01-06 Thread moerm
Can be a problem though because in today's "language rich" environment with hundreds of languages catering to the needs of 10 niche groups not only highly likes to fail gaining significant traction but also risks to lose its main target group. Re js: That's something I don't see as a problem

Re: Nim Advocacy & Promotion Strategies

2019-01-06 Thread moerm
I'm a lousy marketing or sales guy but one thing even I understood and keep in mind is this: the result of communication is _not_ what has been said but what has been heard. As promoting a language (and arguably even building one meant not only for oneself) is a "use case" of communication it

Re: Nim nightly builds

2019-01-06 Thread moerm
Thanks.

Re: Nim nightly builds

2019-01-05 Thread moerm
Great (although I personally prefer halfway stable releases) Thank you. Out of curiosity: how come the jump from 19.2 -> 19.9?.

Re: Nim Advocacy & Promotion Strategies

2019-01-05 Thread moerm
Front-up disclaimer: I went into the being exited trap due to what Nim has to offer, too. Re the OP issue: To promote a language one should first know what it actually is one wishes to promote. So: what is Nim at its core? What is _the_ definition/goal of Nim? Is it a system language or is it

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread moerm
Thanks for that clear statement. I'm learning and drawing my conclusions.

Re: trouble during wrapping a windows DLL

2019-01-03 Thread moerm
I see 2 major factors and the only reason I'm mentioning them is my optimistic hope that someone concerned will read and think about it: * Nim's docu is poor in many places, let's be honest. * people should understand that there is a strong relation between the quality of a question and the

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread moerm
As a somewhat rude demonstration: From the help for module system proc GC_ref[T](x: ref T) {...} # empty proc GC_ref[T](x: seq[T]) {...} # empty proc GC_ref(x: string) {...} marks the object x as referenced, so that it will not be freed until it is unmarked via

Re: "Nim needs better documentation" - share your thoughts

2019-01-03 Thread moerm
* real documentation - as opposed to just proc comments * Examples, examples, examples * Explanations for more difficult matters like async, threading, etc. Something like page or two only "generally" explaining how those work in Nim (from there the user can go to the modules normal docu

Re: [help needed] nim version of: COMPARING PYTHAGOREAN TRIPLES IN C++, D, AND RUST

2019-01-02 Thread moerm
We are in agreement if I understand you correctly. I don't care whether Nim code runs 0.5% or 3% slower than C code. In fact, I think that whole benchmarking is irrelevant except for a rough overview ("Nim is within x% of C's speed"). Reason (and C/C++/D developers might want to read this

Re: Use GC_ref on a pointer

2019-01-02 Thread moerm
Yes and no. Yes, you are right, I had a wrong (and since then corrected) statement in my post. And yes it does work but it's almost certainly not what he wanted anyway (and a weird way). But yes, I got confused myself.

Re: Use GC_ref on a pointer

2019-01-02 Thread moerm
Yes and no. Yes insofar as you can of course allocate whatever you please and pass those pointers around and/or use them. No insofar as you must be careful to not wildly mix up Nim-allocated objects and pointers. In your example proc newMyObj(): MyObj = result = MyObj(x:

Re: Use GC_ref on a pointer

2019-01-02 Thread moerm
The way you asked your question (hint: vague, general, not clear what you really want) Araq responded perfectly correctly. Now you ask us to read a 150 lines file and we are supposed to find out what you want and what your problem is by reading through and make sense of your code.. Chances for

Re: [help needed] nim version of: COMPARING PYTHAGOREAN TRIPLES IN C++, D, AND RUST

2019-01-02 Thread moerm
I fully agree on Nim indeed _being_ a good language. My point though wasn't "I can do faster code than ...". My point was that one should a) _think_ about optimization starting from "what's actually the point and what's the bottleneck or the most promising approach?" (in this case it was "use

Re: [help needed] nim version of: COMPARING PYTHAGOREAN TRIPLES IN C++, D, AND RUST

2019-01-02 Thread moerm
For what it's worth: I c2nim'd the simple.cpp and slightly adapted it to have a `limit` parameter to (using `i`) limit the number of computed triples. Compile time on my Ryzen box and using gcc as the backend was around 1.6s the first time and about 0.25 s for following runs (said Nim).

Re: Convincing my friend about Nim

2019-01-01 Thread moerm
Pardon me but it seems that you should change friends rather than language. What your friend said about Nim being incomprehensible for people who don't know Nim is simply ridiculous BS. If I were in your place -[and](https://forum.nim-lang.org/postActivity.xml#and) \- for whatever weird reason

Re: Convincing my friend about Nim

2019-01-01 Thread moerm
> First of all, he states that not having such an indentation-based syntax > allows for more freedom ... He is right in that but only in one regard: Having explicit block markers (like { and } or `begin` and `end`) allows for (visually largely unstructured) "streams" of code. If that were

Re: How can we define a function that returns a type like a Union type?

2018-12-30 Thread moerm
Well, "the above code" from alehander42 is Nim's usual way to go about object variants and the code you don't like is the usual way to go about "methods" of object variants. You might want to write `result = ...` instead of `return ...`. proc addTwo(self: C): int = case

Re: How can we define a function that returns a type like a Union type?

2018-12-30 Thread moerm
Sorry but "the above code" can be a lot of things and we are not in your head and can't clearly know what you want. Please do not mistake this as rudeness but I've found again and again that there is a relation between the quality of a problem description and the quality of the responses. I'd

Re: How to achieve "mechanical substitution" like C macro

2018-12-29 Thread moerm
You are welcome. Plus another side note: Nim templates _are_ (what C calls) macros albeit pimped up and cleaner. One important point to remember is that templates (unlike Nim macros) are basically but smart text substitution. This also means that any variables one refers to must either be

Re: How to achieve "mechanical substitution" like C macro

2018-12-28 Thread moerm
This should do what you want: template push(val: int) = stack[p] = val p.inc() template pop(): int = p.dec() stack[p] Run The relevant point isn't the stack logic (p++ vs p--) but that a template that is supposed to "return" something

Re: openArray[(cstring,cstring)] parameter

2018-12-28 Thread moerm
type CsTuple = tuple[first: cstring, second: cstring] CstSeq = seq[CsTuple] proc test(p: openarray[CsTuple]) = for t in p: echo "first: " & $t[0] & ", second: " & $t[1] let ts = @[("a0".cstring,"a1".cstring),("b0".cstring,"b1".cstring),("c0".cstring,"c1".cstring)] test(ts)

Re: My experience with nim so far

2018-12-25 Thread moerm
> Latest Nim is not that dumb for literals: _(example)_ Works fine, even the x > / 2! Excellent news, thank you. > The fact that Nim does not do that many automatic type conversions is good > for safety and performance ... And as Dom said, lenientOps exists now, but I > think I will generally

Re: How can we define a function that returns a type like a Union type?

2018-12-25 Thread moerm
@mrsekut First, your code has a problem by passing a small 'a' but `parseStatement` expects a capital 'A' or 'B'. I'm a bit confused by your approach but I'll try to help anyway. type A = ref object of RootObj name: string value: string

Re: My experience with nim so far

2018-12-24 Thread moerm
> 1) When you work on very platform dependent code, you have to manually add a > bunch of constants and so on. My current solution: a single -d:[platform] switch and an include file with some `when` logic. Probably by far not the smartest way but simple and working 2) Too picky with variables

Re: Future of Nim ?

2018-12-23 Thread moerm
Maybe I was just insanely lucky or maybe in your field there are particularly dangerous spots - but I can't confirm your impression. My experience with Nim is that it's surprisingly well working. The probably biggest problem I see is **documentation**. It _seems_ to cover most areas but it

Re: Future of Nim ?

2018-12-21 Thread moerm
Well noted, I'm not at all opposed to what you wish. It's just that I don't agree with it being the big turbo for Nims uptake. For a start, very many if not most professionals have little choice anyway; projects are done in whatever language management decides. The next major user group are

Re: Using var object in a proc that is the object's property

2018-12-21 Thread moerm
P.S. @Araq and team If it's not too much trouble it might be a good thing to differentiate between illegal memory access and _calling_ a nil proc. Would probably be helpful and errors like the above would be easier to see/understand for new Nim users.

Re: Future of Nim ?

2018-12-21 Thread moerm
> I hope you scored all the brownie points with Araq My respect for Araq is well earned and deserved. Thinking that it's about brownie points tells more about you than about me. As for the matter: You were (and are) free to clearly show how Zig's importing C stuff is not insignificantly

Re: Future of Nim ?

2018-12-21 Thread moerm
a) I don't see the big difference or how using C stuff in Nim is more labour or more complicated than in Zig. b) Again: Even _if_ you were right I wouldn't care because that would be a discussion about a Ferrari being oh so much slower than a Lamborghini; looking from the perspective of a

Re: Using var object in a proc that is the object's property

2018-12-21 Thread moerm
No, it doesn't. It just seems it does but as soon as a call like `s.events.onload("some event"` is made it segfaults with `Illegal storage access. (Attempt to read from nil?)` Please note that the approach of @Araq also fails because in the OP `wrapper.onload` was left nil which leads to the

Re: Future of Nim ?

2018-12-21 Thread moerm
> Zig and Kit have arguably better interop capabilities with C than Nim does atm One might see it like that - I, however, do not. One reason is c2nim and the other reason is that I'm interested in an easy comfortable way. In a way we talk about different things; I talk about that it's easy

Re: Future of Nim ?

2018-12-20 Thread moerm
I'll stay away from game related stuff as I know next to nothing about game development. One thing, however, I can say (certainly not adding to my being liked around here): I personally and subjectively consider Nim's success in some game development to be a warning and a grave danger. > I do

Re: Future of Nim ?

2018-12-20 Thread moerm
> Nim needs a "killer app". This doesn't necessarily mean a specific app, like > Rails was for Ruby - it can be a general pattern, some clear specific thing > that Nim does better than its competitors. I'm afraid neither will do. I'm afraid that "being the most libertarian programming

Re: Nim vs D

2018-12-14 Thread moerm
Let me help you out. I'll emphasize the relevant word to make it easier for you. > I can let other opinions stand and have no need to "facepalm" or similar to > otherwise belittle or attack **anyone** here Maybe, just maybe one might take my opinion re. D as "attack" or belittling IFF I had it

Re: Nim vs D

2018-12-14 Thread moerm
So? You have your opinion and I have mine - and as you saw (with my no further discussing with someone else) I _can_ let other opinions stand and have no need to "facepalm" or similar to otherwise belittle or attack anyone here. In fact I assume the differences in our views largely stem from

Re: high(int) works, high(uint) does not

2018-12-11 Thread moerm
Thanks. I'll wait (and of course just like you have an interim work around). Nice work btw. (NimCrypto).

Re: Unknown cause of AssertionError

2018-12-11 Thread moerm
I don't think the problem is with Nim. It's highly likely with floating point. Unless you want to play with arbitrary precision FP you'll have to live with the fact that while FP can represent mildly large integers it doesn't offer precision with fractions. Btw, that you use only up to 2

Re: high(int) works, high(uint) does not

2018-12-11 Thread moerm
Thanks. I mentioned it (uint.high) mostly for general interest anyway because I almost always use specific intXX and uintXX types. What I said does hold true, however, also for and specifically for `uint64`. `echo "max uint32: " & uint32.high` (and smaller sizes) does compile/work but `echo

high(int) works, high(uint) does not

2018-12-10 Thread moerm
`let h = high(int)` works but `let h = high(uint)` does not work Suggestions?

Re: Nim vs D

2018-12-09 Thread moerm
Hmm, I see. A classical political correctness and Über-Ich argument ... Well, no. I clearly said "personal summary" and I have no obligation to meet any arbitrary conditions like e.g. "examples!" Well noted, I _could_ provide more detail (and I did for Nim which is _worth it_ ) but I don't for

Re: Nim vs D

2018-12-08 Thread moerm
FWIW I had a look at D multiple times and learned to fervently dislike it. My personal summary is that D is but yet another better C/C++ attempt with funny gadgets added and an utter lack of consistence in concept and design. To even put Nim and D next to each other is ridiculous.

Re: Should we get rid of style insensitivity?

2018-12-07 Thread moerm
Yes and no. Yes if the libraries are written in Nim but no, when they are not. But: If they are written in Nim they can be both, snake_case or camelCase _because_ Nim makes no difference. Also note that than Nim can import C libraries and use any identifier style you prefer anyway. The trade

Re: Should we get rid of style insensitivity?

2018-12-07 Thread moerm
Why should they? Nim _has_ a good - and minimally restricting - rule. Types start with a capital letter, vars and procs don't. There's nothing in your way to, e.g. have all types start with 'T' (like Tperson or TPerson)

Re: Should we get rid of style insensitivity?

2018-12-06 Thread moerm
No, style insensitivity does _not_ allow your to do what you want. The reason being that the language behind the scenes changes identifiers. The correct and honest way to say it is that Nim gives you less freedom (in that regard). Look: e.g. in C (and many other languages) you can have two

Re: Should we get rid of style insensitivity?

2018-12-05 Thread moerm
I'm one of those. I still sometimes find myself starting types with 'T'. But I don't feel that to be a problem. And anyway, a rule that says that types must start with a capital letter makes sense and is easily within what a language can reasonably demand. Style insensitivity, however, always

Re: How to lookup the IPV6 addr of a domain name?

2018-12-03 Thread moerm
The getAddrInfo call doesn't return the full struct (only to 0xfff1). Moreover the first couple of bytes are _not_ part of the IPv6 address and the first address byte is the 5th byte after 0x50 (0x20, 0x1, ...). Frankly, I don't think it worth putting more work into the current solution. If

Re: Deprecation of

2018-12-02 Thread moerm
Also note the conceptual difference: `for x in someIterable: foo(x)` deals with the _elements_ of someIterable, e.g. with the letters of a string. `for i in 0 ..> something.len: foo(i)` is conceptionally quite different albeit well known from most older languages and deals with the _indices_.

Re: How to lookup the IPV6 addr of a domain name?

2018-12-02 Thread moerm
@satoru Note that `getHostByName` is deprecated at least on linux. @Libman Nim (nativesockets) _does_ provide `getAddrInfo` but as you probably saw in your research it's all but worthless because it's a mess. Which btw. is hardly Nim's fault but rather a consequence of IPv6 being a makeshift

Re: IpAddress to/from disk problem

2018-12-01 Thread moerm
1. I _did_ describe my solution 2. I don't react as desired to paternalizing and trying to paint me as a bad guy without a social conscience. Quite the contrary. 3. I try to avoid putting code here because I would always have to look up the forum syntax how to do that.

Re: IpAddress to/from disk problem

2018-12-01 Thread moerm
Yes that's one way but not what I want. I mean, come on, it's not something exotic to binary read/write from/to disk. Anyway, I have found a working solution now after a lot of research. Thank you all for sharing your thoughts.

Re: IpAddress to/from disk problem

2018-11-29 Thread moerm
I'm a human. _Of course_ I use higher level functionality when available and adequate. I'm no less lazy than others - g For configs for example I use high level modules (like json). But for some things the ugly old way of using low level binary writing is needed. Btw: I'm less afraid than many

Re: IpAddress to/from disk problem

2018-11-29 Thread moerm
Yes, that's in part what this (and, I assume, the problem) is about. I _did_ study the doc (and the source) carefully. More docs on Nim "toBinary" and "fromBinary" magic in types, used. eg. in FileStream read and write would be urgently needed IMHO.

  1   2   >