<< 08-07-2015 >>

00:06:28*BitPuffin|osx joined #nim
00:09:24*X67r_ quit (Quit: leaving)
00:25:38*drewsrem quit (Quit: Leaving)
00:53:43*jaco60 quit (Ping timeout: 256 seconds)
01:07:03*umurgdk joined #nim
01:10:01*Guest27764 quit (Quit: Leaving)
01:11:13*elbow_jason quit (Remote host closed the connection)
01:11:17*umurgdk quit (Ping timeout: 240 seconds)
01:24:07*strcmp2 joined #nim
01:26:35*strcmp1 quit (Ping timeout: 252 seconds)
01:38:40*pregressive joined #nim
01:47:22*nvs7_ joined #nim
01:47:41*nvs7_ left #nim ("Leaving")
01:53:14*vasher_ joined #nim
02:00:36*vendethiel quit (Ping timeout: 276 seconds)
02:06:02*vendethiel joined #nim
02:14:15*pregressive quit (Ping timeout: 252 seconds)
02:19:36*gyeates quit (Ping timeout: 264 seconds)
02:27:18*zach_ joined #nim
02:29:28zach_Question about case insensitivity in Nim: I understand that cases don't matter, but for things like documentation and example code, I frequently see camel case. Is that the best practice, or is the community kinda ok with doing whatever you want if you're making a library? I know it's mostly a matter of taste, but I'm kinda used to using underscores to divide words in code
02:35:10*darkf joined #nim
02:38:12fowlzach_, X_X is the same identifier as Xx
02:38:39fowlaraq calls it style insensitivity
02:38:54fowlthe case sensitivity we have is "partial", it only applies to the first letter of the identifier
02:39:03fowlso x_x is the same identifier as xX
02:39:08fowlbut different than Xx
02:45:57Varriount_zach_: https://github.com/nim-lang/Nim/wiki/Style-Guide-for-Nim-Code
02:46:24*Varriount_ is now known as Varriount
02:46:50Varriountzach_: And before you get all outraged by the case-sensitivity rules, know that they work surprisingly well.
02:48:05VarriountMultiple styles can coexist together, which is good, with the number of C bindings Nim has.
02:48:27zach_Oh I love the idea of the case-sensitivity rules
02:48:51zach_I just want to not be hated if I go with non_camel_case for my blog examples / libraries I write
02:49:45zach_Although it looks like the style guide defaults to camelCase as the default style
02:53:13*elbow joined #nim
02:54:12Varriountzach_: Feel free to use whatever style you want.
02:54:36Varriountzach_: The style guide is enforced for the standard library, but it's only a suggestion for others.
02:55:47*umurgdk joined #nim
02:58:12zach_ok thanks!
03:00:08*umurgdk quit (Ping timeout: 250 seconds)
03:09:15*zach_ left #nim ("Leaving")
03:17:36*gyeates joined #nim
03:26:48*BitPuffin|osx quit (Ping timeout: 264 seconds)
03:32:38*vendethiel quit (Ping timeout: 250 seconds)
03:33:30*vendethiel joined #nim
03:42:31*gyeates quit (Ping timeout: 246 seconds)
04:19:59*vendethiel quit (Ping timeout: 265 seconds)
04:21:58*vendethiel joined #nim
04:37:27*FedeOmoto quit (Quit: Leaving)
04:38:16*milosn quit (Quit: Lost terminal)
04:44:38*umurgdk joined #nim
04:49:27*umurgdk quit (Ping timeout: 256 seconds)
04:58:17*ioctl_ quit (Quit: Lost terminal)
04:58:49*vasher_ quit (Quit: Connection closed for inactivity)
05:32:49*vendethiel quit (Ping timeout: 264 seconds)
05:34:32*vendethiel joined #nim
05:44:46*EXetoC quit (Ping timeout: 248 seconds)
05:50:58*EXetoC joined #nim
05:55:43*Kingsquee joined #nim
06:08:07*johnsoft joined #nim
06:54:23*ChrisMAN quit (Ping timeout: 252 seconds)
07:12:13*Trustable joined #nim
07:13:34*umurgdk joined #nim
07:30:01*umurgdk quit (Remote host closed the connection)
07:31:41*umurgdk joined #nim
07:33:22*woadwarrior joined #nim
07:38:09*umurgdk quit (Ping timeout: 265 seconds)
07:44:25*johnsoft quit (Ping timeout: 246 seconds)
07:45:03*johnsoft joined #nim
07:57:59*dgellow joined #nim
07:59:49dgellowcan I use a tuple as a hashmap (or dictionary in some language) ?
08:03:27dgellowI just want to iterate on key/value pairs
08:04:24EastByteyou could simply use a hash table: http://nim-lang.org/docs/tables.html
08:09:45*coffeepot joined #nim
08:10:32*yglukhov__ joined #nim
08:12:20dgellowEastByte: Yeah, that's what I am looking for. Thank you.
08:20:17*jszymanski joined #nim
08:32:34*Arrrr joined #nim
08:32:58ArrrrHello, is there a way to print the ast of a defined proc ?
08:34:36ArrrrHello, is there a way to print the ast of a defined proc ?
08:34:41Arrrrops, sorry.
08:37:07ArrrrOk, dumpTree, i found it
08:39:26federico3any plan for the new release? :)
08:42:47AraqVarriount: "The style guide is enforced for the standard library, but it's only a suggestion for others." we really needs this and the style guide on the website
08:43:12*xcombelle joined #nim
08:43:25Araqfederico3: meh I dunno
08:46:39dgellowI have this error `Error: type mismatch: got (tuple[name: string, value: string, desc: string]) but expected 'ConfigField'`. ConfigField is defined as `type ConfigField = tuple[name: string, desc: string, value: string]`. Do you have an idea why those types mismatch ?
08:47:12Araqif you use field names they need to agree
08:47:30dgellowah ! order is important ?
08:47:42dgellowso, why the named field ?
08:50:28ArrrrBecause someone started it and thought "ok, i'll finish this for 2.0, maybe"
08:51:22Araqhrm?
08:52:49Araqdgellow: so should the compiler re-order the fields behind your back *even though* a tuple is naturally ordered?
08:53:08Araqif you don't want the order, use an object
08:54:11dgellowAraq: Yeah, I understand now. I made a false asumption based on other languages I work with.
09:00:30*johnsoft quit (Ping timeout: 248 seconds)
09:00:58*johnsoft joined #nim
09:04:52*xcombelle quit (Remote host closed the connection)
09:08:29*woadwarrior quit (Quit: My Mac has gone to sleep. ZZZzzz…)
09:10:53r-kuAraq: i figured out frames stuff me thinks
09:11:09r-kuat least now testcase exits properly and seems to track frames fine ^_^
09:11:40r-kuhardest thing left figuring out why gc doesnt love main app stack any more
09:16:06dgellowI have another noob question for you guys.
09:16:32dgellowvar
09:16:32dgellow fields = @[(name: "sam", value: ""),
09:16:33dgellow (name: "andre", value: ""),
09:16:33dgellow (name: "sarah", value: "")]
09:16:33dgellowfor field in fields:
09:16:34dgellow field.name = stdin.readLine() # Error: 'field.name' cannot be assigned to
09:17:16Arrrrmitems
09:17:23dgellowmutable items
09:17:25dgellowthanks
09:17:49dgellowah yeah! for with only one arg call items
09:19:38ArrrrI suppose this is not possible in nim: "class A<T> { void a(t T) {/*...*/} }"
09:21:21AraqArrrr: c2nim can translate template <typename T> class A { void a(T t); }
09:22:57ArrrrWhat is the result?
09:23:23ArrrrIt was java, but anyway.
09:24:03r-kuAraq: please run this https://glot.io/snippets/e554vu46jc and tell me if its my fuckup or bug. i got a feeling its bug but want to make sure before making bug report with giant macro code
09:24:36*xcombelle joined #nim
09:25:33Araqso ... you think it's less work for me without a proper bug report?
09:26:48r-kui just want to make sure if its really a bug
09:26:50*umurgdk joined #nim
09:27:05r-kubut i suppose compiler (gcc) errors should never be possible right?
09:27:05*yglukhov___ joined #nim
09:28:07Araqer ... kinda
09:28:13Araqbut yeah it's a bug
09:29:12r-kuokie, ill see if i can narrow it down
09:29:43Araqno, don't mess with constructors. give me my proper coroutines
09:30:15r-kuuncle sam wants constructors, i must obey :(
09:30:21r-kuand im stuck with coroutines for the moment :p
09:30:47*yglukhov__ quit (Ping timeout: 240 seconds)
09:30:48*umurgdk quit (Remote host closed the connection)
09:30:52r-kui got a feeling string gets gc'ed before echoing if main stack is added to gc
09:31:00r-kubut it makes no sense
09:31:14*infinity0 quit (Remote host closed the connection)
09:31:19*yglukhov___ quit (Ping timeout: 252 seconds)
09:31:21*infinity0 joined #nim
09:31:29*woadwarrior joined #nim
09:31:39Araqbtw the 'custom_new' bug is hard to fix
09:32:02Araqin fact
09:32:10r-kuwhere would be fun if it was easy ;) any workaround available for it maybe?
09:32:27AraqI don't think this will work, instead we need to get rid of new with finalizer
09:32:39*umurgdk joined #nim
09:32:40Araqand replace it by proc `=finalize`()
09:32:58r-kuoh that sounds awesome
09:33:45r-kui can already imagine =finalize() calling =destroy(), having =destroy() basically cover both cases for object destruction. that be awesome
09:34:29*strcmp2 quit (Ping timeout: 256 seconds)
09:36:59*yglukhov___ joined #nim
09:39:30r-kui hate to ask but within what timeframe we can expect to get =finalize?
09:40:17Araqbah, just implement it, I can tell you how
09:42:32r-kui bet its just as easy as coroutines :D
09:42:48Araqnah, easier, I think
09:43:04fowlDo ittt plz
09:43:06r-kuwell do tell, ill save that info for the time when im terminally stuck w/ gc :D
09:43:55Araqcompiler/semstmts, edit semOverride
09:44:09Araqadd a new field finalizer* to the TType in ast.nim
09:44:32Araqlook at how deepcopy is implemented
09:44:42Araqwhere it's used and instantiated
09:45:01Araqcause `=finalize` needs to works with generics too
09:45:08Araqso that's a slight complication
09:45:20Araqbut actually just grep for "deepcopy"
09:45:40Araqit's all there for it
09:45:47Araqgeneric instantation magic
09:46:00*vasher_ joined #nim
09:46:00Araqcodegen type info slot
09:49:00*Kingsquee quit (Quit: Konversation terminated!)
09:51:08r-kusaved. btw Araq dont you think =finalize and =destroy kind of do exact same thing? is it not wasteful to have both? ofc in my macro i would work it around but still
09:51:40Araqno, =finalize is well defined and =destroy is not
09:52:23Araqfinalize is battle tested and works, destroy doesn't even work with overloaded assignment for now
09:53:28r-kubut when eventually it does work there will be this awkward moment where two identical destructors are being defined for one type
09:54:51Araqseems much worse to conflate the 2 only to find out that it cannot work
09:55:31Araq"Warning: Ignoring '=finalize' because you already defined '=destroy'." is much easier to do in the long run
09:56:15*jaco60 joined #nim
09:56:41r-kuand if no =finalize exits then =destroy(x[]) used in place of finalize?
09:57:59Araqmeh nah
09:59:01Araqperhaps but it feels wrong
09:59:06r-kuthen i dont quite understand meaning of warning
09:59:48AraqI don't know ok? :P
10:00:06Araqbut having 2 things for 2 different mechanisms is surely not wrong
10:00:32Araqand having only 1 for 2 is much more dangerous
10:06:04*yglukhov____ joined #nim
10:06:04*yglukhov___ quit (Read error: Connection reset by peer)
10:06:37*yglukhov____ quit (Remote host closed the connection)
10:07:08*yglukhov____ joined #nim
10:10:54*umurgdk quit (Remote host closed the connection)
10:23:08*umurgdk joined #nim
10:26:02*EXetoC quit (Ping timeout: 250 seconds)
10:30:46r-kuhah Araq that main stack problem was actually very simple problem.. and you (i think) hinted me a fix even. setStackBottom() had c_fprintf() call. and since GC_addStack() did some debug echoing it crashed the thing. apparently it was too early to do echoing. so changing echo to c_fprintf() in GC_addStack() made it magically work.
10:30:52r-kuso now the thing appears to be working
10:31:31r-kuyou should review changes to markStackAndRegisters() and make sure i did not break then thing
10:31:33r-kuhttps://github.com/nim-lang/Nim/compare/devel...r-ku:coroutines
10:31:58*umurgdk_ joined #nim
10:35:24*umurgdk quit (Ping timeout: 276 seconds)
10:39:32*umurgdk_ quit (Remote host closed the connection)
10:57:54*raza joined #nim
11:17:46*zahary1 joined #nim
11:17:46*zahary quit (Read error: Connection reset by peer)
11:18:34*umurgdk joined #nim
11:31:23*Arrrr quit (Quit: WeeChat 1.2)
11:38:05*gunn quit (Quit: Textual IRC Client: www.textualapp.com)
11:38:30*gunn joined #nim
11:43:19*aziz joined #nim
11:46:55*johnsoft quit (Ping timeout: 246 seconds)
11:47:16*johnsoft joined #nim
11:48:49*vasher_ quit (Quit: Connection closed for inactivity)
12:04:29*woadwarrior quit (Quit: Textual IRC Client: www.textualapp.com)
12:41:23*xcombelle quit (Remote host closed the connection)
12:43:38*strcmp1 joined #nim
12:59:58*Learath2 quit (Ping timeout: 248 seconds)
13:00:20*jj2baile quit (Ping timeout: 252 seconds)
13:00:26*jj2baile joined #nim
13:01:25*Learath2 joined #nim
13:06:14*sepisoad joined #nim
13:06:41sepisoadcan i write something like this in nim?
13:06:59sepisoadvar value = json["id"].str or ""
13:07:27sepisoadso in case json["id"].str returns nil "" goes to value
13:07:32*arnetheduck joined #nim
13:12:49*umurgdk quit (Remote host closed the connection)
13:16:42sepisoadok i found some workaround
13:16:51sepisoadlike this:
13:17:30sepisoadvar value = if nil == json["id"]: "" else: json["id"].str
13:19:23def-sepisoad: like this? https://gist.github.com/def-/f044fae89036abbf66a9
13:20:08sepisoadyes
13:20:22def-but just using .str already fails because j["id"] is nil when there is no "id" in it
13:21:03sepisoadyes
13:21:09sepisoadthat was my main concern
13:21:17def-Updated it to be json specific but work
13:21:26sepisoadtrying to stringify a nil would crash
13:21:42sepisoadanyways it's still nice
13:21:58def-nono, it's not about stringifying a nil, it's about accessing the str field of a nil
13:22:08sepisoadcorrect
13:22:19sepisoadaccessing nil
13:22:23sepisoadmy mistake
13:22:55def-If you make `or` generic it could actually be nice, so you don't have to specify the type of what you want out, but instead specify the default value, and by that default value the type is inferred
13:24:05sepisoadyup ;)
13:24:22def-not sure it's worth it, probably easier to just write 5-6 `or` procs
13:37:22*BitPuffin joined #nim
13:47:58*umurgdk joined #nim
13:51:35*umurgdk quit (Remote host closed the connection)
14:00:03*pregressive joined #nim
14:13:02*lokulin quit (Ping timeout: 264 seconds)
14:14:33*drewsrem joined #nim
14:28:07*umurgdk joined #nim
14:31:16*lokulin joined #nim
14:41:04*anthgur joined #nim
14:57:20*EXetoC joined #nim
15:01:09*yglukhov_____ joined #nim
15:01:37*shevy joined #nim
15:01:40*shevy left #nim ("I'll be back ... maybe")
15:02:58*yglukhov_____ quit (Client Quit)
15:04:26*yglukhov____ quit (Ping timeout: 256 seconds)
15:09:58*ChrisMAN joined #nim
15:10:31*saml quit (Remote host closed the connection)
15:12:59*saml joined #nim
15:20:09Araqr-ku: well how about using an external assembler?
15:21:06r-kuthat would work if someone implements it ;)
15:23:53*vasher_ joined #nim
15:24:04r-kui would just have to rewrite that asm a bit, stick it into a call
15:24:13r-kufix stack magic etc
15:25:17Araqfurther directions: Port this to the refc GC
15:25:53r-kuafter i clean it up cause now its a mess
15:26:58r-kubtw Araq why did you tell me to loop stacks in markStackAndRegisters()? is it not enough to scan current active stack? whenever allocations happen on other stacks gc will run there. i dont see much point in looping all of stacks all the time. unless im not aware of something
15:27:54Araqwell that's not how a non-incremental mark-and-sweep GC works at all
15:28:27Araqin this GC setting there is only "alive now" and "dead"
15:28:43Araqand if you don't mark it, it's dead.
15:29:02Araqso everything that's only referenced from yielded stacks would be declared "dead".
15:29:33r-kuhmm i see, now it makes sense
15:31:00Araqhowever what you describe would work for the refc'ing GC
15:31:29Araqbut I don't think enforcing a GC collection on every "yield" is wise either
15:32:37r-kubtw did you review my changes? somehow i get a feeling youll be merge-happy and shit will break again :p
15:32:56AraqI only skim things
15:33:19Araqreading is rather hard, I tend to avoid it
15:34:11Araqbut seriously, it's not an official PR yet :P
15:34:19r-kumakes me wonder if you picked wrong profession then ;) nah but rly. I64 PR was awesome. shit worked and tests passed (!!) and still it was bad thing to do lol
15:34:42r-kuwe need code-review slaves.
15:35:35Araqas long as we spend an enormous amount of work on the official releases (and we do...) things are IMHO just fine
15:36:26*umurgdk quit (Remote host closed the connection)
15:38:20AraqI don't develop with "gcc from origin master" either
15:42:55drewsremIs it discouraged to build ASTs in macros by concatenating strings together and then parseStmt'ing them?
15:52:34Araqyes, it sucks
15:52:49Araqsometimes it's unavoidable
15:57:08*johnsoft quit (Ping timeout: 256 seconds)
15:57:41*johnsoft joined #nim
16:00:11*gyeates joined #nim
16:00:14drewsremJust seems really comfortable to use
16:01:22*Ven joined #nim
16:01:45Araqwell the same applies what I said about LLVM
16:02:24drewsremNamely? - I missed that
16:02:31Araqwhen generating the textual representation is more convenient than using the API you expose, you know your API sucks
16:04:45drewsremhmmm... I think it's more like you already have to know the textual representation in order to use the language at all, so you're naturally always going to be more familiar with it
16:05:33Araqgenerate foo(bar, baz, boo)
16:05:59Araqyou need a comma after the first and the second, but not after the third argument
16:06:37Araqyou need to ensure you got the quoting rules right, so that "xyz" produces "\"xyz\""
16:07:19drewsremtrue, this can easily become more complex then it needs to be
16:07:45Araqand that's just the ordinary call
16:08:04Araqadd "indentation based syntax" on top of it and it quickly becomes a PITA
16:08:42Araqyou construct trees, so use a trees based API, not string concats
16:09:42EXetoCtrees are cool
16:10:24Araqalso when you have (a+b)*c as a tree and produce a string you need to emit the () or else subtle bugs arise
16:12:11Araqstring based programming -- slow, fragile, bug-prone. (Hi, Unix!)
16:13:10*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:13:42drewsremWhy did you say its sometimes unavoidable tho?
16:14:27Araqwhen you extract Nim code out of a string for a string interpolation library:
16:14:35Araqecho "foo {nim code here} bar"
16:14:55Araqyou really want to use the compiler's parser for the "nim code here" substring
16:16:18drewsremah makes sense
16:19:18*rgv151 joined #nim
16:20:46rgv151anybody know why AsyncSocket state is not closed by defaut?
16:21:00rgv151https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncnet.nim#L73
16:22:35*Arrrr joined #nim
16:22:37rgv151`isClosed` proc returns `true`, even I didnt make a connection yet
16:23:47Araqsounds right to me?
16:24:02Araqit starts as closed until you open a connection?
16:24:47rgv151it's `false` by default, and I think it should be `true`
16:24:54*dewdrop quit (Ping timeout: 256 seconds)
16:25:43EXetoCno connection has been established at that point
16:26:40rgv151I didnt open a connection yet, and isClosed returns false
16:27:00*Jesin joined #nim
16:27:26rgv151in that case, I can't deterine socket is already connected or not
16:27:41EXetoCyou said it returned true, which confused me
16:28:10rgv151sorry, my bad
16:28:14EXetoCfalse as the initial state does indeed seem wrong
16:28:59Araqthe flag should be isOpen
16:30:01rgv151how to determine if a socket is connected?
16:30:34EXetoCit's false at first and is then only modified when calling 'close' apparently
16:32:52dgellowhow can I convert a seq into an array ?
16:33:10Araqyou cannot
16:33:32*xtagon joined #nim
16:33:41Araqexcept for the manual a[i] = s[i] for all i, possibly hidden in a macro
16:33:53dgellowokay
16:33:55EXetoCwhat about slice assignment?
16:34:54Araqslices return seqs
16:36:20*vbtt joined #nim
16:36:36rgv151once we close a socket, isClose will always return true, even when we open another connection
16:37:57*milosn joined #nim
16:40:34Araqrgv151: please make a real bug report
16:41:24rgv151I just want to make sure it's a bug or not. I can fix it
16:41:47Araqwell dom96 decides
16:41:55Araqbut to me it looks like a bug
16:41:55EXetoCdgellow: arr[0^1] = ...?
16:42:06rgv151ok, thx
16:42:20EXetoCAraq: []=
16:43:39EXetoCoops
16:44:02EXetoC0..^1 (0..arr.high)
16:45:25ArrrrIt would be a fantastic project to have some kind of visual macro builder
16:48:11AraqArrrr: just use templates and getAst. Still my favourite tool. :-)
16:48:30Araqbbl
16:49:37*zahary_ joined #nim
16:53:52EXetoCa lot of things would be great to have :p
16:56:06*xtagon quit (Read error: Connection reset by peer)
16:57:53EXetoCwith that said, it's very easy to create macros after a little bit of trial and error
16:58:59EXetoCArrrr: do it :p
16:59:32ArrrrYes, im exactly with a some bits of trials and a lot of errors
16:59:38ArrrrBut little by little ..
17:00:17EXetoCalso, have you read the various macro tutorials?
17:00:55ArrrrNot a single one, and i didnt know there were any, but i'm reading the source code of the OOP macro, and the one that Andrea uses for variants
17:01:19Learath2while debugging nim code how would i go about printing a nim string
17:01:42*darkf quit (Quit: Leaving)
17:01:58EXetoCArrrr: speaking of OOP macros: https://nim-by-example.github.io/oop_macro/
17:02:29ArrrrYes, im exactly in that page
17:02:40ArrrrIt is well documented
17:02:50ArrrrLearath2: you mean echo "blabla" ?
17:03:49EXetoCI think he means when executing the program using a debugger
17:04:09Learath2nah suppose i have var x = "I like cake" how would I go about getting :"I like cake" while breaked in gdb
17:04:45Arrrrisnt debugging like in any other program compiled with c ?
17:05:30EXetoCwell, a string in nim is a length followed by a pointer
17:06:29EXetoCI dunno if there's support for it
17:10:35EXetoCare the steps necessary for proper debugging documented anywhere?
17:11:24def-Learath2: let's see, that should be easy
17:12:13Learath2tried examining it gave me a weird structure that starts with a 0x08 and many 0x00 then my string
17:12:21*Jesin quit (Quit: Leaving)
17:13:12EXetoCyep, length + pointer... no wait, there's the capacity too
17:15:28def-Learath2: looks good: https://gist.github.com/def-/778ade3ef78a1da7a071
17:15:43def-The main pitfall was having to continue once
17:17:13*Jesin joined #nim
17:19:49*anthgur quit (Quit: My Mac has gone to sleep. ZZZzzz…)
17:21:32dom96rgv151: Araq: well... that's a tough one. When you create a socket it has not been "closed".
17:21:34dom96It was never opened.
17:21:50dom96So isClosed returning true doesn't make sense
17:24:16*anthgur joined #nim
17:25:23Araqdom96: hence the rename to isOpen
17:25:32Araqdef-: since 0.11.2 you can just use --debugger:native
17:25:39def-Araq: right, keep forgetting
17:25:43Araqnot that it matters much
17:26:01EXetoCthat'd be hasBeenClosed then
17:27:05dom96meh
17:27:10rgv151dom96: what does closed mean? socket can not be used anymore?
17:27:22dom96Closed means close() has been called on it
17:27:32*anthgur quit (Client Quit)
17:27:42dom96rgv151: what are you using isClosed() for?
17:28:47EXetoChence my suggestion
17:28:49rgv151I determine if socket is already connected by `not s.isClosed()`
17:29:04EXetoCwhat about a convenience for "am I still connected?"
17:29:16dom96You should be tracking that yourself
17:29:43dom96@EXetoC
17:29:48*sepisoad quit (Ping timeout: 240 seconds)
17:29:57dom96rgv151: Can I see your code?
17:30:05rgv151send a ping?
17:30:21dom96hrm?
17:30:55dom96gist it and paste the link here
17:31:04dom96or PM me it if it's private code
17:31:41rgv151ah, I just asking how to track the connection
17:32:40dom96recv will return "" if the socket was disconnected
17:34:17EXetoCI suppose someone could create a lib on top if necessary, with things like timeout management
17:35:04ArrrrWhy am i getting 'illformed AST: a' with this line> myMacro HelloWorld(a, b: int)
17:35:33Learath2thx def- would have never found .data :D
17:35:46def-Learath2: just write x_bla. and hit TAB
17:35:46EXetoCthere's both asyncnet and asyncdispatch though, but abstractions on top of asyncdispatch would make more sense to me
17:36:07dom96EXetoC: timeouts are trivial with asyncdispatch already
17:36:34def-Learath2: also shows the Sup field which contains {len = 11, reserved = 11}
17:38:16EXetoCwell what do I know
17:39:48*apense joined #nim
17:40:27rgv151dom96: I just try to use asyncnet and `closed` field confused me
17:40:56rgv151now it work fine w/ asyncdispatch and I tracked it myself
17:42:02rgv151here is my code if you want to see https://github.com/rgv151/rethinkdb.nim/blob/master/connection.nim
17:45:26*def- quit (Ping timeout: 250 seconds)
17:46:01dom96why not use asyncnet?
17:47:13rgv151lol, just cuz asyncdispatch is working for me
17:50:30EXetoCwait, why did I switch to asyncdispatch? I can't remember
17:50:59*yglukhov_____ joined #nim
17:51:01*milosn quit (Ping timeout: 265 seconds)
17:51:58dom96that's not a good sign...
17:53:25AraqArrrr: because that is not valid Nim syntax, proc p(x, y: int) {.m.} cannot be written as m p(x, y: int)
17:53:27*filcuc joined #nim
17:53:50EXetoCaren't they kind of similar? *shrug*
17:54:11AraqArrrr: I wanted to enable this via template `func` = m; func p(x, y: int) but people don't like it :P
17:54:25dom96The big difference is that asyncnet supports buffering
17:54:31dom96and SSL
17:54:32rgv151I think some think like `isConnected` should be added to asyncnet, cuz it's a high-level module then..
17:55:38Araqdom96: wanna rewrite the async core with r-ku's proper coroutines stuff?
17:55:57dom96proper?
17:55:59dom96Proper how?
17:56:22Araqcan yield in a recursion
17:56:34Araqsince it has its own stack
17:56:37BitRAraq: I finally understand why the lambda lifting issues arrive. The :env var is being reused even though it's already owned by another proc / scope. An 'easy' way to fix the problem would be to change the hash of PEnv lookups to include the owner as well as the symbol being looked up. But that would require changing the data structure of the idTable from TIdPair or changing TIdPair. Am I missing an obvious solution for this?
17:56:50dom96Araq: Why do I need to rewrite things for it?
17:57:24Araqdom96: hrm ... good question. maybe you don't have to.
17:57:50dom96also, yielding in a recursion isn't very useful...
17:57:56dom96unless I am missing something.
17:58:03AraqBitR: er sorry, but that's what I wrote in the LL description?
17:58:16dom96What would be useful is yielding in a try statement
17:58:22dom96rgv151: hrm, maybe...
17:58:24*Demos joined #nim
17:58:38Araqdom96: oh but it is
17:58:55Araqthink about iterators that iterate over trees
17:59:31dom96ok, not useful in an async context :P
17:59:52AraqI think it's useful in an async context as well
18:00:12Araqno more templates instead of procs because you cannot 'yield' in a proc
18:00:12EXetoCI'm using asyncnet again. I just needed to disable buffering... or do I want buffering? let's see.. :p
18:00:24dom96rgv151: you can make a PR if you want
18:00:43rgv151k, I will
18:00:46dom96Araq: what
18:00:58dom96You can now yield in a proc?
18:01:25AraqBitR: just use a hash table from the stdlib. the TIdPair stuff predates working generics and the stdlib
18:01:49Araqdom96: yes
18:02:35dom96how can that possibly work?
18:03:20Araqas I said, it uses proper stack switching
18:04:22Araquses assembler code to switch stacks
18:04:47dom96proc x(): int = yield 56; yield 42; return 52
18:04:52dom96echo(x())
18:05:00dom96Where do the 56 and 42 go?
18:05:42EXetoCI wanted buffering, but in conjunction with a timeout, but.. does buffering implies an underlying socket that blocks until a certain amount of data has been received?
18:06:01*jszymanski quit (Read error: Connection reset by peer)
18:06:09AraqEXetoC: it buffers and is async at the same time. :P
18:06:24*jszymanski joined #nim
18:07:21Araqdom96: it prints 56 and then you need to resume it explicitly. Or something like that, r-ku's code doesn't yet support procs with return values
18:08:05dom96so any proc I call can just suddenly stop?
18:08:09dom96That doesn't sound like a good idea
18:08:24BitRAraq: Ah nice, so I should be able to port it to a hash table with hashes being generated from (owner, symbol) tuples, just need to find the best way to refer to the owner of an env that isn't three references deep
18:08:25dom96no return values is a deal breaker for async
18:09:17Araqlol I don't think so. I think you're just too used to the "old way" now
18:09:35dom96ehh yeah
18:09:39dom96I need to return the Future
18:10:15EXetoCAraq: so, non-blocking underlying socket in any case? as in, you could just have the functions take a "shouldBlock" parameter?
18:11:16dom96EXetoC: if something in an *async* module blocked then it wouldn't be async now would it?
18:12:30EXetoCright, it's *that* type of blocking. nevermind. no need to get into that discussion again :p
18:13:11*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:14:10AraqBitR: did you read my notes on the LL issues?
18:14:59BitRAraq: I've read some from various issues on github
18:15:18BitRMostly references to issue 672
18:16:54BitRWrote a gdb command that's able to see through the kindU mess and show info about PNodes and Symbols btw :)
18:17:01Araqdude, I wrote this for guys like you: https://gist.githubusercontent.com/Araq/7f1eaacb68a5c49f73bc/raw/3cb1fbdea485c301ea92d837c06598ab5a7f4819/LL
18:17:24Araqalso debugging the compiler can be done more effective than via gdb:
18:17:33BitRaye you told me about gdb :)
18:18:14BitRit's just rather nice to break into some code in gdb and be able to inspect variables without having to recompile
18:18:15Araqhttp://nim-lang.org/docs/intern.html#debugging-the-compiler
18:18:36BitRaye read that one
18:18:51Araqgdb cannot go back in time. I can. Kind of. :P
18:19:12Araqvia the ID mechanism in the compiler
18:19:31Araqprint the offensive ID, re-run and check where this ID is generated
18:19:47AraqIDs are deterministic, pointers are not
18:20:17BitRhmm not bad, was thinking of using the gdb 'call' command to do further inspections, should be able to call printTree from there, but aye you'd need to know the proc id name
18:20:29BitRah, that's a nice use case
18:21:04Araqwhen you enable -d:usenodeIds nodes get IDs too
18:21:36Araqthe compiler can even tell you "this ID comes from this copy"
18:22:10Araqcause often the original node is already messed up ;-)
18:22:22BitRcool, really liked the lineDir:on, but this will help immensely too
18:23:20Araqoften it takes more time to write the test case than to fix the bug in the first place
18:23:38apenseAraq, that gist might be a little easier to read if you made it LL.rst
18:23:44*def- joined #nim
18:23:55apenseonly a little bit haha
18:25:22apensehttps://gist.github.com/apense/3c90631869b4442204da
18:26:42Araqthanks, good point, https://gist.github.com/Araq/7f1eaacb68a5c49f73bc
18:28:54*rgv151 left #nim ("Killed buffer")
18:29:06*yglukhov_____ quit (Quit: Be back later ...)
18:29:33*rgv151 joined #nim
18:30:06AraqBitR: the recompiles for debugging are bad but otherwise I need to resort to conditional breakpoints which are simply too slow
18:30:39Araqso in the end custom debug code + recompiles wins for me over gdb
18:30:56BitRYour post mentions changing the PSym->PEnv mapping to TLineInfo->PEnv. Wouldn't this create too many PEnv instances? Should it not rather be (Owner, PSym)->PEnv?
18:31:33BitRaye sure, I've had to make use of breaking on processModule, continuing past system.nim, then having it break, remove the breakpoint and then I'm in test.nim land :)
18:31:53BitRbut yeah, it all boils down to preferrence really
18:32:21AraqI think you need to attach the env to the callsite, independent of any owners
18:32:38BitRAye, but you only need one env per owner right?
18:32:38Araqbut I could be wrong
18:32:56Araqper owner and scope perhaps
18:33:14Araqscope is important too, you need to recreate envs in a for-loop
18:33:22Araqbut better or worse
18:33:35Araqlots of languages get this wrong though
18:33:49BitRWell in this case the owner field on the object looking for an env is actually the proc / scope
18:34:34Araqzahary argued vehemently for the "per scope" capturings and so that's what Nim uses
18:35:05AraqI think the "broken" behaviour of other languages has more merit in a systems programming setting
18:35:14BitRYep, it makes sense
18:36:13Araqespecially since the "per scope" implementation is such a clusterfuck to maintain :-/
18:37:41Araqbtw the language doesn't use "per scope" capturings for closure iterators cause that made my head explode
18:38:30BitRHehe yeah I saw some comments in the code
18:38:40*unclechu joined #nim
18:39:12EXetoCthe "use your brain" approach didn't cut it in this case? :p
18:40:05BitRWell if your brain has no problem with recursive code substitutions, I guess you'll be just fine
18:44:52AraqEXetoC: "read papers about it" doesn't really help either
18:45:59EXetoCshotgun programming solves everything
18:47:58AraqBitR: actually it took me 2 weeks to understand why the recursive code subsitution does *not* work
18:48:16Araqand you need to handle arbitrary nestings all in one pass
18:48:49*vasher_ quit (Quit: Connection closed for inactivity)
18:49:08BitRYeah I'd image you'd want to create a new proc containing all the levels of iterator substitutions and then hope to handle the heavy lambda lifting
18:49:47BitRBut in that case you might be able to make due with one monster scope
19:14:11*OnO quit (Ping timeout: 256 seconds)
19:14:50*OnO joined #nim
19:15:28*dgellow left #nim (#nim)
19:16:00*Strikecarl joined #nim
19:19:33*unclechu1 joined #nim
19:20:25*unclechu quit (Ping timeout: 256 seconds)
19:24:28StrikecarlIs it possible to compile a .nim into a .dll? and what param(s) do i compile with?
19:25:46reactormonkStrikecarl, try --lib
19:26:00reactormonkStrikecarl, ah wait, it's --app:lib
19:26:10Strikecarllemme tr
19:26:13Strikecarltry* :P
19:26:17*umurgdk joined #nim
19:26:25*Demos quit (Remote host closed the connection)
19:26:57AraqStrikecarl: http://nim-lang.org/docs/nimc.html#dll-generation
19:27:20Araqsometimes I wonder why people claim our docs are bad
19:27:41dom96because they are :P
19:28:07Strikecarlroast
19:28:27Araqthey are not, they are superb.
19:28:38Strikecarlreactormonk, that just returns "command expects a filename argument"
19:28:41Araq... except for all the stuff that isn't documented
19:31:15StrikecarlWeird
19:31:21StrikecarlAraq, why do i have to specify the filename
19:31:25Strikecarlwhen i use --app:dll
19:31:26Strikecarllib*
19:31:32Strikecarl"Error: command expects a filename argument"
19:32:02Araqfor the same reasons you need to specify a filename for general compilations
19:32:08Araqnim c -r foo.nim
19:32:17Araqnim c --app:lib foo.nim
19:32:25Strikecarlaight
19:32:31Strikecarlis it the .nim's location
19:32:34Strikecarlor nim.exe location?
19:33:38Araqfoo.nim is a text file with Nim source code in it
19:34:16StrikecarlWorked. ty.
19:34:56Strikecarlhow do i compile it as a 32bit dll?
19:36:22*rgv151 quit (Quit: rcirc on GNU Emacs 24.5.1)
19:40:04Araqthere are a couple of options, --cpu:i386, but the easiest is to use the 32bit Nim installation
19:41:26StrikecarlE:\Programming\Nim\dist\mingw\bin\gcc.exe -c -w -O3 -fno-strict-aliasing -IE:\Programming\Nim\lib -o c:\users\carl\desktop\nimcache\test.o c:\users\carl\desktop\nimcache\test.c
19:41:26StrikecarlError: execution of an external program failed
19:41:36Strikecarlused --cpu:i386 :^(
19:44:55Araqyou also need to tell GCC to use 32bits
19:45:17reactormonkvia --passC
19:45:52apensewhy are the comments for some templates (see http://nim-lang.org/docs/pegs.html#letters.t,) showing up? seems like the documentation was updated a while after the comments were there
19:46:47*filcuc quit (Quit: Konversation terminated!)
19:47:15Araqhrm?
19:48:19Araqapense: ah so the bug is still here :P
19:50:26apensehaha right. I should have said "not showing up." Didn't make sense the way I wrote it.
19:50:45Strikecarlreactormonk, nim doesnt like that command
19:51:09reactormonkStrikecarl, hm, ok. Never compiled something for 32bit. Linux masterrace checking in :-P
19:51:30Strikecarl:P
19:51:51StrikecarlNever actually used a linux machine before, i'm that young ye, gotta need this .dll for csgo cheats tho
19:51:57reactormonkit's --passC:-march=<something>
19:52:00Strikecarlwell fuck 32bit, guess im injecting into a 64bit.
19:52:59*filcuc joined #nim
19:54:06BitRIsn't it just --passC:-m32?
19:54:55*umurgdk quit (Remote host closed the connection)
19:55:03*BitPuffin quit (Ping timeout: 276 seconds)
19:56:36*yglukhov joined #nim
20:01:00apenseAraq, I just made a little issue for the template doc (https://github.com/nim-lang/Nim/issues/3087). I couldn't find the previous appearance of it. I can remove or reference if anybody knows what it is.
20:01:10*Matthias247 joined #nim
20:01:39Araqit's tagged with "tools" and should already be in the tracker
20:03:02*umurgdk joined #nim
20:03:44*umurgdk quit (Remote host closed the connection)
20:03:52apenseah
20:03:56*umurgdk joined #nim
20:12:14apenseAraq, Got it. I think this is the same as #1528. (adding discard makes the docs show up)
20:12:50*Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
20:15:07*yglukhov quit (Quit: Be back later ...)
20:21:09*yglukhov joined #nim
20:26:32*yglukhov quit (Quit: Be back later ...)
20:27:30*Demos joined #nim
20:29:33apenseis libcurl gone?
20:31:51*Demos quit (Ping timeout: 256 seconds)
20:33:27reactormonkcheck nimble
20:36:46Araquh oh
20:37:25apenseno curl or libcurl in nimble search
20:39:46Araqit's in my "toNimble" directory
20:40:14Araqbtw dom96 does Aporia work with the new dialogs package?
20:42:07dom96Araq: Yeah, I think so
20:44:20*drewsrem quit (Quit: Leaving)
20:47:06*Arcanum_za joined #nim
20:47:11*Arcanum_za quit (Client Quit)
20:58:08*wu-lee quit (Remote host closed the connection)
21:00:29*aziz quit (Remote host closed the connection)
21:11:00*jszymanski quit (Quit: computer sleeps...)
21:14:30*raza quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
21:17:49*Arrrr quit (Quit: WeeChat 1.2)
21:22:22*elbow quit (Ping timeout: 248 seconds)
21:26:46*zahary joined #nim
21:27:56*zahary1 quit (Read error: No route to host)
21:28:08Araqfowl: ha, I can beat you at macro hacking :-)
21:28:14Araqcheck this out: http://forum.nim-lang.org/t/1425/2#8871
21:28:33Araqturns out ... we already have pattern matching for ASTs in the language
21:29:03Araqit's just that nobody noticed ;-)
21:30:42fowlnice
21:30:56fowldid you see that lib for pattern matching variant objects?
21:31:18fowl'patty'
21:31:53Araqhaven't looked at it yet
21:31:59Araqbut I know it exists
21:32:05EXetoCneato
21:32:07EXetoCfowl: where
21:32:36fowlEXetoC, its on nimble
21:33:30AraqI especially like the template arg: expr = x; getAst(arg()) hack
21:34:27Araqreminds me of C preprocessor hacking where you need to nest stuff pointless to get a # toString compile-time operator that doesn't suck ...
21:34:47Araqor something like that
21:35:06fowlAraq but does it work from outside the module
21:36:26EXetoCfowl: I guess neither 'pattern' nor 'matching' appears in the package metadata
21:36:27fowlI had problems with templates using untyped not working from outside the module
21:36:45Araqfowl: yes, works
21:36:55Araqjust added recursive and match to macros.nim
21:36:55fowlEXetoC its called patty and it was added a couplw days ago
21:38:36EXetoCI need to add update to my alias
21:39:47AraqZahary: that 'getAst' builtin is so much better than 'quote'. ;-)
21:42:22EXetoCfowl: right, that one
21:42:42EXetoCI got a gazillion macro ideas
21:43:35*Matthias247 quit (Read error: Connection reset by peer)
21:46:21*filcuc quit (Quit: Konversation terminated!)
21:59:47*Xe quit (Quit: *.yolo *.swag)
22:02:04*Xe joined #nim
22:06:41VarriountAraq: You want me to put the style guide in the documentation and on the website?
22:07:49AraqVarriount: yeah and link from tut1 to it
22:08:46*n0vacane joined #nim
22:10:53*X67r joined #nim
22:17:08*thaless joined #nim
22:17:55*ufm joined #nim
22:18:14ufmHi ppl.
22:18:51EXetoChi.. human?
22:18:51ufmCan anyone answer on simple question? pragma benign - what is it?
22:20:16EXetoCbenign?
22:20:47Araq {.pragma: benign, gcsafe, locks: 0.}
22:21:14ufmyes. In standart library many-many times used this pragma
22:21:18EXetoCoh right, aliases
22:21:25Araqin other words it's GC-safe and doesn't use locking
22:22:56ufmAnd this pragma really exists? I'm search it in nim compiler sources without success.
22:23:16Araqit's in lib/system/incrtl.nim
22:23:28Araq*inclrtl
22:25:18ufmhmm..
22:25:42*pregressive quit (Remote host closed the connection)
22:26:14EXetoCpragmas can come in the form of macros too, and aliases as you can see
22:27:14*n0vacane quit (Quit: Leaving)
22:27:42ufmOk. But where definition of this pragma? In inclrtl I see only {.pragma: benign, gcsafe, locks: 0.}
22:27:58fowlufm that is the definition of it
22:28:05fowlSee pragma pragma
22:28:12Araqthe pragma pragma is used to introduce new pragmas
22:28:28Araqthat's what you get when language designers are having fun ...
22:29:01ufmOh... damn. Sorry for stupid question.
22:29:39Araqno, it's a perfectly fine question and .benign should be in the manual anyway
22:30:59ufmIt's _another_ question. :) "Why mass usable alias not documented" :)
22:31:51Araqwell "nim doc2" expanded it for you
22:32:56Araqthe documentation is fine but you read the actual source code :P
22:34:37*unclechu1 quit (Remote host closed the connection)
22:35:05*Demon_Fox quit (Ping timeout: 252 seconds)
22:39:48ufm:)
22:40:02*zezba9000 joined #nim
22:41:48*Trustable quit (Remote host closed the connection)
22:42:19ufmAnother question. D-lang have nice feature - lazy function arguments (http://dlang.org/lazy-evaluation.html). Nim has something like that?
22:43:01*umurgdk quit (Remote host closed the connection)
22:43:45dtscodeI don't think nim is lazy evaluation like D or haskell, no
22:44:42*jszymanski joined #nim
22:45:00VarriountNim doesn't have built-in lazy evaluation. It could be done though through use of structures and callbacks.
22:45:16Xe(thought the benefit of doing that is debatable)
22:46:10VarriountXe: That's my feeling on the matter.
22:46:32dtscodeI've never understood the need tbh
22:46:53zezba9000Hey I was in here before asking about Nims GC being able to run on 2kb ram Arduino devices. The issue was the allocator can only work with devices that have at least 4mb ram. How hard would it be to update the GC's allocator to not manage its own memory heap in large blocks like it is now and to only allocate what is needed via malloc ect so it could run with minimal memory usage at the expense of performace
22:47:16Xezezba9000: why not just disable the GC altogether?
22:47:28zezba9000Because I need a GC for portable code
22:47:35Xeno I mean
22:47:40Xeonly preallocate stuff in the stack
22:47:44Xeglobal mutable variables
22:47:56Xenormally that's a bad idea, but in embedded programming you kinda need to
22:48:51EXetoCor pre-allocate anywhere else
22:49:03Xe^
22:49:04EXetoCthat works too
22:49:06zezba9000Yes I know, thats not the issue. The Nim lang is cripled without a GC and the way you code consistant without it
22:49:16apensedtscode, it seems valuable with infinite lists, I guess
22:50:29*dalarmmst quit (Ping timeout: 252 seconds)
22:50:41EXetoCzezba9000: it's not prioritized right now
22:51:18zezba9000What Nim file was used for allocation again I forget
22:51:48EXetoCthe system module
22:51:58Varriountzezba9000: mmdisp.nim is part of the memory manager.
22:52:34zezba9000aww yes and alloc.nim
22:52:35Varriountzezba9000: I believe you can tell the compiler to use malloc
22:52:36*dalarmmst joined #nim
22:52:52ufmomg. GC on embedded devices... Who would have told me that 15 years ago
22:54:17EXetoCbut people just say "you'll probably always be dependent on the GC in practice"
22:54:34zezba9000Varriount: Well part of the issue is it allocating more memory then needed.
22:54:47EXetoCI dunno why people are so pessimistic. A lot of code would have to be rewritten though
22:55:15ufmWell. ok. Thanx for answers! bye ppl.
22:55:29zezba9000ufm: Its not about the GC being used in a big way but wrather giving Nim a good feature set on Arduino
22:55:39zezba9000Java can run in 1kb ram with a GC
22:55:53*ufm quit (Quit: Page closed)
22:56:10zezba9000http://haiku-vm.sourceforge.net/
22:56:22zezba9000Its interpreted though
22:56:46*CARAM__ quit (Ping timeout: 248 seconds)
22:56:46*endou___________ quit (Ping timeout: 248 seconds)
22:56:46*fowl quit (Ping timeout: 248 seconds)
22:56:55*fowl joined #nim
22:56:55*fowl quit (Changing host)
22:56:55*fowl joined #nim
22:56:55*fowl quit (Changing host)
22:56:55*fowl joined #nim
22:57:24*endou___________ joined #nim
22:58:01*jszymanski quit (Quit: computer sleeps...)
22:58:14*CARAM__ joined #nim
22:58:25EXetoCyay java
22:59:21federico3-_-
22:59:33zezba9000If its possible in Java it should be possible in Nim is the point and Nim would run way faster
23:00:00Varriountzezba9000: Well, there might be some constant you could change to lessen the amount of memory required.
23:00:43zezba9000But it still uses mmap wich would also have to be replaced
23:01:44*vasher_ joined #nim
23:01:45VarriountOn a side note: Anyone know how to generate the full Nim documentation? I need to test some changes out.
23:02:10Varriountzezba9000: And there's a switch to tell the gc to use malloc
23:02:25*Demon_Fox joined #nim
23:02:40zezba9000Are you sure? Becuase malloc doesn't exist in alloc.nim
23:02:50Varriountzezba9000: Try '-d:useMalloc'
23:03:38zezba9000That only works with gc:none.
23:03:45Varriount?
23:03:52zezba9000http://nim-lang.org/docs/nimc.html
23:04:05zezba9000"Makes Nim use C's malloc instead of Nim's own memory manager. This only works with gc:none."
23:04:20zezba9000So it disables the GC
23:04:38VarriountHm.
23:04:45*thaless quit (Ping timeout: 255 seconds)
23:04:50VarriountI wish Araq were present.
23:08:28zezba9000ya
23:09:13Araqzezba9000: the patches went into devel
23:09:26Araqyou can use --os:standalone with the GC
23:09:29zezba9000I see "osAllocPages" The page size just needs to be the size of the object each time maybe
23:09:57Araqhowever, it's not been tested at all and as I said for 2KB of RAM you need a much simpler allocator and GC
23:09:58zezba9000Araq: Aww sweetness
23:10:31Araqbut you're right that it can be done if Java can do it too ;-)
23:11:02zezba9000I'm looking at the alloc.nim now. It it possible to just use malloc instead of mmap and only create pages at the size of a single object? Would that work
23:12:05Araqdoes the C runtime even have a malloc you could use?
23:12:19zezba9000for Arduino?
23:12:44zezba9000Yes it support C/C++ 4.8 without some library support of course
23:13:54*pregressive joined #nim
23:13:57Araqincluding c++ exceptions?
23:14:23zezba9000Does Nim use those? Not sure I can test or look it up
23:14:47Araqit can use setjmp or C++'s exceptions
23:14:59Araqspeaking of which ... does it have setjmp?
23:15:28zezba9000I think it does
23:16:51zezba9000ya it does, have the include file
23:16:57EXetoCwill Foo[Bar|Baz] ever work?
23:17:20AraqEXetoC: I fixed lots of bugs for |
23:17:48Araqbut I think it's a rather ill-defined concept
23:17:50zezba9000Yep it compiles with setjmp
23:18:10Araqok, well C's malloc doesn't support the features we need
23:18:20Araqwhich is why we have our own alloctor
23:18:32zezba9000What feature is that?
23:18:48EXetoCit'd just be a simple shortcut
23:19:29Araqzezba9000: isAllocatedPointer() checking for instance.
23:19:51Araqor a realloc() that can zero out the additional memory
23:20:09zezba9000Araq: memset could do that though
23:20:16zezba9000Where is isAllocatedPointer located?
23:20:20Araqha, you think so
23:20:25Araqbut you're wrong.
23:20:52Araqyou need to memset only the *new* part of the memory
23:21:10Araqwhat's the new part? oops, you cannot access the old size
23:22:00zezba9000ok ic thought it was something else
23:22:24AraqisAllocatedPtr in alloc.nim
23:22:38zezba9000Araq: realloc works in Arduino
23:25:17Araqit works but implements C's semantics
23:25:50Araqwe require a bit more, but realloc is not the problem, we can always malloc; free instead
23:26:10AraqisAllocatedPtr is crucial though
23:26:32zezba9000I see isAllocatedPtr is used for assets
23:27:03Araqbut seriously. Implementing a memory manager for 2K of RAM is *not* hard. You cannot do better than singly-linked lists everything else takes up too much space anyway
23:29:00Araqfor isAllocatedPtr you can speed up searches with a simple bloom filter
23:29:47zezba9000Well because there isn't much ram to scan through it could be removed and wouldn't cause much issue I would think if thats the case
23:30:59zezba9000You can sacrafice those typical scan optimisations when you only work with 2kb-32kb of ram
23:37:32zezba9000What is the different between gc.nim and gc2.nim?
23:40:42Araqgc2 doesn't work.
23:40:50zezba9000k
23:41:01zezba9000some experiment?
23:42:52zezba9000After looking at gc.nim i'm trying to find what methods of alloc.nim would have to be re-implemented. I see "allocInv" is used a lot. Are there any other nim files that reference alloc.nim
23:45:03Araqsysstr perhaps
23:45:26AraqallocInv is just checking the invariant, just debug code
23:46:38Araqbtw I hope your brother is well
23:47:17zezba9000Ya he is
23:48:05zezba9000has he not been on?
23:48:23EXetoCwhat happened?
23:49:04zezba9000What do you mean?
23:49:56zezba9000EXetoC: Did you ask because you thought somthing bad happend?
23:50:28EXetoCnevermind
23:52:11Araqhaven't seen him since a while
23:52:13Araqhttps://code.google.com/p/arduino/issues/attachmentText?id=468&aid=5395422094860745517&name=malloc.c&token=ABZ6GAczZFDnrc5vIHAEQJQzOxk9beLpYw%3A1434589240487
23:54:52zezba9000Araq: What was the malloc link for?
23:58:14*vendethiel quit (Ping timeout: 256 seconds)