<< 11-08-2015 >>

00:00:24*Jesin quit (Ping timeout: 264 seconds)
00:05:55*Jesin joined #nim
00:06:47*dalarmmst joined #nim
00:07:06*irqpal quit (Quit: Konversation terminated!)
00:09:23*drewsrem quit (Quit: Leaving)
00:12:42*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
00:13:48*bendiken joined #nim
00:15:06*Moix joined #nim
00:16:01*Moix quit (Remote host closed the connection)
00:24:16*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
00:25:22*bendiken joined #nim
00:33:17*saml_ quit (Remote host closed the connection)
00:35:49*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
00:36:41*bendiken joined #nim
00:44:44*johnsoft joined #nim
00:47:12*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
00:47:59*bendiken joined #nim
00:58:36*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
00:59:27*bendiken joined #nim
01:10:01*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
01:10:50*bendiken joined #nim
01:21:25*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
01:22:19*bendiken joined #nim
01:30:11*leru quit (Quit: Nettalk6 - www.ntalk.de)
01:30:40*CryptoToad quit (Quit: Leaving)
01:32:50*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
01:33:52*bendiken joined #nim
01:44:14*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
01:45:01*bendiken joined #nim
01:55:38*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
01:56:27*bendiken joined #nim
01:56:58*yglukhov joined #nim
02:01:05*yglukhov quit (Ping timeout: 240 seconds)
02:07:02*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
02:07:55*bendiken joined #nim
02:29:06*bendiken quit (Quit: My Mac has gone to sleep. ZZZzzz…)
02:30:07*bendiken joined #nim
02:42:29*darkf joined #nim
02:42:46*bendiken quit ()
03:27:24*pregressive joined #nim
03:51:31*Demon_Fox joined #nim
04:23:10*porglezomp quit (Quit: Lost terminal)
04:24:04*pregressive quit (Ping timeout: 265 seconds)
04:45:45*yglukhov joined #nim
04:50:05*yglukhov quit (Ping timeout: 240 seconds)
05:07:47*Jesin quit (Quit: Leaving)
05:43:17*Demon_Fox quit (Quit: Leaving)
06:12:56*xcombelle joined #nim
06:21:55*shodan45 quit (Quit: Konversation terminated!)
06:31:06*yglukhov joined #nim
06:35:34*yglukhov quit (Ping timeout: 260 seconds)
06:38:28*yglukhov joined #nim
06:44:30*EXetoC joined #nim
06:47:58*strcmp1 quit (Quit: Leaving)
06:54:55*yglukhov_ joined #nim
06:55:03federico3any way to perform readline from stdin with a timeout?
06:56:33Varriountfederico3: Not cross-platform, built-in
06:57:18federico3Linux-only?
06:57:21VarriountWindows has console functions for polling for keyboard input, *nix systems have select.
06:57:46*yglukhov quit (Ping timeout: 250 seconds)
06:58:10Varriountfederico3: http://stackoverflow.com/questions/3711830/set-a-timeout-for-reading-stdin
06:59:44VarriountAraq: How would I create a TR expression that matches against all expressions consisting of procedure calls that take a single string argument and return a single string arguement?
07:00:50Varriount`{(procIdent1|procIdent2)** a` works, but only matches against procIdent1 and procIdent2 (which is to be expected)
07:02:40*jszymanski joined #nim
07:06:10*kilon joined #nim
07:09:43*Moix joined #nim
07:19:02*yglukhov_ quit (Remote host closed the connection)
07:19:39*yglukhov joined #nim
07:29:18*thekilon joined #nim
07:36:26*dalarmmst quit (Ping timeout: 240 seconds)
07:39:09*Trustable joined #nim
07:40:16*thekilon quit (Remote host closed the connection)
07:49:29*dalarmmst joined #nim
07:54:12baabelfishhas anyone tried making immutable datastructures with nim yet?
07:54:33baabelfishones that can be used in parallel environment
07:55:52*dalarmmst quit (Ping timeout: 244 seconds)
07:57:50*kilon quit ()
08:04:33*coffeepot joined #nim
08:15:40*bjz joined #nim
08:25:04Varriountbaabelfish: You there?
08:25:54Varriountbaabelfish: I have a semi-working immutable string implementation on my laptop.
08:27:24*dalarmmst joined #nim
08:28:18r-kuisnt string immutable by default?
08:28:26Varriountr-ku: Uh, no.
08:28:40Varriountr-ku: A string is virtually the same as seq[char]
08:29:29r-kui probably mixed it up with value vs reference semantics
08:29:48Varriountr-ku: Strings and sequences have copy-on-assignment behavior though, and many string procedures return copies.
08:31:03*xificurC joined #nim
08:34:48*Arrrr joined #nim
08:38:10*dalarmmst quit (Ping timeout: 240 seconds)
08:45:26*Gonzih joined #nim
08:46:26*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
08:59:25*xcombelle quit (Ping timeout: 240 seconds)
09:05:36*tmku quit (Ping timeout: 246 seconds)
09:06:27AraqVarriount: good question, not sure if that's supported
09:06:53baabelfishVarriount: here now
09:07:39baabelfishVarriount: nice
09:08:10*Gonzih quit (Ping timeout: 260 seconds)
09:17:36*MBot joined #nim
09:21:02*Moix quit (Ping timeout: 260 seconds)
09:38:57*Matthias247 joined #nim
09:40:05*jszymanski quit (Quit: computer sleeps...)
09:55:52*BitPuffin|osx quit (Ping timeout: 250 seconds)
09:58:25gokrThere are few things I hate more than SSL certs
10:03:23coffeepotwhen you want to inline code very simple code, is there any functional difference between proc with {.inline.} and just replacing 'proc' with 'template'?
10:03:53coffeepoti guess scoping rules are different, right?
10:04:30coffeepotis it bad practice to template when you should be inlining?
10:06:37coffeepoti mean, is there anything I should know about the difference between these two routines? https://gist.github.com/coffeepots/8aa84ba8120d55730d46
10:08:49Arrrrcompiler may not inline the code with .inline., if im not mistaken
10:09:45coffeepotokay, is this because it knows when it's not advantageous to inline?
10:10:35ArrrrThat's in theory the reason. But maybe you know better.
10:10:54ArrrrAnyway, for setups i would not care (unless it was just an example)
10:13:03coffeepotyes this is hardly a performance concern, although I only put it into a separate proc for readability as it's only called once. I like to know what's what with inlining though, because when I'm doing gamedev it may matter
10:13:43coffeepoti guess I can check the C source anyway to see what's happening
10:14:33Arrrri think inline is passed to c compiler, so you will hardly see a thing. Like .noReturn.
10:14:48coffeepotah ok, that makes sense
10:17:00*UberLambda joined #nim
10:36:11*xcombelle joined #nim
10:37:34Araqcoffeepot: don't bother with it, compilers are good at inlining and we got whole-program-optimizations these days
10:38:02coffeepotdont bother with {.inline.}?
10:40:23coffeepotI have been looking at the C sources recently for my octrees and it's impressive how lean the code nim creates is - even in debug mode :)
10:44:37*irqpal joined #nim
10:47:31baabelfishAraq: does {.inline.} just add the inline keyword to C/C++ code?
10:48:18Araqwell it also ensures that the C compiler *can* actually inline it
10:49:46*bjz joined #nim
10:50:11*dalarmmst joined #nim
10:51:26baabelfishOne case where you need to inline is to get a function that returns a reference to a static variable inside it's own scope to work across translation units
10:53:36*johnsoft quit (Ping timeout: 244 seconds)
10:54:13*johnsoft joined #nim
10:55:52*Gonzih joined #nim
10:57:24*dalarmmst quit (Ping timeout: 264 seconds)
10:59:26ArrrrMan, deep copies in strings/seqs using just '=' is so dangerous.
11:01:01EXetoCyeah?
11:02:21Arrrryeah
11:05:15*irqpal quit (Quit: Konversation terminated!)
11:07:05*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
11:08:39AraqArrrr: why?
11:10:23ArrrrBecause you start using nim thinking without a reason to think that seqs or strings will work different that in any other pl
11:10:42Arrrrand then this happens.
11:11:57*Gonzih quit (Ping timeout: 255 seconds)
11:12:53Araqwhere "any other pl" means "except C++"?
11:14:04Araqyou can also program in Nim thinking that's actually consistent so '=' always copies, arrays and objects are copied on assignment too
11:14:41Araqwhich is btw why we copy strings and seqs. for consistency.
11:17:27ArrrrIs not a problem one you get used to it, but in the meantime you will forget it and do stupid things as i did, which means spending an hour finxing a thing i knew but did not recall when i wrote that line of code
11:17:54coffeepotArrrr: what happened?
11:18:25Arrrrin C# for example, a list (which is the closer thing it has to nim's seq) this deep copy does not happen
11:18:35ArrrrNothing, i forgot to shallow a thing
11:18:51Arrrr*closest
11:18:56coffeepotis ref seq[X] the same as C#?
11:19:17AraqC# has its own horror stories with structs not working properly as hash table values
11:19:18coffeepotor do you have to use that pragma to say it's shallow copy
11:20:18*Gonzih joined #nim
11:20:26Arrrri suppose with ref seq you wouldn't have that problem.
11:20:31Araqbtw I plan to map Nim's seqs and strings to std::vector and std::string
11:23:24coffeepotAraq: would this mean a change in the copy semantics of string and seq?
11:23:47*nevercast joined #nim
11:23:50Araqno, because Nim follows C++ in this aspect
11:24:00coffeepot:)
11:24:09AraqshallowCopy() and 'nil' will cause problems though
11:24:14nevercastWhat is the correct async networking API to be using at this point?
11:24:28Araqasyncdispatch
11:24:39nevercastHow experimental is experimental ?
11:24:43nevercastfa
11:24:53nevercasts/fa//
11:24:58Araqthe API is stable, dom96 is fleshing out more bugs though
11:25:08Arrrrwhy? i thought you had to use nil with shallowCopy
11:25:25coffeepotwhen you say "nil will cause problems" what do you mean? Is var: s going to default to "" instead of nil?
11:25:44Araqcoffeepot: yes, something like that
11:25:52coffeepotok
11:26:53coffeepotwon't that break code that uses a nil string to assume 'no result' as opposed to 'empty result'?
11:27:33coffeepotnot that I've ever done that myself
11:27:36nevercastWhat is the correct library to use to write out the binary representation of system types. Integers, Floating point.
11:28:11coffeepotnevercast: is the marshal module what you need maybe?
11:28:41nevercastcoffeepot, that does sound like a good start, thank you. Can the endian be changed?
11:28:55coffeepothttp://nim-lang.org/docs/marshal.html or if you just need to display the results use repr(X)
11:29:11coffeepotnevercast, sorry I don't know
11:29:24nevercastIt uses JSON. Unfortunately not what I'm looking for.
11:29:56EXetoCthere's this too http://nim-lang.org/docs/streams.html
11:29:59Arrrrstreams maybe
11:30:26Araqcoffeepot: yes, this idea needs more refinements :P
11:31:00EXetoCbut nothing for controlling the endian yet
11:31:11Araqendians.nim?
11:31:13nevercastThere is the endian lib which I can wrap it up
11:32:56coffeepotAraq: well if a string defaults to "", and a seq to @[], but people can still set them = nil or use {.noinit.} then it'll probably avoid a lot of segfaults for new nimsters but still allow you to use the nil pattern if you want
11:33:07nevercastI think endians and streams should do it. Using typed or "generic" procedures, are the invoked the way they look in the docs, write[float64](stream, 0)?
11:33:13EXetoCfor streams
11:33:26coffeepotI guess though that it's more about the internal funcs handling nil (or not handling them)
11:35:00EXetoCnevercast: or use one of the concrete implementations
11:35:12EXetoCand the type parameter for 'write' will be inferred
11:35:40ArrrrWhy doesn't nim intern strings?
11:36:06nevercastinferred is good, I don't see a concrete implementation if writeFloat64 is what you mean.
11:37:02EXetoCapparently not. it might be because of this whole float portability thing
11:37:16*Pisuke quit (Ping timeout: 246 seconds)
11:37:26*bogen left #nim (#nim)
11:37:41nevercastI also don't see wrappers for sockets -> stream.
11:38:02nevercastPerhaps it's not common to do that at a lower level. But I'm familiar with that kind of abstraction.
11:38:44ArrrrUse StringStream and get its internal buffer
11:39:23Arrrrnet module uses string to send/receive stuff
11:39:44EXetoCwell, it does abstract over byte buffers
11:39:52AraqArrrr: what is the advantage of interning strings?
11:40:21nevercastIs strings the expected approach? It's a binary network stream. Network byte order.
11:40:41EXetoCyes that seems to be the convention
11:41:06Arrrrless memory used by strings. Not that i need it
11:41:12EXetoCit's just a little annoying when printing (compared to when using seq[int8])
11:41:38*Rishavs joined #nim
11:42:07nevercastFeels unnatural to not use an array/sequence of int8
11:42:13nevercastBut if that's the expected impl.
11:43:10ArrrrI think it is safe to cast string to seq[int8]
11:43:43*dalarmmst joined #nim
11:44:08*bjz joined #nim
11:47:57Arrrrwut, try to execute this:
11:48:02Arrrrlet a = cast[seq[int8]]("ABCDEF")
11:48:17Arrrrthe compiler never finish
11:48:31EXetoCnevercast: I think so too when it involves things other than text
11:49:10nevercastEXetoC, It's great and all for Javascript as a backend. But not having a blob of bytes feels odd.
11:49:17nevercastSince Strings typically have encoding.
11:49:21coffeepotlet a = cast[ptr array[0..len, int8]]("ABCDEF") probably
11:49:52coffeepoti guess seq has header info so casting directly might mean "A" gets taken as part of header?
11:50:06EXetoCbut the length of an array is determined at compile time
11:50:24coffeepotyeah you got to use unchecked arrays if you actually need this
11:50:29EXetoCcoffeepot: a string has a header too, but I don't know if there are any guarantees
11:50:52nevercasttype missmatch there coffeepot.
11:50:55coffeepotyeah from what i recall, casting using string can get a bit funky too, which is why we have cstring
11:51:00Araqnevercast: 'string' is Nim's blob as far as I'm concerned
11:51:25EXetoCnevercast: "out of memory" for me
11:51:28nevercastAraq, no 'UTF-16' implementation in 'string', just blob?
11:51:44EXetoCcoffeepot: I do prefer to use a reasonably high upper bound
11:51:50Araqlol UTF-16
11:51:56Araqnever gonna happen
11:52:02Araqit's stupid
11:52:03nevercast^ I am okay with that.
11:52:06r-kuAraq you can lol at it as much as you want but for windows its mandatory
11:52:24coffeepotand sql server too, uses widestring
11:52:27EXetoCso as to catch mistakes
11:52:46nevercastwidestring on SQL Server feels my network captures with horrible nulls.
11:52:50nevercast*fills.
11:53:02coffeepotnevercast, EXetoC how to cast to array with no compile time len https://gist.github.com/coffeepots/999a655ac1047b21fbe4
11:53:10r-kutruth is there is no perfect encoding. therefore we need lots of encodings..
11:53:35*dalarmmst quit (Ping timeout: 256 seconds)
11:54:07nevercastcoffeepot, that looks good to me. But that is not going to play with sockets is it?
11:54:34coffeepotprobably not, no, and it's more for buffers than working with strings really
11:54:40ArrrrAraq: this line of code never returns: 'let a = cast[seq[int8]]("ABCDEF")'
11:54:43EXetoCranges like Natural go from 0 to int.high, but I often use more conservative ranges
11:55:49*dalarmmst joined #nim
11:57:07ArrrrIt has something to do with the garbage collector
11:58:40coffeepotwhy do you need to cast to int8 anyway, can't you just go through the string and take each char, which is utf8 anyway?
11:58:41nevercastI guess I can asyncnet.recv -> Future[string] -> StringStream.write -> StringStream.read, though I suspect it'll use one pointer for both read and write so I might need to overload that.
11:59:03nevercastI don't want characters, I want integers.
11:59:09nevercastfloats, int16, etc.
11:59:57coffeepotvar
11:59:58coffeepot s = "ABCDEF"
11:59:58coffeepotfor c in s:
11:59:58coffeepot echo c.int8
12:00:13coffeepotfor int16 you might need to cast tho :)
12:00:21EXetoCit's mostly necessary when printing aggregates though, which you sometimes do
12:00:48nevercastI'm unlikely to print binary (and likely gzip compressed) stream. But I do need to buffer without blocking.
12:01:11nevercastNot sure of the best way to go asyncnet -> streams. But streams does seem to provide all the read/write I'll need.
12:01:15*Gonzih quit (Ping timeout: 245 seconds)
12:01:19EXetoCthen there's the case of inspecting the values at run-time, but then again it could just show you all the different representations
12:01:31EXetoCin the form of a table
12:03:42coffeepothttps://gist.github.com/coffeepots/c88cdea439993710596e
12:03:49EXetoCnevercast: just pass the string to newStringStream; shallowly if needed
12:04:26coffeepot^ for int16 chars
12:04:29nevercastif the string contains insufficient data ? (Since networking is just that reliable)
12:04:51nevercastIt's not for int16 chars. Sorry. I don't mean characters. I mean numbers. binary encoding.
12:05:01nevercastUnless they are the same thing to nim.
12:05:32Arrrrthen make sure string is big enought. Are you going to use tcp or udp ?
12:05:38nevercasttcp
12:05:43coffeepotthe gist above will let you access them as int16 numbers, but you could cast them to int8 or byte
12:05:48EXetoCit's not only a question of reliability
12:06:08ArrrrUsually, if string is not big enough, you will need to make more reads, that's all
12:06:13coffeepotbut nim doesn't care about encoding anyway, strings are basically seq[byte]
12:06:38nevercastany edge cases I should be aware of where they are not 'basically' seq[byte] ?
12:06:38coffeepotyou can cast a char to byte IIRC
12:06:41nevercastIf not I'll carry on.
12:07:02coffeepotnim char is utf8, but indexing is done by byte
12:07:28coffeepotso if you have a multi byte char, you can access it's bytes by index
12:07:39EXetoCbut I don't see a problem. if you expect a header then you just need to attempt to read it after accumulating enough data
12:07:50coffeepotthis means if you want to process multibyte utf8 chars, use the unicode module and the runes iterator
12:08:11nevercastThere wont be any issues with strings. As strings will be length prefixed in the protocol
12:08:13EXetoCchar? utf8?
12:08:27coffeepotchar == utf8 IIRC
12:08:43coffeepotwell char == byte really
12:08:52nevercastcommon cases are packets with structure: int, short, short, byte, long, long.
12:09:02EXetoCit's not utf8 at all
12:09:17coffeepotno, it's byte sorry
12:09:19nevercastutf8 is encoding. It has special 'values'.
12:09:53nevercastSo long as string is basically byte[]. Then I see no issues using it as a binary blob object.
12:10:08coffeepotyes I believe it is just byte
12:10:10nevercastI can recv -> StringReader -> int64, without issues.
12:10:42nevercastIt was an unexpected design decision to have strings represent what is effectively a byte array.
12:10:50nevercast(char is not equal to byte in many other languages either)
12:10:56EXetoCyep, random access and no encoding enforcement
12:11:21ArrrrBut i think it was a good decission to make char 8 bits
12:11:30coffeepoti agree, char should == byte
12:11:39nevercastunlike other languages
12:11:45*nevercast looks at 16bit char in java
12:11:49coffeepotyou can put unicode into strings though, you just process it differently
12:11:53EXetoC16? -.-
12:11:55Arrrrhaha, so true nevercast
12:11:58nevercastYes.
12:12:30EXetoCnow I'm even more eager to try java
12:12:36ArrrrBut java is from the 90's, i think utf16 was hot in that time
12:12:40nevercastchar should be implemented two ways, imho. encoding-less wrapper around byte/int8.
12:12:46nevercastOr a type that is full encoding supportive.
12:13:01coffeepotchar is encodingless wrapper around byte/int8 in nim
12:13:10nevercastutf32 is a thing, a thing that a 16bit char wont handle.
12:13:42nevercastnim: char == int8 == byte
12:13:45nevercastacknowledged.
12:13:51coffeepotyou stuff your utfX into a string and all is well, then you can access each byte by index, and to see the unicode you use the rune iterator
12:14:10nevercastdisclaimer: there is no utfAnything in my project.
12:14:21nevercastIt's encoding that I'm avoiding.
12:15:08coffeepotrunes takes a string and returns Rune which is effectively utf32, and only moves forward by the number of bytes the unicode represents. So for a two byte char runes will move it's index along by two, if that makes sense
12:15:31coffeepothttp://nim-lang.org/docs/unicode.html
12:15:51nevercastThank you
12:15:54nevercastThough I do not need it :)
12:16:01coffeepotnp :)
12:16:20nevercastI only need to be sure I can hold an array of encoded system types. integers of various bit length.
12:17:33nevercastsequence vs array, array is static length? sequences is dynamic expanding?
12:17:41def-nevercast: right
12:17:42coffeepotyep
12:18:04nevercastIf so, is this implemented by reallocating new memory for the entire new size and copying the values over by pointer?
12:18:16def-right
12:18:31def-the values are copied over, but what do you mean with "by pointer"?
12:18:33EXetoCif there isn't enough capacity
12:18:37nevercastIs it best to over-allocate the sequence size if I expect it to grow in the near future
12:19:01nevercastdef-, shallow copy perhaps you would call it, I would assume a sequence holds pointers.
12:19:12nevercastThat is probably abstracted by nim's type system.
12:19:34def-nevercast: well, it's a trade-off between speed and size. if you know the size beforehand, it's of course much more efficient to set the length at the start instead of adding value by value
12:19:37EXetoCyes, but you still can't set the actual capacity
12:19:42coffeepothttp://nim-lang.org/docs/system.html#newSeq,seq[T],Natural
12:19:54Arrrrnevercast: strings in nim have nothing to do with strings in java
12:19:56EXetoCwill pre-allocating and then setting the length to 0 work?
12:20:25def-EXetoC: in my experience, yes
12:20:34*Pisuke joined #nim
12:20:44nevercastArrrr, or any other language I assume. My understanding is that string is effectively a typedef of seq[int8] with helper procedures strapped to it.
12:20:49EXetoCthat makes sense
12:21:19Arrrrthey arent immutable, and when you assign strA to strB, you are actually making a deep copy
12:21:21def-nevercast: a sequence can hold pointers, but it can also hold actual objects
12:21:47nevercastdef-, holding pointers sound less intensive during resize.
12:21:54EXetoCsince the memory can be freed simply by getting rid of all references
12:21:58nevercastI'm assuming nim does not have virtual memory and has to alloc
12:22:37def-nevercast: maybe, but you have another level of indirection
12:23:19nevercastnim leaves me with an uneasy feeling of not fully managed and not fully unmanaged. I'll get used to it with experience.
12:23:49coffeepottbh it's fully managed, the only time it's not is when you're fiddling with cast
12:24:06nevercastor using global memory for cross-thread data.
12:24:11EXetoCit's more flexible than in other languages, which can only be a good thing imo
12:24:21coffeepotyes or working across threads :)
12:24:50EXetoCand the ability to pre-allocate and control the GC at run-time further reduces the need to consider manual memory management
12:25:01nevercastIf I want a background loader to pull in 200mb, I don't want to copy that across a channel, I'd like to leave that in the same place and pass a pointer to another thread. I assume the way to do that is to avoid the GC
12:25:02coffeepotvar s: seq[MyObject] = @[]; s.add(ob1); s.add(ob2); s = nil # <- frees s
12:25:12EXetoCwhy did I join IRC again? >.<
12:25:14coffeepotand frees ob1 and ob2 if no other references
12:26:34coffeepotnevercast: I'd say you're right for cross threadding
12:26:59nevercastI am making the assumption that I should do it as described and there isn't a better practice
12:28:30coffeepotthere is a lot of work going on to make cross threading stuff. We have channels and locks etc, but the GC isn't safe over threads. Someone more knowledgable can probably tell you more, but AFAIK if you don't want to copy, you'll need to alloc0 and pass pointers
12:28:55coffeepotand use locks for multi access
12:29:06coffeepoti don't know if anyone's ported a lock free seq yet?
12:29:11nevercastI don't mind managing my own memory for large blobs of data. It's often not runtime objects but external data that needs manual alloc
12:30:02nevercastThe way I'll implement it is likely one thread has control of the data, but i'll have loaders/savers. Shouldn't need locks if done right.
12:30:17nevercastAs when the loader has completed, it surrenders the pointer to another thread and forgets it.
12:30:37coffeepotyeah, and there's always interlockedExchange too if it comes to it
12:31:39coffeepotand you need a fast lock
12:33:18nevercastNot sure of the lock system yet so can't provide feedback. I would like to have a dispatch loop as my main thread. With threads equal to the other cores doing IO.
12:33:50coffeepotmaybe you'd be interested in coroutines? I don't know if they're in devel yet
12:34:16nevercastasync/await have a similar implementation to yield/resume
12:34:24nevercastAt least by pattern, not sure about nim.
12:35:11nevercastasync and await use a Task list and ThreadPool in .NET, coroutines in Lua work on one thread, events work on one thread in Node.JS
12:35:17*UberLambda quit (Ping timeout: 252 seconds)
12:35:34coffeepotyes, last time i asked the main difference is that coroutines allow complex nesting, but it's r-ku 's baby so if you're interested, he's the guy to ask
12:35:38nevercastIt's likely any of those would work for my main thread.
12:35:50nevercastI'll investigate it :)
12:35:58EXetoCare iterators actually required to be implemented in the language now with the addition of coroutines?
12:36:15nevercastThey would be implemented by effect.
12:36:33nevercastSince that's what coroutines do in effect.
12:36:54EXetoCwhat prevented a library implementation before was the absence of working traits (still broken)
12:37:23nevercastWas it intended to be cross-thread?
12:37:39nevercastAs coroutines typically are not. They are single threads with an unwinding stack (Not recursive)
12:38:04coffeepotcoroutines as single threaded I think
12:39:22nevercastNot overly difficult to implement.
12:40:14nevercastThough I'm not sure entirely how control switching is done
12:40:24r-kusetjmp/longjmp
12:40:27nevercastI would personally go look at Lua. I might do that.
12:40:32nevercastOh..
12:40:40r-kucheck it out https://github.com/nim-lang/Nim/compare/devel...r-ku:coroutines
12:40:42nevercastYeah.. you have a lovely time.
12:41:15nevercastThat's quite the core change.
12:41:25r-kunot really...
12:41:40r-kusome gc code got moved around
12:41:41EXetoCis it actually regarded as iteration?
12:41:48r-kuonly few gc functions needed change
12:41:59nevercastEXetoC, it would work as an enumerator if that is what you mean.
12:42:25r-kuthis is what we basically needed to get coroutines to work https://github.com/nim-lang/Nim/compare/devel...r-ku:coroutines#diff-99d47b8f45928bcbfd50e23d140ac969R190
12:42:35r-kugc scanning stacks of each coroutine
12:44:13nevercastFrom the source I can read with accuracy it looks good
12:44:26nevercastI'm new to nim, but I can infer most of it.
12:45:52r-kui bet Araq would love if someone else was testing it before PR is merged
12:48:24EXetoCnevercast: it does already
12:48:47EXetoCit's just a logical extension then
12:49:09nevercastEXetoC, as far as I understand it, yes.
12:49:33nevercastr-ku, Not sure what help I can be but if you need some test code I can probably do that.
12:49:55*saml_ joined #nim
12:49:58nevercastI started on nim 3 days ago though. I'm familiar with many other languages but there is the initial language barrier
12:50:34*infinity0 quit (Ping timeout: 260 seconds)
12:51:19EXetoCI wonder if a language implementation will still be possible
12:51:24EXetoC*library
12:52:25r-kunevercast i got an impression you are looking for something like coroutines for whatever you are doing. so i just hoped you could pick that code up and use for whatever you need
12:53:48EXetoCit would only serve as a good example of the language capabilities
12:54:01*dddddd joined #nim
12:54:27nevercastr-ku, I want a main loop that takes events from IO works. Spreading the load over cores. I intend to be running this from my UDOO (armv7), which is a quad core, and save/load to the Flash/Sata should be on one core, networking on another
12:54:35nevercasts/works/workers/
12:55:24*infinity0 joined #nim
12:56:04r-kuyou can run coroutine loop on each core but coroutines themselves would have to be manually balanced between those main loops. its not a ready solution though. as you can see would require some manual implementing of things
12:56:15r-kusome higher level scheduler..
12:56:27nevercastThat's not an issue
12:56:33nevercastIf the yield and resume work.
12:56:36nevercastA scheduler is fine.
12:57:10nevercastcoroutines could actually be used for things such as alternative future/promises implementations.
12:57:14nevercastI'll find something.
12:57:28r-kusure that works. sleep works. scheduler uses os.sleep() to skip some time until next closest coroutine run in that particular scheduler. so it doesnt eat 100% of cpu either
12:57:49r-kuyeah Araq expressed desire to rebase async on new coroutines
12:57:57nevercastIt uses round-robin at the moment I guess.
12:57:59r-kubut thats probably not a close future
12:58:21r-kusomething like it. it takes into account coroutine sleep time too
12:58:47r-kuso they can get bit "reordered
12:58:48r-ku"
12:59:18nevercastdoes sleep actually call os.sleep, or does sleep yield ?
12:59:30nevercastif sleep yields, you can run another coroutine w
12:59:55*nevercast quit (Read error: Connection reset by peer)
13:01:19*nevercast-mobile joined #nim
13:01:27r-kuyou basically do coroYield(<sleep_time>). that coroutine is guaranteed not to resume before <sleep_time> seconds pass. scheduler checks sleep times of all coroutines and if there is no coroutine to run at that time it does os.sleep()
13:01:54nevercast-mobileDid I miss a thing since my last message? Computer abruptly quit for forced updates.
13:02:01r-kunop
13:02:22nevercast-mobileSchedule sounds like the expected implementation.
13:02:38nevercast-mobileos.sleep for min time till next coroutine?
13:02:52*yglukhov_ joined #nim
13:03:08r-kuexactly
13:03:23r-kuyou are better at putting it to words than i am hehe
13:03:59nevercast-mobileCoroutines sound good. Can probably build event system on this.
13:04:23nevercast-mobileyield can pass parameters and resume can pass result to yield?
13:04:54r-kuthat i did not implement but it should not be too hard
13:05:07r-kuafter all yield is already passing one value to scheduler - sleep time.
13:05:27nevercast-mobileYes. Good. Best way to implement I think
13:05:39nevercast-mobileMakes sleeping and yielding use the same "pipeline"
13:05:46*yglukhov quit (Ping timeout: 240 seconds)
13:06:26EXetoCr-ku: do you think a library implementation of coroutines would be possible?
13:06:48r-kuEXetoC nope. they require gc patch
13:07:07*dddddd quit (Ping timeout: 260 seconds)
13:07:43r-kuwell.. actually we could get away only by merging required gc bits to compiler and exposing required api for coroutines. then they could be separate lib
13:07:52r-kubut it still requires compiler modification
13:10:00nevercast-mobileWork in 5 hours. Should sleep now. I'll look at coro later tonight r-ku. Thanks for help @#nim.
13:10:14EXetoCplease come again!
13:10:30nevercast-mobileThank you. I shall.
13:10:37r-kuthanks for having an interest. good night ;)
13:10:47coffeepotyou're project sounds interesting nevercast - may ye fair well :)
13:11:17ArrrrWhat is he trying to do?
13:11:43r-ku[15:54:28] <nevercast> r-ku, I want a main loop that takes events from IO works. Spreading the load over cores. I intend to be running this from my UDOO (armv7), which is a quad core, and save/load to the Flash/Sata should be on one core, networking on another
13:11:43r-ku[15:54:35] <nevercast> s/works/workers/
13:12:26Arrrrthank you based r-ku
13:12:30*jszymanski joined #nim
13:14:31*xcombelle quit (Ping timeout: 252 seconds)
13:15:19VarriountAraq: Well, it would be a nice feature. That way this string optimization could be available to procedures other than the ones in strutils
13:22:15*saml_ quit (Ping timeout: 250 seconds)
13:24:57*UberLambda joined #nim
13:29:27*Rishavs quit (Ping timeout: 246 seconds)
13:51:40*yglukhov_ quit (Remote host closed the connection)
13:52:10*BitPuffin joined #nim
13:52:14*yglukhov joined #nim
14:03:19*Demos joined #nim
14:21:12*darkf_ joined #nim
14:24:06*darkf quit (Ping timeout: 246 seconds)
14:25:14*NimBot joined #nim
14:25:59*gunn quit (Ping timeout: 260 seconds)
14:30:52*pregressive joined #nim
14:39:05*kilon joined #nim
14:39:05*kilon quit (Changing host)
14:39:05*kilon joined #nim
14:39:18*Demos quit (Remote host closed the connection)
14:43:27*Demos joined #nim
14:50:39AraqVarriount: you could also simply add an optimization pass to the compiler
14:54:49*Demos quit (Remote host closed the connection)
14:56:04*Demos joined #nim
14:58:03*BitPuffin quit (Ping timeout: 246 seconds)
14:59:12*Gonzih joined #nim
15:01:03*NimBot joined #nim
15:02:17*Demos quit (Remote host closed the connection)
15:04:04*pregressive quit (Remote host closed the connection)
15:04:16*pregressive joined #nim
15:11:33*Demos joined #nim
15:16:15*NimBot joined #nim
15:16:34*Gonzih quit (Ping timeout: 265 seconds)
15:27:16*BitPuffin joined #nim
15:36:55*Demos quit (Remote host closed the connection)
15:39:55*MBot quit (Quit: Saliendo)
15:39:55*Demos joined #nim
15:42:26*thekilon joined #nim
15:43:25*Demos quit (Remote host closed the connection)
15:44:11*thekilon quit (Remote host closed the connection)
15:44:42*yglukhov quit (Remote host closed the connection)
15:45:08*Demos joined #nim
15:57:23*Matthias247 quit (Read error: Connection reset by peer)
16:01:41*darkf_ quit (Quit: Leaving)
16:05:12*jszymanski quit (Quit: computer sleeps...)
16:07:28*yglukhov joined #nim
16:09:08*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:11:41*yglukhov quit (Ping timeout: 250 seconds)
16:15:10*Gonzih joined #nim
16:21:07*NimBot joined #nim
16:26:15*Gonzih quit (Ping timeout: 246 seconds)
16:27:15Araqr-ku: what testing did you do for your PR?
16:40:45*FedeOmoto joined #nim
16:41:10*Arrrr quit (Quit: WeeChat 1.2)
16:44:42dom96Araq: please let me test it first
16:48:02*yglukhov joined #nim
16:49:57*yglukhov quit (Remote host closed the connection)
16:52:44*Demos quit (Remote host closed the connection)
16:54:09*Demos joined #nim
17:03:44*yglukhov joined #nim
17:05:18*NimBot joined #nim
17:07:02*Demos quit (Remote host closed the connection)
17:07:27*johnsoft quit (Ping timeout: 255 seconds)
17:08:19*NimBot joined #nim
17:09:57*Demos quit (Remote host closed the connection)
17:12:02*Demos joined #nim
17:13:51*Demos quit (Remote host closed the connection)
17:15:01*Gonzih joined #nim
17:15:17*Demos joined #nim
17:21:11*Demos quit (Remote host closed the connection)
17:21:37*Demos joined #nim
17:23:57*Demos quit (Remote host closed the connection)
17:25:34*Demos joined #nim
17:29:16*pregressive quit (Remote host closed the connection)
17:31:30*Demos quit (Remote host closed the connection)
17:31:49*Demos joined #nim
17:37:33*X67r joined #nim
17:38:12*brson joined #nim
17:39:04*NimBot joined #nim
17:39:54*CryptoToad joined #nim
17:40:33*Demos quit (Remote host closed the connection)
17:40:59*NimBot joined #nim
17:41:16*Demos joined #nim
17:45:32*Moix joined #nim
17:46:01*Moix left #nim (#nim)
17:48:04*Demos quit (Remote host closed the connection)
17:50:12*Demos joined #nim
17:55:12*strcmp1 joined #nim
17:56:54*Demos quit (Remote host closed the connection)
17:57:16*Demos joined #nim
17:58:05*jszymanski joined #nim
17:59:31*Demos quit (Remote host closed the connection)
18:02:13*Demos joined #nim
18:04:36*silven quit (Ping timeout: 264 seconds)
18:04:55*silven joined #nim
18:07:10*Gonzih quit (Ping timeout: 240 seconds)
18:09:15*elbow_jason joined #nim
18:12:49*xcombelle joined #nim
18:16:04*rollo joined #nim
18:22:19*Demos quit (Remote host closed the connection)
18:31:45*NimBot joined #nim
18:32:50*UberLambda quit (Ping timeout: 250 seconds)
18:33:57*pregressive joined #nim
18:37:36*Sahnvour joined #nim
18:42:26*BitPuffin quit (Ping timeout: 260 seconds)
18:45:35*xcombelle quit (Remote host closed the connection)
18:51:48*yglukhov quit (Remote host closed the connection)
18:53:14*yglukhov joined #nim
18:56:20*NimBot joined #nim
18:57:50*nevercast-mobile quit (Ping timeout: 240 seconds)
18:58:01*nevercast-mobile joined #nim
18:59:11*NimBot joined #nim
19:03:24*nevercast-mobile quit (Ping timeout: 244 seconds)
19:03:52*Demos joined #nim
19:04:42*X67r quit (Ping timeout: 265 seconds)
19:07:49*rollo quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
19:11:44*X67r joined #nim
19:19:01*NimBot joined #nim
19:28:00*yglukhov quit (Remote host closed the connection)
19:28:19*yglukhov joined #nim
19:34:01*yglukhov quit (Remote host closed the connection)
19:34:15*yglukhov joined #nim
19:36:32*yglukhov quit (Remote host closed the connection)
19:44:29*yglukhov joined #nim
19:54:01*Demos quit (Remote host closed the connection)
19:57:07*Demos joined #nim
19:58:58*Kingsquee quit (Ping timeout: 260 seconds)
20:15:29*Matthias247 joined #nim
20:20:32*Demos quit (Remote host closed the connection)
20:26:31*Demos joined #nim
20:28:15*Demos quit (Remote host closed the connection)
20:28:39*Demos joined #nim
20:33:35*key_ quit (Quit: Konversation terminated!)
20:38:19*kilon quit ()
20:41:34*Demos quit (Remote host closed the connection)
20:47:00*Demos joined #nim
20:49:23*Demos quit (Remote host closed the connection)
20:49:38*Demos joined #nim
20:52:59*Demos quit (Remote host closed the connection)
20:53:12*CryptoToad quit (Ping timeout: 264 seconds)
20:53:49*CryptoToad joined #nim
20:54:02*jszymanski quit (Quit: computer sleeps...)
20:56:00*Demos joined #nim
20:58:43*Demos quit (Remote host closed the connection)
21:06:01*xificurC quit (Ping timeout: 246 seconds)
21:15:36*Trustable quit (Quit: Leaving)
21:17:47*Demos joined #nim
21:19:44*NimBot joined #nim
21:23:30*Demos quit (Remote host closed the connection)
21:24:05*johnsoft joined #nim
21:26:50*NimBot joined #nim
21:29:33*Demos joined #nim
21:31:26*wuehlmaus joined #nim
21:33:34*Demos quit (Remote host closed the connection)
21:34:25*gokr quit (Ping timeout: 256 seconds)
21:37:26*NimBot joined #nim
21:38:00*gokr joined #nim
21:39:07*Jehan_ joined #nim
21:43:35*xet7 quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com ))
21:44:58*pregressive quit (Remote host closed the connection)
21:51:18*Demos joined #nim
21:55:23*yglukhov quit (Remote host closed the connection)
21:56:26*Demos_ joined #nim
22:00:58*yglukhov joined #nim
22:05:44*yglukhov quit (Ping timeout: 272 seconds)
22:05:45*EXetoC quit (Ping timeout: 246 seconds)
22:07:04*NimBot joined #nim
22:20:22*MyMind joined #nim
22:20:36*BitPuffin|osx joined #nim
22:20:59*Sahnvour quit (Read error: Connection reset by peer)
22:21:16*X67r quit (Quit: leaving)
22:22:55*Pisuke quit (Ping timeout: 245 seconds)
22:27:48*NimBot joined #nim
22:36:37*NimBot joined #nim
22:38:29*Demos_ quit (Remote host closed the connection)
22:38:45Demosis oldwinapi depricated?
22:39:16*Demos_ joined #nim
22:39:51*Demos_ quit (Remote host closed the connection)
22:41:26*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:45:21AraqDemos: no, just old
22:45:36Araqsince the new wrapper doesn't exist yet
22:45:42DemosOK
22:45:43Araq Varriount?
22:45:51Demosnobody likes windows.h
22:45:52*Kingsquee joined #nim
22:45:54Demosit's a blight
22:59:34*Kingsquee quit (Read error: Connection reset by peer)
22:59:39*CryptoToad quit (Read error: No route to host)
22:59:42*Kingsquee joined #nim
23:08:49*Demos_ joined #nim
23:09:35*silven quit (Ping timeout: 260 seconds)
23:09:50*NimBot joined #nim
23:09:54*silven joined #nim
23:12:44*Raimondi quit (Quit: The road to wisdom?—Well, it's plain and simple to express: Err and err and err again, but less and less and less. — Piet Hein)
23:13:07*Raimondi joined #nim
23:18:44*Demos_ quit (Remote host closed the connection)
23:38:43*Pisuke joined #nim
23:38:48*MyMind quit (Ping timeout: 264 seconds)
23:43:05*Jehan_ quit (Quit: Leaving)
23:54:51Demoshm that bug where types in type sections can't depend on each other if the type section is over 500ish lines is still around