Re: cannot call a proc without brackets

2018-04-28 Thread lightness1024
@Araq Do you mean to say here we are dealing with CIS (command invocation syntax) ? To me this felt under UFCS since it's about function call and about giving more choices: it's "Universal". Now if UFCS means only a.f()/f(a) then that's not very universal. But the thing that makes me hate UFCS

Re: cannot call a proc without brackets

2018-04-26 Thread lightness1024
it took me a good minute to understand what you said @mashingan. That is a vexing parse in my opinion, and only some more gasoline on my anti UFCS fire. It's sad that I end up with negative judgments of a feature that sounds so marvelous on paper. (and I like the command call syntax, spaces

Re: Float should be 32 bit, 2x performance just by changing the defaults

2018-04-23 Thread lightness1024
I work in games middleware and we mostly use float32, that doesn't mean we care about what is the default of an unspecified type. The game industry really dislikes unspecified sizes, and therefore will systematically use an explicitly sized type, which means, Nim's float32. And typedef it to

Re: Warning: parseopt2 is deprecated

2018-04-05 Thread lightness1024
[https://www.youtube.com/watch?v=pXhcPJK5cMc](https://www.youtube.com/watch?v=pXhcPJK5cMc) I'll leave it at that.

Re: complex statement requires indentation

2018-03-29 Thread lightness1024
@mashingan that's the problem. I suggest to remove this feature from ?? and put it in ???.

Re: complex statement requires indentation

2018-03-28 Thread lightness1024
Thanks. also philosophical question, I'm not sure that in C# "empty" is part of the conditions verified by this operator. I think it's only null. So empty sequences, or empty strings would not trigger the false case. Maybe we should define a strictly nil only coalescing operator as ?? and the

Re: complex statement requires indentation

2018-03-28 Thread lightness1024
@LeuGim thank you very much. can you edit your code to add proc zeroval[T]: T {.compiletime.} = discard so that future googlers can copy paste with no struggle ? Also let's mention some keywords so that PageRank can index efficiently: ?? is the "null coalescing operator" or "nil coalescing

Re: complex statement requires indentation

2018-03-26 Thread lightness1024
@doofenstein : thanks, the do notation still evades my understanding, I need more time before I get it. The => is great, I used it later, but we should not have to put parentheses. @mashingan : better indeed. even though one can argue this convention over configuration can be itchy. now how

complex statement requires indentation

2018-03-26 Thread lightness1024
var b = map(r, proc(x: string): string = if x.isNilOrEmpty(): "stuff" else: x) no. (Error: complex statement requires indentation) var b = map(r, proc(x: string): string = if x.isNilOrEmpty(): "stuff" else: x) yes. that, I refuse it.

Re: Algorithms must decouple from containers

2018-03-24 Thread lightness1024
Table doesn't work differently enough to break the iterable rules, what kind of ranges are you thinking about ? A range is a begin and an end iterator. Or otherwise said, one iterator with a "isFinished" method (since it is nim's choice). Soon they'll have next() if I understand correctly.

Re: Nim syntax Quiz

2018-03-24 Thread lightness1024
not cool compiler message: [https://imgur.com/a/AcANV](https://imgur.com/a/AcANV) it'd be way better: "not nil only applies to ref types" maybe we should have a pinned threads about those.

Re: Nim syntax Quiz

2018-03-21 Thread lightness1024
Hey I have another good one in the category "ignore the compiler and just go back to the code". import db_mysql, tables type XchgSym = tuple[xchg: string, sym: string] var xchg_symbol2id = initTable[XchgSym, int]() # real code: #let id =

Re: Nim syntax Quiz

2018-03-21 Thread lightness1024
I'm also a beginner and I'm also exasperated by error messages just like you. Let's take C#, it's a language that was designed on purpose to be beginner friendly, and the compiler outputs messages that are incredible and spot on. This makes it frustration-free, and that's one key to adoption.

Re: OrderedTable is not an ordered table

2018-03-21 Thread lightness1024
@cblake omg such a concentration of goodness in this answer, thank you for the tombstone warning. If I understand what you mean, I gave it some thought at the time, and concluded it would be an idea to "garbage collect" if some metric goes red, which is the solution google dense map appears to

Re: OrderedTable is not an ordered table

2018-03-21 Thread lightness1024
@cblake - ok perfect. also naming things search-aware is important so I concur. The python's OrderedDict: I didn't know that, it's a good thing nim is not alone then. And in fact the presence of this is enough to not go and rename it. (less disturbance) In C++ the set/map is usually

Re: OrderedTable is not an ordered table

2018-03-21 Thread lightness1024
Hey that makes sense though. Maybe adding a SortedTable will be enough to solve this confusion. The mere presence of an OrderedTable and a SortedTable will pick reader's curiosity and will naturally force us to look into why there are two concepts that sounds similar.

OrderedTable is not an ordered table

2018-03-21 Thread lightness1024
I just read in the module tables: > OrderedTable is like Table but remembers insertion order Well.. lol, thank you very much but that's not what we expect. This is a "sequentially stable table", I suggest a rename to "SeqTable" maybe. In C++ a set or a map are ordered tables. In C# there are

db_mysql & threads

2018-03-17 Thread lightness1024
Is it possible to have a thread that update contents on the table A, and another thread that queries table A on the same connexion, or I need 2 DbConn objects ? I guess it doesn't make much sense to share anyway since nim supposedly separates all memory, though I could copy the conn object on a

thanks for init.sh

2018-03-11 Thread lightness1024
this: https://nim-lang.org/choosenim/init.sh -sSf | sh was the easiest awesomiest install from source I've ever executed. Thanks to the person who set this up. just at the end letting the user modify his path manually seems a bit peanuts to do automatically compared to what the

Re: Big integer litterals

2018-03-08 Thread lightness1024
It was even worse before [https://github.com/nim-lang/Nim/issues/936](https://github.com/nim-lang/Nim/issues/936)

Re: Big integer litterals

2018-03-06 Thread lightness1024
I just wish to say that I'm not sure of how nim behaves, but as of the C standard, nothing is said about the size of types, and definitely, the fact that int should be the natural machine's word size is an urban legend. What the C standard says about type, is the following: sizeof(char) <=