Re: Get the line ending of the current OS

2018-12-12 Thread trtt
That's great, thanks!

Is this a valid Nim code using concepts ?

2018-12-12 Thread walkre
Hi, I am trying to use concepts and have a question about this. I have the following code and this compiled successfully. type C = concept x x.val is int type X = object val: int proc initX(val: int): X = X(val: val) let x: C = initX(1) ech

Re: Get the line ending of the current OS

2018-12-12 Thread citycide
You can use `\p` in a string instead of `\n`: [https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals](https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals)

Re: Get the line ending of the current OS

2018-12-12 Thread Libman
I can't find anything like this in stdlib. Maybe you're remembering something like `ospaths.DirSep` or Python's [os.linesep](https://docs.python.org/3/library/os.html#os.linesep)? System [readline](https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L3135) works with either line ending.

Re: Calling stdcall from .dll

2018-12-12 Thread Ward
https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export

Re: OOP macro - problems with import

2018-12-12 Thread sayol
Ok, thats bit unusual. Good to know, thank you.

Returning cstring from a DLL

2018-12-12 Thread bobd
Adventures in calling Nim DLLs from Delphi again... If I use the following code I can get the string on the Delphi side using PAnsiChar as expected: proc GetString*(): cstring {.cdecl, exportc, dynlib.} = var cs: cstring cs = "String1" return cs Run G

Get the line ending of the current OS

2018-12-12 Thread trtt
I remember the standard library having a module with functions which could tell the default line ending of the current OS. I tried to search for it but couldn't find anything.

Re: OOP macro - problems with import

2018-12-12 Thread jyapayne
@sayol, mratsim is right. The init method's name doesn't matter for the properties. The constructor is generated based on the properties, so if you change it to class MyClass* of RootObj: var x*: int ... Run You also need to change the constructor ca

Re: OOP macro - problems with import

2018-12-12 Thread sayol
Ah, sorry. Of course i did change body of init and print to use instance variable x so this part is fine. Though changing constructor call to m = MyClass(x: 111) doesnt make much of a sense to me. Name of constructor parameter is still value, not x.

Re: Cannot prove initialization, again.

2018-12-12 Thread lscrd
Thanks, it works! But, as this only hides the warning and doesn’t suppress the check , I hope that, despite what is said in the message, this warning will never become a compile time error.

Re: Cannot prove initialization, again.

2018-12-12 Thread mratsim
{.push warning[ProveInit]: off.} and {.pop.}.

Cannot prove initialization, again.

2018-12-12 Thread lscrd
Hi, When trying to solve some project Euler problem, I declared something like that: import tables const N = 16 type Digit = range['0'..'9'] var counters: array[N, TableCount[Digit]] var exclusion: array[N, set[Digit]] . . . Run and got the usual wa

Re: Calling stdcall from .dll

2018-12-12 Thread awr
You're missing {.dynlib.}

Re: Experimental parallel?

2018-12-12 Thread apos80
Mostly math really.

Re: Experimental parallel?

2018-12-12 Thread mratsim
Depending on your parallel use case: * if you need data parallelism, you can use OpenMP, I wrote some helpers I find useful for [parallel tensor computations here](https://github.com/numforge/laser/blob/9fbb8d2a573d950573c7249e3a5d6cdd784a639e/laser/openmp.nim). * for task parallelism, there

Re: Experimental parallel?

2018-12-12 Thread apos80
Damn, I like parallel computation.

Re: Experimental parallel?

2018-12-12 Thread Araq
If you manage to convince the "disjoint checker" you can use it, but unfortunately the underlying `threadpool` library is also pretty unreliable. But the worst offender here is the `blockUntilAny` API which `parallel` does not use.

Experimental parallel?

2018-12-12 Thread apos80
It seems that parallel using spawn is experimental. Is it safe to use?

Re: Advent of Code 2018 megathread

2018-12-12 Thread tradfursten
I liked day 5, day 7 and day 8.

Calling stdcall from .dll

2018-12-12 Thread lightern
Hi, I'm trying to build a setup in which I could write .dll libraries that I could call from excel. Now, I've managed to make it work with C. There I have two files: 1) excelfunctions.c: #include double _stdcall square (double *x) { return *x * *x; }

Re: FOSDEM 2019

2018-12-12 Thread cdome
Thanks for reminder, it is time to book tickets and hotel. I plan to be there

Re: Nimsuggest not responding through sockets

2018-12-12 Thread trtt
I solved it: I used hasDataBuffered() and readLine() instead of just recvLine() from the net package.