<<13-09-2012>>

00:25:48*XAMPP quit (Ping timeout: 268 seconds)
01:12:16*zahary quit (Quit: Leaving.)
07:30:21*Araq_ joined #nimrod
07:52:42*Araq_ quit (Quit: ChatZilla 0.9.88.2 [Firefox 14.0.1/20120713134347])
11:35:16*silven_ joined #nimrod
11:40:58*Amrykid_ joined #nimrod
11:42:24*Amrykid quit (*.net *.split)
11:42:25*silven quit (*.net *.split)
11:47:47*shevy quit (Ping timeout: 244 seconds)
11:50:49*shevy joined #nimrod
12:04:03*Trix[a]r_za is now known as Trixar_za
12:23:16*silven joined #nimrod
12:25:19*silven_ quit (Ping timeout: 274 seconds)
12:25:20*reactormonk quit (Ping timeout: 304 seconds)
12:37:04*silven_ joined #nimrod
12:42:50*silven quit (Ping timeout: 260 seconds)
12:44:51*Araq_ joined #nimrod
12:55:56*Reisen_ joined #nimrod
13:02:22*ccssnet quit (*.net *.split)
13:02:23*Reisen quit (*.net *.split)
13:04:12*Araq_ quit (Quit: ChatZilla 0.9.88.2 [Firefox 14.0.1/20120713134347])
13:20:13*ccssnet joined #nimrod
13:32:00*Trixar_za is now known as Trix[a]r_za
13:34:51*XAMPP joined #nimrod
13:42:35*ccssnet quit (Ping timeout: 244 seconds)
13:45:09*ccssnet joined #nimrod
14:21:14*reactormonk joined #nimrod
15:19:15*zahary joined #nimrod
15:36:24*armin_ joined #nimrod
15:36:41reactormonkzahary: you changed EOL? https://github.com/Araq/Nimrod/commit/c5ae2e4f74f07eb4c79a7d7a0467458d7a19a1a3
15:38:03dom96hey guys
15:38:04*silven_ is now known as silven
15:38:36dom96hey armin_, are you new?
15:46:08zaharyreactormonk, yep
15:51:40reactormonkzahary: unix or dos now?
15:56:51zaharyunix, it was mixed dos/unix so that's why I changed it
15:58:31reactormonkuh-oh
16:01:50reactormonk♥ synergy
16:11:00*armin_ quit (Remote host closed the connection)
16:38:22*shevy quit (Ping timeout: 252 seconds)
16:43:34Araqzahary: var s = @[] shouldn't compile
16:43:46Araqnor should 'var s = nil'
16:44:13Araqthe type seq[void] is not first class
16:50:42zaharyhmm, true - but it should be an error
16:50:53*shevy joined #nimrod
16:51:46zaharyI mean - it goes all the way to error in the C source and gcc error message
16:52:21Araqtypes.typeAllowed() is supposed to catch seq[void] for a 'var' ...
16:52:36Araqbut it doesn't for some reason
16:53:02Araqin fact, typeAllowed() is incredibly prone to errors
16:53:11AraqI dunno why really ...
16:54:09Araqwell it's easy this time :-)
16:54:56*apriori_ joined #nimrod
17:04:32Araqhi apriori_
17:05:21apriori_hey Araq
17:05:28apriori_I saw zahary worked on my ticket
17:05:45Araqreactormonk: I fail to see how your pull request implements #189 ;-)
17:05:54Araqthe codegen part is missing
17:06:51Araqthough I guess we should really implement it with a TR macro to test this feature extensively
17:09:08zaharybtw, what is supposed to be changed for #189? if some computation produces a subnormal float this will be considered error?
17:10:20Araqmy idea is that any proc result is checked for NaN, INF or subnormal float
17:10:38Araqcurrently we only have Nan and INF checking for +, -, /, *
17:10:58Araqwhich is hardly enough
17:11:30Araqan alternative would be to decorate math.sin et al
17:12:35zaharythis certainly is not right - there is nothing wrong with subnormal floats from "code correctness" point of view - after all they were introduced to squeeze even more precision in the values close to 0
17:13:03Araqthere is infChecks:on|off, nanChecks:on|off
17:13:04zaharythey only hurt performance, but rounding them to 0 is up to the application
17:13:18Araqand there will be subnormalChecks:on|off
17:13:31zaharyand even then, I don't see anyone wanting to produce errors when float becomes subnormal
17:13:50Araqwhy not?
17:13:56Araqit's useful for debugging
17:14:33zaharysome value got really close to zero… this doesn't sound like bug to me
17:15:13Araqif it's a performance issue that you're hunting, it's a bug
17:15:27zaharyok, will they be off by default?
17:15:31Araqsure
17:15:48Araqinf and nan checks are off too by default
17:16:04Araqrenox moaned about it but then he always does
17:16:21Araqand bootstrapping doesn't work with them turned on
17:16:22zaharyI meant "off by default in debug".
17:16:27Araqyes
17:16:37zaharyaha, ok then
17:16:44zaharybtw there are counters for such things in profilers
17:17:14Araq*shrug* I still search for a stack trace profiler
17:17:25Araqthe one you suggested was for windows only iirc
17:17:39AraqI guess I'll implement my own :-)
17:18:36zaharyI meant hardware counters - just like the profiler can tell you where are your L2 cache misses
17:18:53zaharyI'm not sure about subnormal floats tho
17:19:16zaharywhat is usually suggested is to set the CPU to round such values to 0 (again this is hardware mode)
17:27:21Araqwhat do you do to get consistent results between different cpu architectures btw?
17:27:34AraqI heard that's a hard problem for games
17:36:56reactormonkAraq: huh?
17:37:15reactormonkAraq: hmm, I'll take a look again then
17:37:28zaharyyou mean floating point computation results?
17:38:32reactormonkAraq: oh, you want the floatGuard in there as well? Where do I put them?
17:40:42*zahary quit (Read error: Connection reset by peer)
17:40:55*zahary joined #nimrod
17:41:16Araqreactormonk: I don't know yet ;-)
17:41:36Araqzahary: I mean exchanging FP values over the net
17:41:49apriori_Araq, zahary: so far the array issue seems to be fixed
17:42:00apriori_however, name doesn't seem to be fixed, yet
17:44:13reactormonkAraq: oh, oke
17:44:15Araqdom96: still no feedback from the linguist guys?
17:44:20reactormonkAraq: floating point operations?
17:44:42dom96Araq: Nope.
17:44:48Araq-.-
17:45:26Araqgithub is starting to piss me off
17:46:12apriori_Araq: what's wrong?
17:46:32Araqit doesn't recognize .nim as a Nimrod file extension anymore
17:47:01Araqso it claims the nimrod compiler consists of C ( 65%)
17:47:30Araqsome absurd nokia media file format uses .nim as extension too ...
17:47:41Araqso they "fixed" it
17:47:50zaharyaraq, are there architectures that don't use the IEEE representation? you got me thinking, but I think only endianness is what we consider...
17:47:52apriori_lol
17:48:20Araqzahary: x86 uses 80bit floats internally for a start
17:48:41zaharywell, alright, but that's on the CPU internal stack
17:48:46Araqso that can produce different results than an e.g. ARM
17:49:17zaharythere are differences in computed results, sure, but no differences when two system have to agree on a value sent on the network
17:49:25Araqwell if you compute on an ARM client, send the value to an x86 server
17:49:30zaharyI thought this is what you ask about
17:49:40reactormonkAraq: write a ticket @ github
17:49:48reactormonkor I could :-P
17:50:03Araqand the server computes it too and then you check for consistency
17:50:19Araqyou need an epsilon comparison I guess
17:50:54dom96reactormonk: https://github.com/github/linguist/issues/238
17:50:58dom96+1 that.
17:51:00dom96Might help.
17:51:03zaharyfloats are really bad for determinism, which is important for games - that's why I said the problem with network synchronization is getting tougher with modern physics engines
17:51:45Araqwell yeah that's what I'm asking about
17:51:49reactormonkdom96: gimme code, I can take a look
17:51:53zaharybut what you do is to send "key frames" from time to time from the server to which the client then tries to gradually interpolate its local state
17:52:09dom96reactormonk: huh?
17:52:32reactormonkehh
17:54:40Araqreactormonk: it's fine, I'll implement the missing pieces once I know what I want ;-)
17:58:06zaharyI think that even if someone cares for subnormal checks, it's more likely that he wants to know "how many times did this happen?" then to receive error on the first occurrence
17:59:26Araqhrm
18:00:01reactormonkzahary: warnings vs. errors in the condition system
18:01:04Araqtemplate subnormalGuard{f}(f: float{call}): expr = let x = f; checkSubnormal(x); x
18:01:27reactormonkAraq: ehh why the x=f?
18:01:38Araqevaluate once?
18:02:26reactormonkwhy would it eval more than once?
18:02:51AraqcheckSubnormal(x); x # 2 occurances of 'x'
18:04:16Araqzahary: why are physics engines special in this regard?
18:08:18zaharybecause it's much easier to base your other game logic on integers - so if you need determinism somewhere you just switch to fixed precision (decimals) for example
18:10:02Araqugh, I see
18:10:16Araqthat means no INF though ;-)
18:10:40AraqI really prefer saturated arithmetic now
18:11:06Araqmodulo arithmetic is a security desaster
18:11:31Araqand overflow checking is likely to be too expensive
18:12:49apriori_zahary: may I ask what your background is regarding physics engines?
18:12:52zaharynever thought about it, but there are certainly some hacks that make use of overflow (not in the malicious sense)
18:13:34zaharyI'm gamedev programmer too, apriori_
18:14:22Araqplus +-INF are really nice for min/max
18:14:35apriori_zahary: ah, interesting
18:14:57apriori_Araq: guess you will get your gc stresstests in a soft realtime environment.. which you wanted ;)
18:20:26zaharyAraq, you can designate some value to mean INF if you want I guess (still you will have to guard every computation then) - someone could say that INF as max is not nice, because INF - 10 = INF
18:21:28AraqINF - 10 = INF is a good point, though it barely matters for min/max aggregations
18:22:17zaharyah, that's what you mean - INT_MAX isn't good enough there?
18:22:43Araqwell yeah, it is
18:23:18Araqthough INF feels cleaner for this ;-)
18:23:49zaharyonly the Mathematica way of doing is really right :) (PI / 3) * 3 = PI
18:24:32AraqI'm thinking about elemSize*sizeof(T) + headerSize
18:25:11Araqwith saturated arithmetic you can simply check afterwards if the bytesize <=% someMax
18:25:42Araqto check against malicious values in binary files
18:26:16zaharyyeah, you can be right that it has resulted in more evil than good
18:26:17Araqwith exceptions on overflow you have these ugly try..excepts around the code
18:26:44Araqand with modulo arithmetic you get bugs
18:28:16Araqanyway, here is a new problem:
18:28:20apriori_hm
18:28:29Araqtemplate tmpl(s: stmt): stmt = s
18:28:30Araqtmpl:
18:28:32Araq var xyz = 223
18:28:34Araq echo xyz
18:28:40apriori_isnt actually quiet_Nan and normal for that purpose? like.. if you care, you can choose the way?
18:28:50AraqError: redefinition of 'xyz'
18:29:41Araqbrb
18:30:57zaharyhmm, is this some recently introduced problem?
18:31:31Araqyeah, note the absense of immediate
18:31:51Araqplan is to support ':stmt' blocks and still have overloading resolution
18:32:03zaharyah
18:32:08Araqbrb
18:54:26Araqback
18:55:29Araqwell I guess tyStmt should be special in semOpAux?
18:55:43Araqbut then we don't know the formal parameter yet
18:58:11Araqapriori_: never heard of quiet_NaN
18:58:19Araqand I don't understand its docs
18:58:38apriori_https://en.wikipedia.org/wiki/NaN#Quiet_NaN
18:58:40zaharyquietNaN doesn't raise hardware exceptions
18:58:41apriori_hm
18:58:42apriori_ok
18:59:02apriori_well, one could even think about a software variant to that
18:59:17zaharybut we were talking about overflow vs saturation, apriori_. This is what happens when you have INT_MAX + 10
18:59:30apriori_oh, okay.
18:59:47zaharywith overflow, you get 10. with saturation, you have saturated the value and it's still INT_MAX
19:00:09AraqI thought the CPU flags determine whether NaN is "quiet" or not
19:00:18apriori_so saturation is in fact modulo arithmetic
19:00:33zaharyno overflow is modulo arthitmetic
19:00:38zaharyno, overflow ...
19:00:57apriori_oh, yeah..
19:00:58apriori_wrong
19:01:03apriori_saturation is more like clamp
19:01:07zaharyyes
19:01:25Araqmodulo arithmetic is useful for implementing bignums and encryption
19:01:59Araqbut that doesn't make it the right default ;-)
19:02:44reactormonkdom96: I'm running the linguist on separate files... works quite good
19:02:50apriori_I doubt there actually is a "right" default
19:02:53reactormonkbut somehow, the overall distribution is a bit fail
19:05:52Araqzahary: we could also not semcheck the statements after the template invocation but this seems really dangerous
19:06:10apriori_was there a special syntax for function aliases?
19:06:13apriori_func A =
19:06:15apriori_func B =
19:06:17apriori_body
19:06:18apriori_doesnt seem tow ork
19:06:23Araqno
19:06:33Araqyou may omit () that's all
19:07:30dom96reactormonk: The problem rests with the mimetypes gem IIRC.
19:07:32apriori_I assume an operator can't alias a normal proc.. can it?
19:07:39zaharythe lazy sem is the way to go IMO - you pass it directOp without sem on it - if directOp figures out this is a proc that expects a closure, then we tried to sementize it as a regular closure body
19:08:03reactormonkdom96: hum
19:08:09zaharyif it ends up being passed to a macro or template, then they can modify it and we need to semantize only the result
19:08:25Araqbut what if we have:
19:08:27Araq template t(s: stmt)
19:08:33Araqproc t(s: proc)
19:08:38Araqt:
19:08:41zaharyyou seem to want another "ensure that is correct" mode before overload resolution?
19:08:48dom96reactormonk: They had a hack in place which overrode the mimetypes gem, but they decided to remove it for some reason.
19:09:01AraqI don't want anything atm
19:09:14Araqmy todo says: make 'm: stmt' use overloading resolution
19:09:27Araqand I'm sticking to my todo
19:09:44zaharyok :) template t(s: stmt) and t(s: proc) are ambiguous in my book
19:10:09zaharyI assume you mean proc () actually (not the type class)
19:10:17Araqhe he, true
19:10:46apriori_http://pastebin.com/PCbV7bxE
19:10:56apriori_another bug or what is wrong?
19:11:18Araqif you want 'dot' to alias '.*' you'd better say so
19:11:29Araq= v1 .* v2
19:11:49apriori_ok, then I just got it wrong..
19:11:56Araqand it's better to use *.
19:12:07Araqso that its precedence is right
19:12:12apriori_I thought there was a variant with just stating the function signature ..but well, ok
19:12:35apriori_ok
19:12:36Araqyou can hack with importc, exportc ;-)
19:12:54Araqproc a {.exportc: "nimA".} = ...
19:12:56apriori_I doubt you would allow such hacks in your stdlib :P
19:13:06Araqproc b {.importc: "nimA", nodecl.}
19:13:32Araqbut hrm dead code elimination does not like it
19:13:56Araqwhy have 'dot' at all?
19:14:16Araqone can always use `*.`(x, y) for prefix notation
19:14:50apriori_to some it might be just more clear to read "dot" instead of some obscure, randomly defined operator
19:14:59apriori_although.. doesn't octave/matlab use something similar?
19:15:31zaharysticking to the function names from HLSL/GLSL is nice - I would keep dot
19:15:44apriori_yep, another point
19:17:25Araqoh well, I'm better quiet
19:17:29Araq;-)
19:17:52Araqanyway, if semOpAux (absurd name btw) gets lazy ...
19:17:53apriori_Araq: I will even add the utf8 special symbol for cross product :P
19:18:06reactormonkdom96: I see what happens... .nim is detected as binary file
19:18:15Araqand then people will complain nim is like perl :P
19:18:51reactormonkblob.binary_mime_type?
19:18:55apriori_well, I see no reason not to actually reuse established math symbols for operations where it's possible
19:18:59reactormonk... then it skips it for detection
19:19:09Araqironically I always wanted file detection to only care about file extensions ...
19:19:10reactormonkso only the vendored files like .c and .h count
19:19:30reactormonkAraq: and now the dogs of the past come back to bite you :-P
19:19:38Araqtrue
19:20:37reactormonkI even got an idea of a fix
19:20:53Araqon the other hand, "linguist" shouldn't care about a Nokia multimedia file type
19:22:38dom96reactormonk: Yes, that is the problem.
19:22:59dom96reactormonk: If you could fix it and make a pull request it will be more likely they will integrate it.
19:23:12dom96Until they again decide to change something...
19:23:17*dom96 sighs
19:31:27Araqhrm
19:31:56Araqwe need this for type inference in lambdas too
19:32:09Araqp(x, y:: x < y)
19:32:58Araqoverloading snooping seems indeed the way to go
19:38:23Araqzahary: what if we have:
19:38:30Araqtemplate t(s: stmt)
19:38:39Araqtemplate t(x: int)
19:38:43Araqt:
19:38:45Araq 23
19:40:45zaharyI was going to support such implicit conversions in my hypolang
19:40:45zaharyfoo
19:40:46zahary bar
19:40:46zahary baz
19:40:46zahary… is another syntax for placing foo(bar, baz) call
19:41:22zaharybut from parsing stand point it is foo (stmt-list(bar; baz))
19:43:02Araqno the question is:
19:43:19Araq'int' requires semExpr for 23, 'stmt' doesn't want it
19:43:41AraqI guess 'stmt' is more powerful then?
19:44:24zaharyah, didn't I left some notes about my idea to query the overload set before semDirectOp
19:45:00Araqyeah and I read them
19:45:47zaharydo we consider t: 24 to be matching here?
19:45:48AraqI called "query the overload set" "overload snooping" ;-)
19:45:53*Trix[a]r_za is now known as Trixar_za
19:46:03zaharyis the question about which one is more powerful or just about what will be the flow in the code
19:46:41Araqwell I think t: 24 matches t(s: stmt)
19:46:46zaharysure
19:46:52Araqand so does t(24)
19:47:00zaharydoes it match t(x: int) ?
19:47:23Araqso in on overload set the positions marked with 'stmt' are really powerful as they disable semexpr for this position
19:47:24zaharyI mean t: 24
19:47:48Araqand then t(x: int) can't match as '24' has no type
19:47:57zaharythey don't disable it - stmt will happily examine only the nOrig part and it will decide to match
19:48:17Araqthere is no other part, n == nOrig
19:48:29Araqotherwise you semcheck the arg twice
19:48:41Araqwhich is wrong (redefiniton of 'xyz')
19:48:52zaharyint on the other hand will try to type the expression and int{static} will go even further by trying to evaluate it right there
19:49:26reactormonkAraq: how would you detect generated nim code?
19:49:32reactormonknimcache/* basically?
19:49:44zaharynotice how evaluating determines the type too, so we never lose important information
19:49:50Araqreactormonk: every .c file has a generated header
19:50:27zaharyyou snoop the overload set - if nobody wants types/evaluation, you proceed with n == nOrig. otherwise, we run sem there
19:50:28Araqhm I see
19:51:14Araqyou are aware that semcheck has side effects, so it's wrong, right?
19:52:35Araqbut I guess the nfSem flag takes care of it
19:53:05zaharyI'm probably not aware of all of them. do simple expressions have a lot of side effects too or is it the statements that worry you more
19:53:37Araqproblem is: I'm not aware of all of them either
19:54:24zaharywe have to fix these for compiles anyway
19:54:44zahary`compiles` the magic
19:54:58Araq'compiles' is special because it can be slow
19:55:11Araqand I think I got all the side effects for it
19:55:23Araqand they are undone properly
19:55:52zaharyhmm, you remember the last time we talked about them, right?
19:56:05Araqyeah
19:56:10zaharyabout the InContext variables, etc
19:56:18Araqwell?
19:56:27AraqI fixed that after the talk
19:56:54Araqbut it surely is expensive ;-)
19:56:59zaharyah, I see now - must have missed that in the diffs
19:58:32AraqI think you can have 'var x {.global.}' affect an outer scope
19:58:39Araqand then we can't undo that
19:59:11Araqbut I consider it irrelevant
20:00:09reactormonkdom96: there we go
20:00:28dom96reactormonk: How did you do it?
20:02:11reactormonkdom96: see pull request
20:02:26zaharyguarding such side effects with ifs probably won't be too expensive - If I have to guess I would go for less than %5 degradation
20:02:32reactormonkdom96: if you got a better wording, tell me
20:02:46zaharysome flag assignment to symbols is in the same category btw
20:03:00Araqzahary: indeed and we already have these
20:03:08Araqfor gensym support
20:03:29dom96reactormonk: @josh just replied.
20:03:30Araqand there are some special cases for system.compiles() to speed it up
20:03:46dom96reactormonk: It seems pull requests get quicker responses.
20:03:54Araqit doesn't generate error messages for instance
20:04:16reactormonkdom96: because they don't require work from their side
20:04:45dom96reactormonk: yes
20:06:00Araqbtw the AST allows for (a = x; x) # assignment in expressions
20:06:13Araqand that's really bad for TR macros
20:06:31zaharywhy bad about them specifically?
20:06:39Araqbecause you then have to guard against these somehow
20:06:56zaharyaha, I see
20:07:10Araqwe have 'noalias' which suffices for optimizations of the pattern:
20:07:22Araqa = f(x, y)
20:07:39Araqbut not if 'x' can modify 'a'
20:07:42AraqI think ...
20:08:57zaharyI personally don't care much for (a = x; x) - you consider this useful because one can write if (file = open("foo"); file) ?
20:09:39AraqI dislike it too but the AST allows it
20:09:50Araqso it can be generated by a macro
20:09:58Araqand semcheck doesn't mind it
20:10:35zaharyare you talking specifically about nkStmtListExpr ?
20:10:40Araqyes
20:11:03zaharymaybe we can say that the statement list part gets detached in such situations
20:11:14Araqwhich is the same as nkStmtList once the expr/stmt merge is complete
20:11:28zaharyonly the expression part is what gets copied arround
20:11:53zaharywe have to look at some concrete example to reason better about it
20:12:03Araqy or (a = f(); a)
20:12:12Araqis useful and you can't lift the assignment
20:13:24apriori_hrm
20:13:41reactormonkdom96: let's see what happens
20:14:02*apriori_ quit (Quit: Konversation terminated!)
20:14:12*apriori_ joined #nimrod
20:14:29apriori_proc cross*[T](a, b: TVector3[T]): TVector3[T] = a ⨯ b
20:14:34apriori_vector.nim(81, 56) Error: undeclared identifier: 'b'
20:14:35apriori_:/
20:14:40dom96reactormonk: I hope they fix it.
20:14:55Araq'x' is a unicode operator
20:15:05apriori_yup
20:15:05zaharyfirst, nkStmtListExpr is very cool so I upgrade the importance of the issue :)
20:15:08apriori_is that a problem?
20:15:21Araqwhich the compiler doesn't support yet
20:15:26apriori_damn
20:15:27apriori_ok
20:15:55zaharybasically the promise there is that the stmtlist part will be executed before the expr part is evaluated for the first time
20:15:56Araqgive me a list of useful unicode operators and I will gladly update the lexer ;-)
20:16:24apriori_hmm
20:16:30zaharycan we somehow ensure that this is carried out by the code generator itself (so it doesn't have effect on semantics and we still can treat the expression as normal citizen)
20:16:55Araqthat was my plan
20:17:18Araqcodegen already "lowers" everything to a statement + goto
20:18:18AraqJS backend needs more work
20:18:36Araqbut it seems possible
20:20:21Araqbut semcheck needs to forbit nkStmtListExpr in many places:
20:20:24Araqcase x
20:20:46Araqof (y = 4; myConst):
20:20:53Araqreally?
20:21:40Araq'expr' is everywhere in the grammar ...
20:22:15zaharyyeah, it's hard to intuit what this should even mean
20:23:32Araqvar fac10 = (var x = 1; for i in 2..10: x *= i; x)
20:24:02zaharywell, this seems much more classical use
20:24:16Araqwell yeah, it often composes nicely
20:25:50zaharyit's hard to reason when it produces a const as in your example above - this const disappears from the computational flow of the program - it will be precomputed by the compiler and will only affect the layout of the code for the switch statement
20:26:33AraqI don't think it's the 'const' but the fact the last expression in the list has nothing to do with the assignments
20:28:14zaharythat too - but if there was a "step" in the executed that corresponded to the switch statement case (not after it's matched, but the case itself), then you can say - well, just make that step do this additional thing
20:29:01Araqtrue
20:29:14Araqon the other hand it could simply be the same as:
20:29:27Araqof myConst: y = 4; ...
20:29:47zaharydoesn't sound intuitive
20:30:44zaharyimagine you are computing a regex value that will be used to match in a ruby-like case statement (more likely you'll expect the side effects to be performed once at program startup before the value is computed)
20:31:28Araqwell yeah
20:31:47Araqwhat about {(x = 3; 3)} # set constructor
20:32:07AraqI will disallow it there too
20:32:26zaharyyeah, sounds like the same principle
20:32:31Araqin fact, I think nkStmtListExpr will be whitelisted in the compiler's code
20:32:46Araqand every other occurance shall trigger an error
20:37:21Araqbut then transformating f() to (let x = f(); check(x); x) should be allowed everywhere
20:37:29Araq*transforming
20:38:31Araqon the other hand check(f()) would do too
20:48:22apriori_Araq: how would I reference e.g. operator '<' as the default predicate in a function signature?
20:48:44apriori_algorithm.nim(4, 57) Error: '<' cannot be passed to a procvar
20:48:50apriori_for: proc max*[T](v: openarray[T], p: TPredicateProc[T, T] = `<`): T =
20:48:53Araq:P
20:48:57apriori_with: TPredicateProc[T, U] = proc(a: T, b: U) : bool
20:49:19*Amrykid_ is now known as Amrykid
20:49:31Araqdon't do that
20:49:39apriori_do what?
20:50:07Araqit doesn't work yet
20:50:32Araqp = `<` # can't work because it's not a real proc
20:50:34apriori_what specifically? only the assignment of the operator proc?
20:50:39Araqhowever if you do:
20:50:59Araqproc myLt[T](a, b: T): bool = return a < b
20:51:25Araqproc max(v; p = myLt)
20:51:25apriori_so pretty much an alias
20:51:58Araqthen that wouldn't work either due to compiler bug/unimplemented feature
20:52:16apriori_seems I stress your compiler hard :P
20:52:39Araqwho uses 'max' with a predicate anyway
20:52:50apriori_for non arithmetic types
20:53:04apriori_sort by key, member or what not
20:53:19apriori_or well, pick max in that case
20:54:26Araqmake it an overload
20:55:05Araqproc max(v) # use <
20:55:19Araqproc max(v; lt) # use lt()
20:55:58apriori_then max would just become an alias for max(v, defaultLT)
20:56:19Araqno because '<' is not first class
20:56:31Araqand you want the specialization anyway
20:57:20apriori_what do you mean by "first class"?
20:57:32apriori_I just want to prevent code duplication where its not necessary
20:58:08Araqyou can't pass '<' to a procvar, that's what "first class" means
20:58:15apriori_yeah, I know
20:58:24apriori_so I just write that internal alias for `<`
20:58:28apriori_and use that instead
20:58:40Araqno, I'd do:
20:58:42apriori_but even then.. max(v) = max(v, alisForLT)
20:59:04Araqtemplate maxImp() =
20:59:16Araqer:
20:59:29Araqtemplate maxImpl(lt: expr) {.immediate.} =
20:59:42Araq result = v[0]
20:59:56Araq for i in 1 .. v.high:
21:00:02Araq etc ...
21:00:22Araqproc max(v) = maxImpl(`<`)
21:00:34Araqproc max(v; lt) = maxImpl(lt)
21:00:44apriori_interesting...
21:00:49apriori_but definetly confusing to read ;)
21:01:08apriori_well, I guess, I gonna take that solution
21:01:20Araqit's idiomatic nimrod code
21:01:37apriori_as said.. takes time to get used to it ;)
21:01:40Araqgeneric bodies often are identical
21:01:47apriori_yeah
21:01:51Araqso are put into a template
21:03:47apriori_what is the meaning of "immediate"?
21:04:20Araqread the manual
21:04:30apriori_k, didnt find it in the index
21:04:46Araquse the nimbuild docs
21:05:21Araqit's all newhttp://build.nimrod-code.org/docs/theindex.html
21:06:04AraqI'm not sure we made the right decision
21:06:29Araqmost usages of templates are 'immediate' ...
21:06:39Araqseems we picked the wrong default
21:06:54*Amrykid quit (Changing host)
21:06:55*Amrykid joined #nimrod
21:06:55apriori_hm
21:09:28Araqbut hey, overload snooping could fix that too :-)
21:11:26Araqzahary: using 'expr' for undeclared identifiers is also stupid
21:11:48AraqI should have introduced 'ident' as a special type
21:12:11Araqand then overload snooping can do a better job
21:12:31*shevy left #nimrod ("I'll be back ... maybe")
21:15:07zaharyyou mean new ident type instead of expr{ident} ?
21:15:19zaharysounds fine by me
21:15:28AraqI mean:
21:15:46Araqtemplate declareInScope(x: expr, t: typeDesc): stmt {.immediate.} =
21:15:48Araq var x: t
21:15:59Araq'x' is hardly an expression here
21:16:20Araqit's the name of the variable
21:16:33Araqwell what will become the name
21:16:33zaharybut we have all kind of these. expr{nkIdent} and expr{ident}
21:16:45Araqexpr{ident} is much better yeah
21:17:32zaharyI read in the docs that you added expr{ident} for the proxy types handling - i.e. it have a meaning specifically of unknown ident?
21:18:07Araqyes
21:18:20Araqan "unbound" identifier/symbol
21:18:31zaharyso it's different than expr{nkIdent} which doesn't care about such things?
21:18:53Araqno, nkIdent is the same
21:18:59zaharyaha, ok
21:19:20Araqwell it's kind of pointless for TR macros
21:19:29Araqas they should never see an nkIdent node
21:19:59Araqbut since we will get the constraints for all parameters, it's fine
21:20:04zaharybut what's the latest plan? I can add earlier TR pass that matches more raw AST?
21:20:46AraqI think we can do without an earlier TR pass
21:21:18Araqproc proxy(x: TMyObject, y: expr{ident}) # works with overload snooping
21:21:34zaharyso special case for proxy types?
21:21:45Araqhow is that a special case?
21:22:08Araqit works naturally with what we have in mind
21:22:26Araqer ...
21:22:29zaharyit has to intercept nkCall earlier (there is no overload resolution here, because the parameter is the name of the function itself)
21:22:38Araqok, I'm tired ;-)
21:22:59Araqwell yeah, special case for proxies then
21:23:11Araqbut I think they should get priority:
21:23:15zaharyok, I guess it works for me as I don't have much more uses for that right now
21:23:39Araqproxy.p(x)
21:23:42zaharyyes, if there isn't good matching overload try the proxy road
21:23:50Araqnope
21:24:08Araqtry the proxy road before overload resolution
21:24:18Araqso that it can override stuff
21:24:29zaharybut I want missing methods to complement the existing ones
21:24:35Araqit can always delegate to ordinary overload resolution
21:24:58Araqcase ident
21:25:03Araqof "x": ...
21:25:07Araqof "y": ...
21:25:26Araqelse: tryOrdinayCall()
21:25:51Araqseems much more flexible, right?
21:25:54zaharyI would prefer at least a pragma to control it
21:26:57Araqwhy?
21:28:00Araqwhat do you fear?
21:28:54zaharyI think method_missing will be the more popular usage scenario. also, you control the methods - if you want to augment them all in some specific way, you can put something common on the first line in all of them or use a helper to define the procs that automatically insert the common bits
21:29:41zaharymuch like
21:29:41zaharycompiler gcc:
21:29:41zahary result = (
21:29:41zahary name: "gcc",
21:29:41zahary objExt: "o",
21:29:42zahary optSpeed: " -O3 -ffast-math ",
21:29:42zahary optSize: " -Os -ffast-math ",
21:29:43zahary compilerExe: "gcc",
21:29:43zaharyin extcomp
21:33:05zaharyalso, you never have case ident of "x"; of "y". what's the point of proxy type when you know what the idents are going to be
21:33:34Araqsaving typing?
21:33:35zaharyyou can have regular procs instead of these fixed cases - what you want is to have a common code for all unknown cases
21:34:12Araqyeah but things are never this easy:
21:34:25Araqvar x = 0
21:34:26zaharyluaObject.foo and luaObject.bar both translate too luaObject.placeCall(ident, ....)
21:34:43Araqecho p.x
21:34:46Araq-->
21:34:54Araqecho x(p)
21:35:08Araq# is not confused by the 'var x = 0'
21:35:34Araqthe compiler has some extra logic for that ;-)
21:35:49Araqbut it still makes me feel uneasy ;-)
21:36:21zaharyI don't quite follow - there is certainly a normalization step that has to be done before you enter the proxy macro, but this is orthogonal to what we talk about?
21:37:04zaharyin both cases - p is the proxy typed value and x is the ident
21:37:19Araqhrm yeah true
21:37:25AraqI should sleep
21:38:14reactormonkAraq: anything further on the floating checking front?
21:38:44Araqreactormonk: I think I'm gonna close that ticket and tell the guy to use a TR macro to get what he wants
21:38:52reactormonkTR macro?
21:39:07Araqafter have made sure that that actually works ;-)
21:39:12Araq*having
21:39:22AraqTR macro = term rewriting macro
21:39:36reactormonkah
21:39:52Araqso no yet another compiler switch for subnormals
21:42:44Araqzahary: since it's your feature, you'll get it your way
21:42:52Araqgood night guys
21:43:20zaharygood night
21:55:08zaharyreactormonk: tell me if the unit test library print too much information now :)
22:13:12apriori_time for bed
22:13:14apriori_bye all
22:13:17*apriori_ quit (Quit: Konversation terminated!)