Re: `import foo {.private.}` to allows access to private fields (eg: package-level visibility)

2019-07-31 Thread timothee
I've implemented this in 
[https://github.com/nim-lang/Nim/pull/11865](https://github.com/nim-lang/Nim/pull/11865)


Re: How to Maintain a Nim Chinese Community

2019-07-31 Thread ch4o5
It is usually happened on bussiness environment not we programmers, I believe 
that programmers do things just by their interested and love wherever they from 
the world.


Re: Erroneous values returned from Nim’s C foreign function interface.

2019-07-31 Thread mashingan
I'm not sure but after I see in your wutilc


char buffer[INET6_ADDRSTRLEN];

char *get_from(...) {
 \\
 return buffer;
}


Run

I guess it's the problem with global variable; you should change the c api too


void *get_from(struct utmpx *ut, char* outaddr) {
}


Run

and call it in nim


# 
var addrbuf = alloc0(INET6_ADDRSTRLEN)
getfrom(u, addrbuf)
# ...
dealloc(addrbuf)


Run


Re: What do you think about the programming language NIM?

2019-07-31 Thread Neil_H
> Of course Python being taught in schools and universities helps its 
> popularity, but I don't think at all it's the only or even main reason for 
> the popularity.

The other reason of course is around the time python was introduced the main 
languages being used were C, C++ and Java (not counting other scripting 
languages like PHP and Perl that were mainly for web work)… so its no surprise 
it took off, because everybody really, was just waiting for it.

And to be honest I don't find Python that more readable, having a long def 
start to edge over to the right side of the screen because of all the 
indentation is certainly no more readable than the same def would be if it had 
braces inbetween but with all the code on the left side, and the braces on 
separate lines. Braces to split code never bothered me, however having to put 
semi-colons at the end of most lines did and certainly never added anything to 
the readability of C, C++, Java, PHP, Perl... etc, etc


Re: What do you think about the programming language NIM?

2019-07-31 Thread sschwarzer
> Python, I started to learn Python and found it quite easy to pick up, however 
> I decided that its growing way to big as a language, too many people are 
> changing it too much, and for me on Windows it just became another scripting 
> language, no better than say Perl... and yes Python may be very popular at 
> the moment and that's mainly because all the schools and university's etc use 
> it...but we all know that they just follow each other anyway, so just because 
> they all use it, does not mean its the best language out there. Anybody that 
> thinks that is a fool.

I don't see Python that negatively. The language clearly has its strengths, and 
personally I find it much more readable compared to Perl (not just now, but 
already very shortly after moving from Perl to Python).

By the way, my perception from using Python professionally for almost 20 years 
is that schools and universities introduced Python rather slowly, after it was 
already in wide use. Actually I had expected that Python would find its 
widespread use in education _much_ earlier. Of course Python being taught in 
schools and universities helps its popularity, but I don't think at all it's 
the only or even main reason for the popularity.

Regarding the "best language", I think there isn't any best language, only the 
best compromise for a given use case. :-)


Re: What do you think about the programming language NIM?

2019-07-31 Thread Kiloneie
I've found Nim just a couple of days ago and i am totally in love with it, i am 
reading on it on the way to work, at work and then i practice is at home, it's 
so nice to have a language that is beautiful, really easy to understand just by 
looking at the code whilst very powerful and performant. I think i will make 
some tutorial videos on it once i learn it some more.


Re: Read lines from file thats in a variable

2019-07-31 Thread Neil_H
Because I have Regex already done that will only work on the whole file.

And I am going to use the splitLines iterator, but the file will also be in 
memory at the same time, in this day an age of large amounts of ram, and since 
I will only be dealing with certain types of source files I don't think that 
will be a major problem. 


Re: Read lines from file thats in a variable

2019-07-31 Thread enthus1ast
Why you read it in completely in the first place when you want to operate on 
lines? When you mystring.split('n') you double the amounth of memory used. For 
small files this seems ok but for larger ones your programm could explode. It's 
much better to use the splitLines iterator as Stefan_Salewski pointed out. This 
way you only have to store the current line in memory. 


Re: Erroneous values returned from Nim’s C foreign function interface.

2019-07-31 Thread teroz
You would think with a working C example would be a walk in the park. Still no 
joy. At the risk of breaking forum ettique I have a tiny who.nim that iterates 
over all logged in users and prints to console. The code also calls the c code 
that reads the IP address correctly as well as the nim version

[https://send.firefox.com/download/6c74113752cf4a9b/#OBxTC24p8aKfVpC0Qg7eDA](https://send.firefox.com/download/6c74113752cf4a9b/#OBxTC24p8aKfVpC0Qg7eDA)


Re: Nim VS The World (CoffeeScript/Boo/PureBasic/C#/ES2018/Python)

2019-07-31 Thread Neil_H
I wrote bigger programs than those in MaxScript for 3D Studio Max :-)

As for Pascal, well that was just an example, there are many others out 
there.Liberty Basic, Free Basic, Scala, Clojure, Steel Bank Common Lisp, 
SmallTalk, Erlang…….need I go on? 


Re: Read lines from file thats in a variable

2019-07-31 Thread Neil_H
Thanks, but as stated in my first comment... I don't want to go down the route 
of using streams etc. 


Re: What do you think about the programming language NIM?

2019-07-31 Thread lscrd
Thanks for your explanation.


Re: What do you think about the programming language NIM?

2019-07-31 Thread Neil_H
I like Nim for all the reasons given here... for me personally, comparing with 
other languages...

Python, I started to learn Python and found it quite easy to pick up, however I 
decided that its growing way to big as a language, too many people are changing 
it too much, and for me on Windows it just became another scripting language, 
no better than say Perl... and yes Python may be very popular at the moment and 
that's mainly because all the schools and university's etc use it...but we all 
know that they just follow each other anyway, so just because they all use it, 
does not mean its the best language out there. Anybody that thinks that is a 
fool.

C programming, well ive stated before somewhere, I hate the C language, always 
have. why would anybody pick the * char to use as a pointer when in nearly 
every other language it was used for multiply... which meant when you look at C 
code... you see all these * and its like what a mess, what a complete and utter 
mess.

On windows...Nim is faster than Python and easier than C... reasons enough for 
me to try it. 


Re: What do you think about the programming language NIM?

2019-07-31 Thread cblake
@mratsim's code may not trigger it, but at least in `/devel` there seems to be 
a check in `semexprs.semOverloadedCallAnalyseEffects` that errors out with 
`errRecursiveDependencyIteratorX` ("recursion is not supported in iterators: 
'$1'"). The error message was even updated just a couple months ago. It is not 
hard to trigger this erroring out with trees that are "run-time switched" 
recursions vs. @mratsim's compile-time switched recursion. I for one would love 
full recursion support in iterators (and so would love to be wrong, if I am).


Re: What do you think about the programming language NIM?

2019-07-31 Thread lscrd
This is Interesting. Thank you.

So the documentation is wrong when it says: “Neither inline nor closure 
iterators can be recursive”. Here: 
[https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-first-class-iterators](https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-first-class-iterators)

Or is there something I did not understood? 


Re: What do you think about the programming language NIM?

2019-07-31 Thread lscrd
> Note that Nim iterators correspond to Python generators…

I would like, but they are less powerful. Generators can be recursive in Python 
while iterators cannot. And in Python it’s easy to use a generator without a 
_for_ loop thanks to the _next_ function.

But, despite these limitations, iterators in Nim are very pleasant and easy to 
use, compared with the way to define them in other languages such as Julia. 
And, I agree with you, they are amazingly useful.