<<12-09-2012>>

00:54:39*XAMPP quit (Read error: Connection reset by peer)
00:55:07*XAMPP joined #nimrod
05:14:43Araqreactormonk: use a 'ref EFloat'
05:14:46Araqand
05:14:52Araqnew(err)
05:15:05Araqerr.reason = status
05:15:09Araqraise err
05:15:14Araqhave to go, bye
09:05:40*armin__ joined #nimrod
09:06:16*armin__ is now known as apriori_work
09:42:23*Araq_ joined #nimrod
09:43:03Araq_apriori_work: I like your tuple idea
09:43:25Araq_and in fact it's almost already implemented in the current compiler
09:55:04apriori_workAraq, good ;)
09:56:19apriori_workoverload resolution should of course prefer the precise tuple description over an anonymous match
10:02:11*Araq_ quit (Read error: Connection timed out)
10:03:38*Araq_ joined #nimrod
10:07:56Araq_arg, really?
10:08:09Araq_we'll see about that :P
10:21:38*Araq_ quit (Quit: ChatZilla 0.9.88.2 [Firefox 14.0.1/20120713134347])
10:35:51*zahary1 quit (Ping timeout: 245 seconds)
13:42:17*Boscop quit (Disconnected by services)
13:42:20*Boscop joined #nimrod
14:37:29*Trix[a]r_za is now known as Trixar_za
14:40:01*Boscop quit (Ping timeout: 246 seconds)
14:42:36*Boscop joined #nimrod
14:49:15Trixar_zaHa, the mental state I have for the word Nimrod is overloaded since I think of three distinct things when I hear or see the word.
15:30:15*zahary joined #nimrod
15:37:05fowlhey Trixar_za whats going on
15:38:09Trixar_zaNot much. Went a little gambling last night. I normally don't gamble because I'm like a money sink. It all just disappears
15:38:29Trixar_zaBut last night I was milking machines. I walked in with 200 and walked out with 1500
15:38:53Trixar_zaPlaying on a 2c machine too
15:41:46fowlcool
15:42:39fowlive only gambled a few times, afterwards i wished i had spent the money on weed instead
15:43:24Trixar_zaI have more sense than my dad though. Every time I just won big, I worked down to a round number and cashed out. Left 50 on the card and started again.
15:43:52Trixar_zaMy dad keeps gambling even when he has won big :/
15:43:57*apriori_work quit (Remote host closed the connection)
16:08:03*apriori_ joined #nimrod
16:13:43*Boscop quit (Disconnected by services)
16:13:46*Boscop joined #nimrod
16:15:43reactormonkgambling is a tax for people who don't know math?
16:16:06fowlha i like that
16:17:10*Boscop quit (Disconnected by services)
16:17:13*Boscop joined #nimrod
16:38:13*shevy quit (Ping timeout: 260 seconds)
16:48:57apriori_Araq: http://pastebin.com/yfjKX1YQ is that a compiler bug?
16:49:21apriori_I mean, you said, values are not allowed but proposed to use an IDX type instead.. not quite sure how that should work
16:50:55*shevy joined #nimrod
16:51:16Araqapriori_: yeah, bug ... but '..' is also a proc these days
16:51:27Araqhm
16:51:36reactormonkAraq: so I can only pass a ref object to raise?
16:51:43Araqreactormonk: yes
16:51:58Araqerror message is misleading, I know
16:52:43reactormonkchange it
16:52:50Araqapriori_: try to use TVector[range[0..2], T]
16:53:09apriori_Araq: working
16:53:36Araq'..' is ambiguous ...
16:53:56Araqit has special meaning in 'array' and 'range'
16:54:03apriori_ok
16:54:07Araqdunno what to do about it
16:54:27AraqI will think about it
16:54:31apriori_np
16:55:11apriori_currently, I wonder whether it'd be a good idea to manage matrices only as flat arrays
17:00:44apriori_Araq: also I wonder about the following.. in e.g. D I could build a template struct, which uses the dimension to build the respective array and also provide accessors (array wise and componenet name wise)
17:01:28apriori_is there a way to "automatically" create such stuff, if a type "pattern" like TVector3[T] = array[0..2, T] is declared?
17:01:59apriori_say.. a user will write in his type section: type TVector3F = TVector3[float]..
17:02:15apriori_well, in that special cases it makes no real sense to be able to do that, because generics will just suffice
17:03:13apriori_a more useful example: we got TVectorN*[A, T] = array[A, T]
17:03:57apriori_and on instanciation of TVector3F = TVectorN[range[0..2], float] I would also like to autogenerate accessors like x, y, z
17:04:30apriori_actually, even those can become generics.. but I see no way to properly generalize depending on the length of the vector
17:04:38apriori_e.g. 2 D or 4D
17:05:23apriori_do you understand what I mean?
17:07:06reactormonkAraq: http://sprunge.us/MHNh but it doesn't compile - http://sprunge.us/SGJg
17:09:41reactormonkhm, no !! in nimrod to convert any value to bool? nil => false, everything else true
17:10:42Araqsorry brb
17:21:28Araqreactormonk: your code is fine, but you mustn't import artihm.nim
17:21:41Araqas it's part of system.nim
17:22:13Araqhow would !! work in nimrod?
17:22:56Araqapriori_: accessors can be put into a template I guess and then you can instantiate that if you want them
17:23:10apriori_hm
17:23:22apriori_some "onInstantiate" pragma would be awesome..
17:23:26fowlproc `!`(a: pointer): bool = return not isNil(a) ?
17:23:33apriori_that would then call template/macro
17:25:34Araqare accessors really useful for vectors?
17:26:07AraqI think they are stupid, you can't abstract the access anyway for performance reasons
17:26:43Araqand you can easily do: const x = 1
17:26:48Araqv[x]
17:26:49apriori_they might.. but they really increase readability
17:27:12Araqor proc x(v ...)
17:27:15Araqv.x
17:27:26apriori_that proc would be the way
17:28:25reactormonkAraq: as I mentioned, convert everything but nil to true
17:30:06Araqin C, !x means x == NULL
17:30:24Araqso it could be confusing
17:31:54Araqzahary wants "proxies" for v.x
17:32:13Araqbasic idea is to mark 'TVector' with a macro
17:32:30Araqwhich is queried if v.UKNOWN is found
17:32:36Araq*UNKNOWN
17:33:11AraqI think this would solve your problem, apriori_
17:33:19apriori_yup
17:33:34apriori_another "problem" would be .. accessing matrix entries
17:33:43apriori_I think the following would work, but look awful:
17:33:51apriori_matrix[(i, j)]
17:34:04Araqnah, you can easily overload []
17:34:12apriori_that would be an overload
17:34:14apriori_taking a tuple
17:34:24Araqproc `[]` (m: TMatrix, a, b: int)
17:34:40Araqand then invoke it with: m[i, j]
17:34:42apriori_would that be: matrix[a, b] ?
17:34:53apriori_very nice ;)
17:34:59Araqyeah, overloading of [] is special cased :-)
17:35:08Araqbtw there is also {} for column access
17:35:08apriori_awesome
17:35:36apriori_yeah, so we'd have:
17:35:46apriori_[a, b].. specific entry or even range
17:35:52apriori_(a submatrix)
17:36:03apriori_[a] for a row or range of rangs
17:36:07apriori_*rows
17:36:16apriori_and same with {} for columns
17:45:09reactormonkAraq: http://sprunge.us/WXBb <- code in question
17:46:15Araqwell what is the question?
17:47:00reactormonkAraq: floatCheck returns nil (aka no result = called) when the test fails
17:47:30Araqwhat is its return type?
17:47:42reactormonkof floatCheck? FPStatus
17:47:53reactormonkof the shortcuts? bool
17:48:06Araqhow can FPStatus ever be nil?
17:48:21reactormonk http://sprunge.us/KLCS
17:48:41reactormonkaka 'no match'
17:48:50Araqthat's not nil
17:48:59reactormonkbut?
17:49:11Araqresult == FPStatus(0) if not re-assigned
17:49:32reactormonkand what if not assigned?
17:49:36reactormonkah
17:49:39reactormonkups
17:50:05Araqactually we could have:
17:50:26Araqproc `!!`[T](x: T): bool =
17:50:44Araq var y: T
17:50:51Araq result = x == y
17:51:20Araqthat would check against T's default initialization value
17:52:16reactormonkseems like my idea of an API doesn not fit nimrod
17:52:45Araqseems you're in dynamic typing land in your mind
17:53:32Araqbut your API looks nice, there is no problem
17:53:45Araqyou don't need 'nil' at all here
17:54:14reactormonkehm, FPStatus(0) is NotANumber
17:54:24Araqyeah that's the problem
17:54:26reactormonkand I can't change that because that's what fpclassify gives me
17:55:18Araqtrue, you either need a mapping fpclassify's resulttype -> FPStatus
17:55:34Araqor you simply do:
17:55:41Araq result = Normal
17:56:07Araqin floatCheck
17:57:03reactormonkI'm not sure I like that
17:58:24Araqbut you need some mapping anyway I think
17:58:46Araqas you can't use {NotANumber, Infinite, Subnormal} in the C code gen ...
18:03:35Araqbut proc floatCheck*(x: float, checks: set[FPStatus]): FPStatus is unnecessary; just do the check in floatGuard
18:04:09Araqthink about it, why would one ever call it?
18:04:29Araqit doesn't raise an exception ...
18:04:51reactormonkbecause you don't want an exception, just a return type?
18:05:01Araqbut why?
18:05:07apriori_Araq: I'd still vote for nimrod becoming case sensitive ;)
18:05:38AraqI can use the other floatCheck for that, reactormonk
18:06:31Araqapriori_: use case?
18:06:36reactormonkhmm, right
18:07:20apriori_Araq: well, I just say that.. because e.g. in math you have tons of use cases of e.g. using n/N
18:08:09Araqin fact, I want case sensitivity for single letters
18:08:51apriori_actually.. why not become case sensitive throughout?
18:09:11apriori_I find case insensitivty more confusing than helpful
18:09:16apriori_*insensitivity
18:09:30Araqno idea how much code would break and I want to be protected from idiots
18:09:42Araqwho think identifiers_like_this_are_readable
18:09:51Araqbecause they are not
18:10:05AraqI want to tokenize in my head
18:10:14Araqand the _ are almost in the next line
18:10:17apriori_so you prefer camel case?
18:10:29Araqyeah
18:10:37Araqexcept for abbrevs, GC_disable
18:10:52apriori_your rules of the tokenizer would even allow to transform the above example into identifiersLike...
18:11:11Araqyeah
18:11:15Araqthat was the idea
18:11:26apriori_question is... is mixing cases and style that "brutally" any better
18:11:57apriori_well.. definetly some religious topic
18:13:09reactormonkAraq: I do.
18:13:50AraqI also heavily dislike ALL_CAPS for constants btw
18:14:05Araqbecause they emphasize constants
18:14:14Araqthey deserve no emphasize IMHO
18:14:23apriori_well, sometimes
18:14:26apriori_but usually not..
18:14:31Araqand they are in flux often
18:14:40Araqoften they end up becoming a variable
18:14:46Araqto be set via some config file
18:15:09apriori_well, I prefer prefixing
18:15:14apriori_like "C" or something
18:15:43fowlI get this error: sg_assets.nim(212, 2) Error: invalid expression: ' followed by the stmt list
18:15:49apriori_currently.. in nimrod I stick to P, R, T for pointer, ref, "normal type".. guess C will be used for constants or so
18:16:07Araqfowl: I broke macros
18:16:10reactormonkAraq: parameter <-> global variable
18:16:34AraqI often use a 'g' prefix for globals
18:16:37reactormonkerr parameter <-> constant
18:16:46fowli picked a bad time to update then eh
18:17:00reactormonkin ruby, basically every scope type looks different
18:17:03apriori_fowl: git bisect :P
18:18:19Araqexcept that ruby has like 3 scopes and that just doesn't work
18:18:58AraqI prefer prefix operators over sigils anyway
18:19:08Araqand they don't like each other
18:19:10fowlruby has local, global, instance and class
18:19:18fowland one is never used, so yeah 3
18:19:30Araqyeah and 'local' doesn't suffice for closures
18:19:56fowl?
18:20:16fowlwhy not
18:20:31AraqI dunno how ruby does it, but python requires 'nonlocal' I think
18:20:45apriori_Araq: in generic constraints.. what is "distinct" and "primary"?
18:21:18Araq"distinct" -- some distinct type
18:21:34Araq"primary" -- some type (grammar term)
18:21:43apriori_k
18:26:41AraqI also love to use all lowercase when debugging or in a REPL
18:26:59apriori_yeah.. that are the advantages..
18:27:03apriori_being able to rapidly type in just lowercase
18:27:34fowlor if your mad OMG(WTF(..))
18:27:41Araqin visual studio I have no autocompletion in breakpoint conditions
18:27:47Araqthat sounds like nitpicking
18:27:53Araqbut it's really a problem for me :D
18:28:51*Trixar_za is now known as Trix[a]r_za
18:29:03Araqand my bash does not autocomplete when a filename happens to start with a capital letter
18:29:15AraqI know there is some flag to turn that on
18:29:19apriori_yup
18:29:40Araqbut the bash on my mac didn't support it :P
18:29:48apriori_tzz.. mac :P
18:31:23Araqin fact, CS only works in Java
18:31:45Araqin C# the rules are broken:
18:31:56Araqprivate PageType PageType; // WTF?
18:32:14Araqpython's stdlib is inconsistent
18:32:42apriori_yup.. pythons stdlib is hell
18:32:54apriori_sometimes with _, sometimes without, sometimes camel case, sometimes not
18:32:54Araqand C/C++ are full of different styles
18:33:44AraqC often uses alllowercpswithoutvwls
18:33:56Araqasithasnonamespaces
18:34:29apriori_yeah, totally readable
18:37:14Araqin C# interfaces start with capital I
18:38:37Araqthat's not bad, but if you have more entities than styles you start using prefixes
18:39:12AraqNimrod has: const, var, let, proc, template, macro, converter, iterator and type
18:39:29Araqthat's 9 entities
18:39:38*zahary quit (Ping timeout: 244 seconds)
18:39:40Araqhow many styles do we get with CS?
18:40:25Araqmixed_style, ALL_CAPS, camelCase, ...
18:41:11AraqI have a hard time to map the styles to the entities in a way that would make sense
18:41:58apriori_yeah, usually
18:42:04Araqand as I said, if Nimrod becomes CS, the compiler should enforce the naming scheme :P
18:43:10apriori_I wouldn't have a problem with that
18:43:54Araqwell make a suggestion
18:44:17apriori_well, I can't, yet..
18:45:01Araqwell proc, template, converter, iterator, macro should use the same convention I guess
18:45:14Araqand so do let and var
18:45:54Araqso it's: type, var, proc and const
18:47:04Araqtype: starts with a capital letter
18:47:15Araqexcept for 'int' and 'string' etc. ...
18:47:35apriori_O_o
18:47:39apriori_why does that compile? :
18:47:50apriori_http://pastebin.com/LbKY1jLL
18:47:56apriori_notice the last row
18:48:36Araqgenerics are really permissive :P
18:48:50apriori_I meant more 1[i]
18:48:55apriori_which makes no sense
18:48:55Araqyou have no chance but to instantiate them to get some checking
18:49:01apriori_ok
18:49:06Araq"abc"[i] does make sense :P
18:49:17apriori_yeah, but not number literatal 1
18:49:32Araqbut it's the same syntactically
18:49:35apriori_unless... it would be some bit operator
18:49:46apriori_yeah
18:49:47Araqyou could overload [] for int
18:50:06Araqbut anyway the "indices" will fail soon
18:50:21apriori_apropos..
18:50:26Araqas the compiler will require the symbols to be defined in the current scope
18:50:29apriori_something like this should go into stdlib:
18:50:34apriori_iterator indices*[A, T](v: array[A, T]) : A =
18:50:35apriori_ for i in countUp(low(v), high(v)):
18:50:37apriori_ yield i
18:50:47apriori_if that is even right
18:50:59apriori_because actually A should not be a range, if A is a range, but an element of it
18:51:18apriori_well, I meant the return should not be a range, if A is a range
18:51:32Araqbut the return *type* is A
18:51:55Araqthe *value* is not a range of course
18:52:05apriori_hrm, yes
18:52:57Araqyou don't need indices btw
18:52:59Araquse:
18:53:08Araq for i, x in v1:
18:53:15Araq v2[i] -= x
18:53:32Araqok, you need it if you're not interested in a[i] at all I guess
18:53:38apriori_since I'm often a performance maniac.. I hope that doesn't really copy x
18:54:00Araqit doesn't
18:54:14apriori_good
18:54:26Araqthough it's hard to say for objects ;-)
18:54:40Araqas it then depends on the C optimizer
18:54:47apriori_hm
18:55:03AraqI wouldn't worry about it though
18:55:28AraqC++ does that very often and compilers have caught on
18:55:36apriori_ok
18:57:06apriori_oh.. I really gonna need some unit tests for this stuff... later
18:58:51fowlAraq: how can i store a ref type as a normal pointer for interfacing with c? should i just store addr theref[] ?
18:59:26Araqthat's not any better than 'cast'
18:59:40apriori_hm.. how about addr + gc ref mark?
18:59:47apriori_to make sure it wont get lost
18:59:55fowlAraq: i have to cast it anyways to use it
19:00:17Araqdepends onto what the C proc does with the pointer
19:00:36Araqif it escapes, you're in trouble and need GC_ref(), GC_unref()
19:00:58Araqif it doesn't escape, 'cast' should do
19:02:54apriori_sry for bugging you all day, Araq.. but shouldnt this actually work? :) : http://pastebin.com/Jd5Sufku
19:03:26apriori_oh fuck
19:03:29apriori_not exported...
19:03:31apriori_aaahhh
19:03:56apriori_yup, that was it
19:04:07Araqapriori_: don't worry, I expect you to break the compiler with this stuff
19:04:18apriori_;)
19:05:09Araqbtw, it's possible to implement:
19:05:13reactormonkAraq: http://sprunge.us/JTfh
19:05:14Araqfor i in A:
19:05:23Araqhave a look at the iterator for enums
19:05:33Araqthe same should be possible for range[A..B]
19:06:03apriori_ah, yeah, I remember
19:07:00Araqreactormonk: google it
19:07:09apriori_Araq: not working for A = range[0..2]
19:07:19apriori_missing overload for items, it seems
19:07:32Araq?
19:07:32apriori_hrm
19:07:42Araq"it's possible to implement" I said
19:07:42apriori_vector.nim(36, 12) Error: type mismatch: got (typedesc[range 0..2])
19:07:44apriori_but expected one of:
19:07:45apriori_system.items(a: string): char
19:07:47apriori_system.items(E: typedesc[enum]): typedesc[enum]
19:07:48apriori_system.items(a: openarray[T]): T
19:07:50apriori_system.items(a: array[IX, T]): T
19:07:51apriori_system.items(a: set[T]): T
19:07:53apriori_system.items(a: seq[T]): T
19:07:54apriori_system.items(a: cstring): char
19:08:04Araqwell yes
19:08:13Araqyou need to add it to system.nim
19:08:18Araqand implement it
19:08:28reactormonkaye
19:08:48apriori_yeah, ok.. sry.. didnt read properly ;)
19:11:33fowlAraq: i'll be fine using gc_ref/unref because i know when they are created/destroyed
19:11:49fowli should prboably just use raw pointers though in that case
19:15:44Araqreactormonk: you can now use type FPStatus {.pure.} = enum
19:15:56Araqso that FPStatus.Infinity is required
19:16:09Araqand the global namespace is not polluted
19:16:31AraqI don't like it ... ;-)
19:16:52Araqbut most other people like the "cleaner" enums I guess
19:18:26AraqI prefer prefixes: fpInf, fpNan, fpSub, fpNormal
19:18:45reactormonkprefixes are for languages that fail in scope
19:19:10Araqyeah lets sigil them
19:19:18Araqif only that would work ... :P
19:19:59Araqprefixes always sneak in
19:20:19Araqeven C# has 'I' for interfaces and 'T' for generic types
19:20:37reactormonkruby doesn't :-)
19:21:21reactormonkbtw: -lm fixes the problem
19:21:32reactormonkbecause we need to link libm
19:21:52Araqthe config should already contain -lm
19:22:12reactormonkI compiled an empty test.nim, and it does not
19:22:31apriori_Araq: apropos breaking the compiler ;)
19:22:48Araqhttp://blog.mikiobraun.de/2009/10/whats-wrong-with-ruby-module-functions.html
19:23:02apriori_Araq: the prior posted code for some reason allows e.g. addition of a vector2d to a vector3d
19:23:15Araqreactormonk: this guy disagrees with you
19:24:07reactormonkAraq: that's only marginally interessting
19:24:51Araqhttp://www.joshstaiger.org/archives/2006/12/of_closures_met_1.html
19:25:20fowlthats a dumb example
19:26:10Araqhow so?
19:26:15fowlinstead of making a Fcts module to hold bessel() he could have just called MoreMath.bessel() since that is what a module function is..
19:26:24reactormonkAraq: just a lame pun.
19:26:40Araqmy second link is better
19:26:56reactormonkAraq: fail scoping as in no namespaces
19:27:15Araq"Matz clearly recognizes that there are issues with Ruby's current scoping implementation, so maybe this is one of them."
19:27:39reactormonkruby does have namespaces. I associate prefixes with lisp, where you have almost no namespaces
19:28:20fowlAraq: that article is just silly
19:28:44Araqok, what about the second one?
19:28:47fowlin ruby, methods aren't closures, why write an article complaining about it? blocks, procs, lambdas specifically are closures
19:28:52apriori_hrm..
19:29:11apriori_why does nimrod not detect in that case, that A is not the exact some for those both types :/
19:30:42apriori_http://pastebin.com/79fJWDc5
19:31:12fowlIt kinda sucks that every time I want to create a closure I'm forced to use the less succinct ".call" syntax. if you're that anal about succinctness there is #[] for calling procs or #.()
19:31:52reactormonkfowl: go javascript if you want closures :-)
19:32:04apriori_yuk, javashit...
19:32:18reactormonkapriori_: coffeescript makes it a bit better
19:32:25Araq*shrug* scope rules are hard and you can't please everybody
19:32:26reactormonkbut don't use their object system
19:33:13fowlreactormonk: that's exactly what it is, "i dont like ruby because in ruby methods aren't closures" -- if methods being closures is a requirement to be your language of choice go do lua or javascript
19:33:32apriori_reactormonk: helping a workmate to develop a webgl renderer was a mere nightmare..
19:33:51reactormonkapriori_: I guess so :-)
19:33:52apriori_reactormonk: debugging javascript is a nightmare.. that "define anywhere, see everywhere" thing is also a nightmare
19:34:14reactormonk:D
19:34:44Araq*shrug* Lua's design seems better on paper
19:35:04Araqhaving used Lua and not Ruby, I think I'd prefer Ruby
19:35:45AraqLua's scoping rules are better I'm quite sure, but this 'nil' hunting is annoying
19:36:10Araqand 'function' is too long as a keyword ;-)
19:36:35fowloh at the end of this it comes down to "look at some functions in javascript, these are closures! im happy again!"
19:36:44Araqplus it lacks a case statement and lots of other useful things
19:36:55Araqapriori_: bug report
19:37:46fowlalso, class and module blocks open a new scope, they just do, sorry
19:38:07Araqor even better collect these things and make a single bug report for all you encounter :-)
19:38:16Araqas it's getting overwhelming
19:39:38apriori_hehe, okay
19:39:58apriori_actually.. if I'm not wrong, this might indicate general issues with generics
19:40:05apriori_running other series of tests
19:41:33*zahary joined #nimrod
19:50:10apriori_how can I print the actual type that was picked for a generic instantiation?
19:54:20Araqdunno, there is some magic for it
19:54:37Araqforgot its name
19:57:31Araqapriori_: tests/run/ttypetraits
19:57:42apriori_k, reading
19:57:44reactormonkAraq: so, basically, nimrod c doesn't include -lm
19:58:02reactormonkat least not for the basics without any include
19:58:47Araqreactormonk: indeed it's in math.nim:
19:58:50Araqwhen defined(Posix):
19:58:52Araq {.passl: "-lm".}
19:58:57Araqdamn
19:59:00apriori_Error: internal error: (filename: compiler/evals.nim, line: 867) :/
20:00:13Araqand that's what the compiler's code says:
20:00:17Araq ## XXX: This should be pretty much guaranteed to be true
20:00:18Araq # by the type traits procs' signatures, but until the
20:00:20Araq # code is more mature it doesn't hurt to be extra safe
20:00:22Araq:D
20:00:41apriori_ouch
20:00:46Araqso much for the "guaranteed to be true"
20:01:33apriori_hehe
20:02:38reactormonkAraq: ... which is not in system.nim - now what?
20:03:17Araqmove it to system.nim
20:03:28Araqor even better remove it from math.nim
20:03:35Araqand add it to the default config file
20:03:55Araqconfig/nimrod.cfg
20:04:41reactormonkAraq: just include math.nim into system.nim?
20:04:56Araqdo not do that
20:05:06Araqsystem.nim is special :P
20:05:17reactormonkor, rather, system/
20:05:22Araqanyway -ldl is handled in the config file too
20:05:38Araqso it's consistent to handle -lm there
20:06:55reactormonkbasically add -lm to everyone of the four?
20:07:20Araqadd it if posix
20:08:05reactormonkhow do I add options?
20:08:08reactormonk+= =
20:08:21Araqread the config file
20:08:43Araqcheck how it's done for -ldl
20:08:53reactormonk gcc.options.linker = "-ldl"
20:09:31Araqwell do it this way then:
20:09:41Araq--passl:"-lm"
20:09:54Araqthat will add to the options
20:10:27reactormonkyep, works
20:10:33reactormonknow for some tests
20:14:24Araqmath.h should really add -lm if it needs it
20:15:04Araqleaking abstraction ;-)
20:15:24Araqstdio.h manages to do without -lio ...
20:16:43reactormonkthere are no tests for arithm.nim ?
20:17:04Araqthere are but I forgot where
20:17:19Araqjust use tmath
20:18:21apriori_Araq: https://github.com/Araq/Nimrod/issues/202
20:18:21reactormonkhow do I get an inf/NaN/subnormal float?
20:18:41Araqsystem.Inf exists
20:18:42reactormonkapriori_: split them up
20:18:58apriori_reactormonk: he didnt want them to be splitted
20:19:40reactormonkhum
20:20:03Araqto get a NaN, use Inf / Inf I think
20:20:13Araqno idea how to get a subnormal
20:27:23reactormonkDBL_MIN/10 apparently
20:30:33reactormonkhow do I get DBL_MIN in code? :-/
20:30:42reactormonklow(float) ?
20:31:15Araqvar DBL_MIN {.importc, header: "<math.h>".}: float
20:45:37reactormonkis there a macro for 'when target is C...'?
20:56:08Araqwhen not defined(NimrodVM) and not defined(ECMAScript):
20:56:18Araq(sucks, I know)
20:57:19reactormonkcan't you introduce a when defined(C)?
20:57:31reactormonkor even when target(C)
20:59:37apriori_got go
20:59:38apriori_bye all
21:00:18*apriori_ quit (Quit: Konversation terminated!)
21:37:13Araqah hi zahary
21:37:42Araqwhat do you think about range[a..b] vs. a..b in generics?
21:45:56zaharywell, you had an idea about it many months ago - we can make array[int, T] equivalent to array[range[0..int], T]
21:46:46zaharythat will improve things a little bit - otherwise, I guess it's a bug that 0..2 is not detected as range in this situation
21:50:22Araqwell ... we can't detect types easily: p[0..2](x, y) is ambiguous
21:50:51Araqand if expressions can be passed to generics, it will be ambiguous
21:51:08Araqeven in semcheck
21:52:44zahary0..2 is not a regular expression right now?
21:52:58zaharyit's intercepted by the parser/sem somewhere with special meaning?
21:53:29Araqyeah it's turned into a nkRange sometimes
21:54:04Araqit is a regular expression except in some cases where it isn't ;-)
21:54:43zaharyideally, it will just produce a range value, which is something that's valid as a type argument
21:55:12zaharyvar x = 0..2 seems perfectly fine in regular code
21:56:32AraqTSlice needs to become a magic for that to work
21:56:48Araqbut yeah, seems a good way to do it
22:03:57reactormonkjust got overrun on AC :-/
22:05:06zaharyabout 1): typeRel will report range[0..1] and range[0..2] as compatible types and this triggers implicit conversion between array[0..2] and array[0..1]
22:05:57Araqyeah I thought it was something like that
22:06:27Araqfix: special casing that in the branch for tyArray?
22:09:18reactormonkhuh? http://sprunge.us/ZaGK
22:09:57Araqreactormonk: fixed it already
22:10:17Araqbut may break it again tonight
22:10:54reactormonkhum
22:11:16reactormonklib/pure/unittest.nim(92, 16) Error: undeclared identifier: 'TestStatusIMPL'
22:13:58reactormonk\o/
22:14:36reactormonkerr wtf
22:14:45reactormonkoh, my fail
22:15:00reactormonkzahary: why have a suite and a test keyword? not just one?
22:16:04zaharythe suite allows you to have a common setup and teardown code for all tests
22:16:14reactormonkwhy can't test do that?
22:17:12reactormonkAraq: var DBL_MIN {.importc, header: "<math.h>".}: float fails
22:17:18zaharyat this time in the evening I can only come up with a stupid example, but imagine you are testing various sorting procs
22:17:20reactormonkit sets it to '0'
22:17:38reactormonkzahary: I just wonder why the functionality of 'suite' couldn't be merged into test
22:17:49zaharyyou'll want all tests to have access to local variable with unsorted sequence - the common setup part will prepare just that
22:18:12Araqreactormonk: the 'var' needs to be a global
22:18:23zaharyno, it can be local too
22:18:27Araqor try it with {.noinit.}
22:18:42zaharythe setup code will just be inserted at the begging of each test proc
22:19:11reactormonkzahary: so why can't test have this functionality as well?
22:19:38reactormonkwhere do I make feature requests for unittest btw?
22:19:54zaharyreactormonk, tell me how the suite functionality can be merged into test? I'm not sure yet what's confusing you
22:20:30reactormonkzahary: nah, I got the idea. I just wonder wherever it would be possible to reduce it to a single keyword 'test'
22:20:46zaharyyou can always use test without a suite
22:21:05zaharythe suite only allows you to have shared setup/teardown
22:21:17reactormonk... got something else in mind as well. a 'check_proc' that takes 'proc', 'arguments', 'result'
22:21:39reactormonk... or improve the inspect functionality of check :-)
22:21:50reactormonkoke
22:21:52zaharycan you elaborate? check proc(arguments) == result ?
22:22:07zaharyaha, I see what you mean
22:22:07reactormonk http://sprunge.us/hNCS <- how to improve that?
22:22:22zaharyindeed - the inspecting functionality is not finished
22:22:23reactormonkI'm like "ok, it failed. now what?"
22:23:06zaharyyou can try to get your hands dirty - it would be a good exercise in using macros
22:23:18reactormonkugh
22:23:33reactormonkI'd just add a condition and a repl ;-)
22:23:56zaharyhttps://github.com/Araq/Nimrod/blob/master/lib/pure/unittest.nim
22:24:03zaharynotice how I left TODO there :)
22:24:20zaharyit won't be much different from what I'm doing in the nkInfix case
22:25:09reactormonkah
22:26:24reactormonkcan't you check for literals?
22:27:40zaharyI'm checking for literals in the infix case - I can try to implement the print outs for calls tomorrow if you don't feel like trying yourself
22:28:51reactormonknah, gotta read some papers
22:30:10reactormonkAraq: DBL_MAX is 2.1599848462962204e-317
22:30:19reactormonksomething is very, very wierd
22:34:52reactormonkzahary: already something nice around for table-testing?
22:36:33Araqso zahary I'm about to merge semExpr and semStmt
22:36:50Araqany ideas what could break?
22:39:04zaharyI guess nothing since semStmt is calling semExpr internally and there isn't any node kinds which are handled by both?
22:39:13zaharyeffectively, they are merged right now
22:40:22dom96Araq: Were you brave enough to enable the compile tests yet?
22:40:34Araqdom96: indeed and I fixed most of them
22:40:48Araqand I broke only few in all these months :-)
22:40:57dom96Araq: That's good :)
22:41:14Araqbut we really need branches for nimbuild
22:41:33Araqit's really easy to decide whether a bugfix breaks some code or not
22:42:00Araqso maintaining 2 branches should be easy
22:42:11dom96Yes, I know. I will add that ASAP.
22:42:16Araqgood
22:44:08zaharyI wanted to merge semType and semExpr btw
22:46:52Araqhow would that work? by some flag?
22:47:14AraqsemType interprets nkBracketExpr very differently for instance
22:48:15zaharysince we have typedesc params now, such things can work with the standard magic system (or sometimes even with templates)
22:51:13Araqyeah well, I'll merge semStmt and semExpr first and gather some experience :-)
22:51:49AraqsemType has some other problems in addition but I'm not opposed to merging it
22:51:58zahary… or with special cases in semBracket like the rest of built-in types . it's unfortunate that type cannot appear as values anywhere within the program
22:53:25zaharyand I'm not fair, because it mostly works now, but semExpr and semType end up calling each other and repeating the same switch statements with the same code for idents, macros, etc
22:53:48Araqtrue
22:57:11zaharyhttps://github.com/Araq/Nimrod/blob/master/compiler/sigmatch.nim#L388
22:57:11zaharybtw what does it mean that the ArrayConstructor have a generic type at sons[0] (this is where the tyRange goes usually)?
22:58:25Araqwell it means exactly that
22:58:38Araqits index type is a generic type
22:59:38zaharycan you give me an example for such array?
23:00:31Araqtype TX[Idx] = array[Idx, int]
23:01:04Araqthe built-in containers have no tyGenericBody/Inst stuff
23:01:31Araqthe reason is historical
23:01:38Araq;-)
23:02:09AraqI always fight with the generic types implementation ;-)
23:02:26zaharyaha, it's my bad actually - didn't see that GenericParam is in GenericTypes too (I was assuming it's GenericBody)
23:15:05Araqgood night