Re: How to compile and run a Nim program on the Android?

2019-03-29 Thread mashingan
Your phone must be root-ed to do that.

Re: Owned refs

2019-03-29 Thread boia01
I'm wondering how this new proposal relates to the previous effort described at [https://nim-lang.org/araq/destructors.html](https://nim-lang.org/araq/destructors.html) My understanding is the "destructors" proposal helps to significantly reduce ref usage, and the new proposal gets rid of the

Nimbus testnet launch

2019-03-29 Thread arnetheduck
Hey ho - we've been quietly building away over at Status, and are pretty happy to announce a first public test network for what will become the next version of Ethereum, one of the block chains out there:

Re: Creating C array

2019-03-29 Thread trtt
I'm not sure if I'm fit to improve the docs because I'm not good enough with nim's internal things and not good with english either. Maybe I'll try when I become better with either of them ;)

Re: Creating C array

2019-03-29 Thread cblake
You're welcome. Nim core devs are **_very_** willing to work with any and all comers on pull requests to improve documentation. Ignorance by otherwise reasonably patient and resourceful newcomers is **_not_** easy to simulate (in any project, really). In some ways it's a resource that decays

Status / Decision for seqUtils overhaul?

2019-03-29 Thread ggibson
I ran across this thread while searching for various functionality, and wondering where to submit a PR if I add some. [Changes in sequtils (forum post)](https://forum.nim-lang.org/t/1333) I'm curious if anyone knows if these suggested changes and additions are still under consideration, or if

Re: Creating C array

2019-03-29 Thread trtt
Thank you! I wish the docs had mentioned this - [https://nim-lang.org/docs/backends.html](https://nim-lang.org/docs/backends.html)

Re: Creating C array

2019-03-29 Thread cblake
Nim defines a proc allocCStringArray*(a: openArray[string]): cstringArray Run in the `system` module (no need to explicitly `import` it). There is also a corresponding: proc deallocCStringArray*(a: cstringArray) Run You probably want to

Re: Creating C array

2019-03-29 Thread trtt
Corrected: proc kget*(elems: seq[string]): string = var arr: CArray[cstring] arr[0] = "start" var i = 1 for elem in elems: arr[i] = elem i += 1 var size: cint = cast[cint](elems.len() + 1) return $fn(size, addr arr)# tried it

Re: Creating C array

2019-03-29 Thread trtt
When I load the array manually, it works(somewhat): var arr: CArray[cstring] arr[0] = "start" arr[1] = "arg1" arr[2] = "arg2" arr[3] = "arg3" arr[4] = "arg4" echo $fn(5, unsafeAddr arr) Run the C library works _correctly_ and the logs show good

Creating C array

2019-03-29 Thread trtt
Hi > How to create and pass an array of string to nim and pass it to C? type CArray{.unchecked.}[T] = array[0..0, T]#found it on the forum proc fn(argc: cint, args: ptr CArray[cstring]): cstring {.importc, dynlib: "...".} Run I tried this but got *** stack

The Nim Language Manual

2019-03-29 Thread Sebastian_Adil
>From "nim-doc.deb" package, I converted: HTML -> Asciidoctor -> Asciidoctor-pdf(in terminal) -> PDF and I get a nice PDF book

Re: How to compile and run a Nim program on the Android?

2019-03-29 Thread mrhdias
Not work :-( $ adb push test /storage/sdcard0/Download/test $ adb shell chmod a+x /storage/sdcard0/Download/test Bad mode $ adb shell 10|shell@android:/ $ chmod 0755 /storage/sdcard0/Download/test Unable to chmod /storage/sdcard0/Download/test: Operation not

Re: closure_methods: OOP purely based on closures

2019-03-29 Thread bluenote
I didn't know that this can be solved by forwarding from one macro to another, will try that, looks really nice. I will experiment a bit more regarding the field accessors when I'm back from vacation. Overall this has a bit lower priority to me, because the use cases I have barely require

Re: How to compile and run a Nim program on the Android?

2019-03-29 Thread mratsim
Not familiar with android but you probably need `chmod a+x /storage/sdcard0/Download/test`

How to compile and run a Nim program on the Android?

2019-03-29 Thread mrhdias
I tried to compile a test program following the steps indicated in this [post](https://forum.nim-lang.org/t/1866#11698), but it does not work. $ nim c --cpu:arm64 --passC:-fPIE --passL:"-fPIE -pie" test.nim $ adb devices List of devices attached 42044158c4bc8100

Re: Owned refs

2019-03-29 Thread bpr
This looks very promising! I haven't had time to dig into the details, and I'll probably wait until there's an implementation to try. Chapel is now using something vaguely [similar](https://www.chapel-lang.org/docs/language/evolution.html#readme-evolution-class-memory-management). I'm looking

Re: closure_methods: OOP purely based on closures

2019-03-29 Thread gemath
> Counter of SomeBaseClass would require an untyped argument, and I don't think > it would be possible to access the type impl in this case. Would this help? It generates a call to a macro which takes the base class type as a typed arg: import macros type B = object

Re: closure_methods: OOP purely based on closures

2019-03-29 Thread gemath
Another way around this is overloading dot operators. Apparently this now works without the `{.experimental: "dotOperators".}` pragma: type Obj = ref object getStep: proc(): int setStep: proc(x: int) template `.`(o: Obj, f: untyped): untyped = (o.`get

Re: closure_methods: OOP purely based on closures

2019-03-29 Thread adrianv
for property access you can use a distinct type and for assignment an operator like := type Obj = ref object fStep: int ObjStepProperty = distinct Obj template step(self: Obj): ObjStepProperty = self.ObjStepProperty proc `:=` (self: