<<28-05-2013>>

00:00:36*PrincessKaDenza is now known as comex
00:15:27reactormonkproc len*[T](x: seq[T]): int {.magic: "LengthSeq", noSideEffect.} # invalid with Error: pragmas are only allowed in the header of a proc
00:15:30reactormonkI copy/pasted it around
00:35:55fowlyou can only have pragma in the header
01:15:54*q66 quit (Remote host closed the connection)
04:07:06*OrionPK quit (Quit: Leaving)
04:57:02reactormonkmeh, I'll do some more forward declares
05:43:43*amarsahinovic joined #nimrod
05:44:24*amarsahinovic left #nimrod (#nimrod)
07:27:28*Araq_ joined #nimrod
07:34:12*amarsahinovic joined #nimrod
07:35:44*Araq_ quit (Read error: Operation timed out)
07:36:45*Araq_ joined #nimrod
07:50:04*ARCADIVS quit (Quit: WeeChat 0.3.8)
08:22:46*Araq_ quit (Read error: Operation timed out)
08:25:04*Araq_ joined #nimrod
08:35:22*q66 joined #nimrod
08:52:42*Araq_ quit (Read error: Connection timed out)
08:54:47*Araq_ joined #nimrod
10:18:19*Araq_ quit (Quit: ChatZilla 0.9.90 [Firefox 19.0.2/20130307023931])
10:56:55*Trix[a]r_za is now known as Trixar_za
10:58:09*amarsahinovic left #nimrod (#nimrod)
11:34:12*Araq_ joined #nimrod
11:44:17*Araq_ quit (Quit: ChatZilla 0.9.90 [Firefox 19.0.2/20130307023931])
13:08:28*Araq_ joined #nimrod
13:11:30*Araq_ quit (Client Quit)
13:19:11*Trixar_za is now known as Trix[a]r_za
14:18:03*comex quit (Ping timeout: 249 seconds)
14:18:04*comex` joined #nimrod
14:18:29*comex` is now known as comex
14:42:13*XAMPP quit (Ping timeout: 256 seconds)
16:36:43reactormonkAraq, what if I need sequences at compile-time?
16:52:58NimBotAraq/Nimrod 850d567 Zahary Karadjov [+0 ±1 -0]: fixes iterating over enums
16:52:58NimBotAraq/Nimrod b4245e6 Zahary Karadjov [+1 ±2 -0]: some steps to improve the type mismatches with the new... 2 more lines
17:46:16*Endy joined #nimrod
18:12:40*zahary joined #nimrod
18:16:10zaharyAraq, I think you shouldn't have reverted my commits, but instead just update the master ref to point before them
18:17:06AraqI dunno, I planned to push a hot fix for dom96
18:17:28Araqunfortunately it turned out to be some hard bug, so I'm still working on it
18:18:16reactormonkAraq, is it possible to use a different stdlib at compile and runtime? ...
18:18:59Araqreactormonk: no ... and your question about the 'seq' at compile time is a good one
18:19:11AraqI'm thinking about it
18:19:31reactormonkAraq, just gimme a 'thinking on it' and I'll keep quiet ;-)
18:19:39Araqin the worst case you have to implement 'newSeq' and make it raise a runtime error
18:19:58reactormonkgood, I'll go with that then
18:20:10reactormonkwait, what if I call it during compiletime? Also gives me a runtime error
18:20:43Araqit shouldn't since it's a magic that has its own implementation in the evaluation engine
18:24:05Araqzahary: btw tfieldindex seems to be broken on your branch
18:24:13reactormonkcan I determine if code is run during compile or runtime?
18:24:58Araq'when defined(nimrodvm)' iirc
18:25:19Araqwould be "at compile time"
18:26:34*Endy quit (Ping timeout: 246 seconds)
18:33:35Araqthinking about it ... I think that means we already have a runtime system and compiletime system module
18:34:00zaharyaraq, btw what is the purpose of the compileTime pragma in tfieldindex? I think that according to the spec, this should disable the multiple instantiation behavior of the typedesc param and turn the proc into a macro-like function that takes type symbols
18:34:40zaharyi.e. a function that is compiled only once (not generic)
18:35:11zaharyin such a function, it should be illegal to use the typedesc parameter in this manner:
18:35:11zaharyvar x: T
18:35:25Araqwell 'typedesc' is ambigious and we need to fix it
18:35:45Araqmaybe we need typedesc[T] vs. typedesc
18:36:45Araqyour change to bound it for the unification process broke template t(a, b: typedesc)
18:36:48zaharyambiguos in the sense (a compile time proc taking a type symbol or generic proc that need a needs a new instantiation for each type?)
18:37:17Araqfor a start it's not obvious what to do for the unification
18:37:21zaharyI'll fix the bind once problem by other means - it's not related to the discussion here
18:37:29Araqwe have expr vs T for ordinary expressions
18:37:35Araqwe only have typedesc for types
18:37:54AraqI dunno how you can fix it
18:38:00Araqwe need both?
18:41:10AraqcompileTime is necessary to enforce evaluation at compile time; I'm not sure it should influence the genericness of a proc
18:41:36Araqthough I can see that it often leads to intuitive behaviour
18:42:55zaharycompileTime prevents run-time code generation - does it also mean "implied static calls"?
18:43:07Araqyes
18:43:20zaharyI think may "macro-like" treatment also makes sense
18:43:29Araq--implicitStatic:on|off affects this as well
18:43:37Araqas I said, your treatment makes sense too
18:44:02AraqI think --implicitStatic:on needs to be active all the time and the switch gone
18:44:26Araqthen 'indexOf' can get rid of 'compileTime'
18:45:55dom96The Nimrod website will be down at 1am GMT+1 tomorrow, this includes, nimbuild (NimBot) and the forum. Just FYI.
18:46:23zaharyI'm for implicitStatic:on too - this is how my hypolang was supposed to work
18:47:47zaharyand with few more additions. var x = somethingConst() becomes const x = …
18:47:47zaharyif somethingConst() becomes when …, etc
18:48:14Araq'if' has different scoping rules than 'when'
18:48:38Araqand I don't like 'var' turning into 'const' either
18:49:21zaharywell, this will be natural consequence of implementing dependent typing
18:49:47zaharyso, it's likely to effectively happen anyway
18:49:59Araqvar x = "" # turn into a 'const'?
18:50:10AraqI guess that's not what you mean
18:51:15Araqand what has dependent typing to do with it?
18:51:29zaharythe compiler now knows the exact value of x, and this can affect any ifs that follow.
18:51:29zaharyif x.len > 0
18:52:47Araqyeah got it
18:52:50dom96Isn't 'var' by definition mutable? is this only in the case where the compiler can prove that no modifications of the var take place?
18:53:04Araqdom96: yes
18:54:08zaharyI think I missed what you object about - var turing into const and this affecting mutability down the line
18:54:16zaharyI don't want that too
18:54:44Araqyeah I got it now
18:55:31AraqimplicitStatic:on is the natural thing to do but there were lots of edge cases
18:56:06Araqfor instance the compiler would happily evaluate newString(3000) resulting in bad code generation
18:56:43Araqalso it mustn't evaluate 'echo' at compile time just because it can
18:57:45AraqI'm not sure I got rid of all of them
18:58:49zaharyyeah sure, bloat in the final image due to things like newString(3000) and improperly unrolled loops was may main concern too
19:01:00reactormonkAraq, btw, all those interdependencies in the system module :-(
19:05:59Araqreactormonk: btw you should replace the error messages by an error code enum
19:06:11Araqand document that
19:06:19reactormonkAraq, error messages?
19:06:45Araqin the EBase get rid of the message field, make it an enum instead
19:07:10reactormonkand what should go in there?
19:08:13AraqTErrorCode = enum errOverflow, errInvalidIndex etc.
19:09:50zaharyhow is the user supposed to add his own error codes? from a library?
19:13:00zaharyregarding the typedesc binding rules… here is a heretical idea breaking backwards compatibility, but ultimately more consistent with the current state:
19:13:00zaharywhat if foo[T: typedesc]() stops being equivalent to foo[T]() and becomes a way to introduce named bindOnce typedesc parameter
19:13:00zaharyso if I want to define the function typesEqual, I would do typesEqual[T: typedesc)(a, b: T)
19:15:05zaharyotherwise, I can solve the problem with named bindOnce aliases (to be used with implicitly generic procs)
19:15:18zaharyjust like I can say type T1 = expr , T2 = expr
19:15:34zaharyand then write functions like
19:15:34zaharyproc foo(a: T1, b: T2, c: T1)
19:15:57zaharyequivalent to foo[T, U](a: T, b: U, c: T)
19:16:15zaharythe same can be done with TT1 = typedesc, TT2 = typedesc ...
19:19:16Araqzahary: the context is a microcontroller with 16KB of RAM, I don't think user defined exception messages are necessary; errOther suffices
19:19:42zaharyah, I though you are discussing a general change, sorry
19:19:46reactormonkAraq, 2KB of RAM, 16KB of flash
19:20:20reactormonkmaybe it was 32
19:20:30Araqmy mindstorm has 32KB of RAM and a display :P
19:21:18Araqand supports 'exit' I think
19:22:45Araqzahary: I'm not sure I like it, too much magic
19:23:02dom96zahary: if foo[T: typedesc] stops being equivalent to foo[T]() then the T with no constraints will no longer be free to accept everything as its definition currently suggests I think. Wouldn't that become a bit confusing?
19:23:10zaharythere was a classic story of a legendary programmer that was reusing the assembly instructions in his code as constants in other parts of code :)
19:23:38Araqwhat if we support proc distinctTypes(a: distinct typedesc, b: distinct typedesc) ? meh ... I don't like that either
19:23:49zaharywhich part don;t you like? the new treatment of typedesc in generic params or the implicit generics trick?
19:23:57reactormonkzahary, couldn't the compiler optimize that?
19:25:10dom96wait, I don't get it. Why is foo[T: typedesc] currently equivalent to foo[T]? In the former case T is constrained to always be a "typedesc" i.e. a type, in the latter it's unconstrained so it should accept anything.
19:25:34Araqdom96: where "anything" means "any value"
19:25:42Araqnot "some type"
19:25:49zaharydom96, I don't suggest anything to change about foo[T]() # it's just that we currently have this redundant foo[T: typedesc] that nobody would use out of lazyness and it just wastes "banddith" (the ability of the language to express different things)
19:26:36Araqwell the idea was that you can have foo[T: typedesc, X: expr]
19:26:42zaharybandwidth
19:26:50Araqand back then there was no ';'
19:26:55fowlwhy is unittest.nim not listed on http://build.nimrod-code.org/docs/lib.html and there's no doc page for it (i tried ./unittest.html)
19:27:05zaharyyes, that's why I said "more consistent with the current state"
19:27:06Araqso you couldn't write foo[T; X: expr]
19:27:28Araqalright I agree then
19:27:41Araqmake T: typedesc consistent
19:27:53Araqfowl: because I forgot it
19:28:26fowli thought i saw an example use for it too but cant find it now
19:30:31dom96Araq: I'm still confused. If ``T`` means "any value" then how can ``T: typedesc`` possibly be equivalent to it? When from what I understand ``T: typedesc`` means "any type"?
19:31:10zaharysee, even dom96 is confused about the current meaning :P
19:32:20Araqdom96: well that's what it means, consider [T: int|float]
19:32:43Araqthat doesn't mean that T is a meta type either
19:32:48Araqit means it can be int or float
19:33:14dom96It means that T can either be an int value or a float value.
19:33:15fowli'd like for this to work: proc foo[T] (ty: typdesc[T]; val: T); foo int, 1
19:33:35*amarsahinovic joined #nimrod
19:33:48Araqfowl: yeah that a good point
19:33:54fowlsince i get errors like that: got (typedesc[int], int literal(32)) but expected one of:
19:34:10dom96Am I confused about what 'typedesc' means?
19:34:19Araqdom96: we all are
19:34:35dom96that helps lol
19:35:57dom96From what I understand: when zahary said "what if foo[T: typedesc]() stops being equivalent to foo[T]()" he implied that it currently is equivalent. So let me try to get a grip on this with some examples:
19:36:07Araqzahary: btw is there a language with these meta types parameters to learn from?
19:36:21dom96proc foo[T: typedesc](bar: T) = nil
19:36:27zaharyI think the fowl example would work in the same way foo(ty: typedesc[Ordinal], val: Ordinal) would work now
19:36:34dom96foo(string) # fine
19:36:40dom96foo("value") # fine
19:36:50dom96and same goes if the definition of foo is:
19:36:59dom96proc foo[T](bar: T) = nil ?
19:37:06zaharyAraq, I'm not aware of another language going this far. some of the tricks are present in XL for example
19:38:00fowldom96: know of an example unittest use?
19:38:05Araqdom96: no, foo(string) is not be fine with the current compiler
19:39:00Araqfowl: examples/tunit.nim
19:39:23dom96fowl: Look for tests beginning with 'u' in the tests/ dir
19:39:48fowlthx
19:40:21dom96Araq: In which case is it not fine?
19:40:29dom96in which foo definition?
19:40:44Araqin both
19:40:58Araqcurrently foo[T: typedesc] and foo[T] are the same
19:41:15dom96oh, I get you now hah
19:41:19Araqand foo(x: typedesc) would accept the type
19:42:53dom96Isn't this just a matter of the compiler performing a replace of "T" in the param list with "typedesc"? :P
19:44:05Araqthere is no "just replace it" when it comes to types; why do you think generics take a decade to get into stable state?
19:44:45dom96True. In any case that's what I thought of, which is the source of my confusion I guess.
19:44:50dom96Thanks for clearing it up.
19:50:02dom96reactormonk: HIB accepts BTC now :O
19:55:41*fowl quit ()
19:56:53*fowl joined #nimrod
20:00:35reactormonkdom96, HIB?
20:01:03dom96reactormonk: humble indie bundle
20:16:23*gradha joined #nimrod
20:17:35reactormonkoh
20:21:17gradhadom96: logs still don't use the meta in the html header, will you fix that during tomorrow's outage or are the logs using now a reverted version due to the recent bugs?
20:22:30Araqthe latter I think
20:25:07*amarsahinovic left #nimrod (#nimrod)
20:25:21dom96indeed what Araq said
20:30:03gradhait seems that Claro's revival won't happen soon http://forum.nimrod-code.org/t/159
20:35:31gradhafowl: your bindings aren't listed yet at http://sfml-dev.org/download/bindings.php
20:36:08fowltrue
20:36:10fowlill email him
20:43:44fowli should notify sdl too
21:14:02*ba joined #nimrod
21:14:07*ba left #nimrod (#nimrod)
21:15:43*toolmaker joined #nimrod
21:16:28*zahary quit (Quit: Leaving.)
21:16:50gradhawelcome toolmaker
21:17:16toolmakerThanks gradha!
21:18:09gradhaAraq is around so you can nag him with feature requests
21:20:06gradhaI know coroutines are the rage, but what about https://en.wikipedia.org/wiki/Grand_Central_Dispatch as a lightweight alternative to threads?
21:21:41toolmakerI was looking for coroutines more as a form of continuations…but looking at the macro system, do you think it would be a feasible alternative to rewrite a function into smaller chuncks or something like that?
21:22:57toolmakerLike you know, on every yield keyword, the macro would split a argument function into two or more smaller functions that would then be wrapped as an iterator or something?
21:23:16Araqtoolmaker: check out http://nimrod-code.org/manual.html#first-class-iterators
21:23:58Araqas I said, we have an 'async' macro in the works that translates a proc into a "closure iterator" (I really should have picked a different name I think)
21:24:09gradhaI know pretty much nothing about coroutines, can't find any use case for my programming to exercise them
21:24:44Araqthis is way easier then splitting things into smaller functions
21:25:20Araqbbl
21:26:49gradhatoolmaker: what do you like to use coroutines for?
21:29:05toolmakerI have a bunch of communicating virtual machines that pass around instructions to each other.. I use continuations to 'pause' the execution of an instruction mid way if the vm wants to further talk to a different vm to complete the currently executing instruction.
21:31:32gradhathat's the kind of situation I would model with state machines, running manually their "loop", I guess coroutines are nicer to write
21:32:10toolmakerRegarding the soft-realtime gc, this includes it's usage for audio applications too right? I mean, not that I'd use mallocs in a real-time
21:32:22toolmaker… thread but still
21:33:56toolmakerIs completely bypassing the GC a viable alternatives (I'm really getting ahead of myself here because I've only read the manual at this point, have yet to play with the compiler yet)?
21:34:34toolmakerI really like the code transformation possibilities of nimroid however, I sort of need continuations..
21:34:56gradhaIIRC Araq mentioned it being possible to disable the GC and handle memory manually
21:36:09fowltoolmaker, whats wrong with 1st class iterators isnt that a coroutine
21:38:54Araqfowl: it's a very limited coroutine as it doesn't capture the stack; it apparent when you consider that 'yield' can only occur in the iterator itself and not in some helper function
21:39:00toolmakerI'm not sure I understand you see… if I remember correctly, the iterator construct is just like a macro that transforms the 'iterator' into a loop thingy … I am not sure if it saves the stack and register values and that I can use it properly without putting it a forloop
21:40:04toolmakerplus what Araq said.. I'd like to wrap the yield statement into different functions so that the user of my api doesn't actually realise that they're inside a coroutine...
21:40:28fowlo
21:40:50toolmakerAraq: Is what I'm saying correct?
21:40:52fowli dont use stacks or threads because i'm too much of a maverick
21:41:45toolmakeryou use stack all right :) that's whenever you make function calls or just allocate things by doing something like int a = 1; and such..
21:42:07fowli meant coros not stacks >_.
21:42:25toolmakeroh.haha..
21:43:16Araqtoolmaker: a closure iterator keeps its state in a closure and so can be used for a simple tasking system
21:43:59Araqand you can get quite far since you can have a 'yield' in a template
21:44:38Araqthe compiler doesn't transform it into a loop but into a state machine
21:44:41toolmakerhmm…right
21:45:11toolmakerSo, what's the difference really?
21:45:27Araqit captures locals but not the call stack
21:45:56Araqso you can't use recursion
21:46:20toolmakerI'll have a look at this…I think I could make it work…recursion isn't a problem in my case; i could avoid it
21:46:56Araqit is good enough for C#'s async stuff
21:47:10toolmakerAraq: how exactly does memory allocations work? Can I specify the initial size of the memory arena or does the allocations happen incrementally?
21:47:23Araqas C# uses essentially the same implementation
21:48:43Araqtoolmaker: happens incrementally
21:50:28toolmakerAraq: I see..I'll have a look at the docs once again and play with it more..
21:51:19fowlhttps://github.com/fowlmouth/asteroids :>
21:51:21toolmakerThe part of the world I'm from, it's 3:35 in the morning right now. Where are you guys located? When can I find you guys in the room normally?
21:51:48Araqit's 23:55 here
21:52:06fowl2:50 PM here
21:52:29toolmaker2:50 PM or 2:50 AM fowl?
21:52:30gradhait's tuesday here
21:52:49fowlPM
21:52:58*OrionPK joined #nimrod
21:53:13toolmakerCA.. i see...
21:53:33dom96toolmaker: interesting time zone, where are you from if you don't mind me asking?
21:53:45toolmakerNepal
21:53:58toolmakerfar far away huuh?
21:53:59toolmaker:)
21:54:23toolmakerI'll be back when I have questions.. gotta go sleep .. see you guys later
21:54:36Araqsame here
21:55:09*toolmaker left #nimrod (#nimrod)
21:58:43*gradha quit (Quit: bbl, have youtube videos to watch)
22:04:14*fowl quit (Ping timeout: 245 seconds)
22:46:43*fowl joined #nimrod
22:47:00*Trix[a]r_za is now known as Trixar_za
22:50:46fowlanybody know whats going on here https://gist.github.com/fowlmouth/5666749#file-ubbtree-nim-L40
22:53:06fowldoesnt make sense
22:53:34fowlbb(0,0,1,1) == bb(0,0,1,1) is true
22:58:44dom96argh, now I regret I didn't "schedule" this downtime an hour earlier
22:58:48*dom96 yawns
23:06:11fowldom96, what are you working on?
23:06:42dom96currently nothing why?
23:07:47fowlwant to take a look at my issue?(:
23:10:34dom96sure, i'm probably too tired to be of much help though
23:11:53dom96So the compiler generates incorrect C code?
23:12:39fowlno i dunno about that error im going to submit an issue for it
23:12:48fowlthe problem is one.bb isnt matching bb(0,0,1,1)
23:12:55fowl`==` i should say
23:14:16dom96interesting, perhaps try finding the definition of `==` for tuples, maybe you can figure out what's happening by adding some echo's in there
23:15:53fowlabove that an assert bb(0,1,2,3) == bb(0,1,2,3) passes
23:17:02dom96what's the definition of 'bb'?
23:17:39fowlproc bb[T: TNumber] (x,y,w,h: T): TBB = (x.float,y.float,w.float,h.float)
23:18:42fowlhm i changed it to let test_one = one.bb and get a cgen error
23:19:07dom96maybe the macro is doing something funky
23:21:19fowlyea these macros are super complicated
23:21:26fowlunittest.nim
23:21:42fowlthe use of macros, templates, overriding consts
23:21:55dom96if you're getting cgen errors then perhaps the compiler is generating incorrect C code even when gcc compiles it.
23:22:26fowlyea
23:22:30dom96Does it still happen if you don't use the macro?
23:24:36fowlyep same err
23:25:31fowl test_one = one_84047.Field0;
23:25:57dom96can you create an example without the dependency on your libs?
23:26:12fowlweird its using field0 it should be field1
23:29:38fowlit works if i access it with [1]
23:31:10dom96sounds like a pretty serious bug
23:35:26fowland now its not happening -_-
23:37:49fowlok so it only happens if i use the (a: x, b: y) syntax to declare them
23:43:59fowlthanks dom96
23:44:30dom96no worries