<<27-06-2012>>

00:17:11*gf3 joined #nimrod
00:17:39*gf3 left #nimrod (#nimrod)
02:46:31*JStoker quit (Excess Flood)
02:58:14*JStoker joined #nimrod
07:06:21*fowl quit (*.net *.split)
07:13:23*zahary joined #nimrod
07:20:29*fowl joined #nimrod
07:20:29*fowl quit (Changing host)
07:20:29*fowl joined #nimrod
10:16:58*zahary quit (Read error: No route to host)
10:18:25*zahary joined #nimrod
15:46:03*shevy quit (Ping timeout: 252 seconds)
15:58:51*shevy joined #nimrod
16:12:03*zahary quit (Read error: Connection reset by peer)
17:01:28*zahary joined #nimrod
18:24:37*Bosc0p joined #nimrod
18:25:51*zahary left #nimrod (#nimrod)
18:25:53*zahary joined #nimrod
18:27:44*Bosc0p is now known as Boscop
18:27:44*Boscop quit (Changing host)
18:27:44*Boscop joined #nimrod
18:41:25zaharyAraq, some interesting trivia - I tested bootstrapping speed on windows with gcc 4.5.2, msvc 10 and intel 12.
18:41:25zaharymsvc : 2.7s
18:41:25zaharygcc : 3.2s
18:41:25zaharyintel: 3.4s
18:43:21Araqzahary: interesting :-)
18:43:31AraqI implemented the type system I had in mind for integers
18:43:37Araqbut it kind of sucks
18:43:53AraqI introduced tyInt + nkIntLit(42) for integer literals
18:44:10Araqand only if the integer literal in in range, it is convertible to uint8 etc.
18:44:10zaharysucks for the user or for the compiler?
18:44:21Araqboth :-)
18:44:51Araqfor the user it's very confusing to get "got (int, int, int)"
18:45:00Araq"but expected (cint, int, cint)"
18:45:03zaharyI understood your idea the first time you described it, but it seemed a little overkill (to have a separate type instance for each literal)
18:45:39Araqand some ints fit cint and some do not so the error message is confusing as hell :-)
18:46:06AraqI implemented a type cache, so no separate type instance per literal
18:46:08zaharyhmm, you could print it as
18:46:08zaharygot (43, int)
18:46:25Araqyeah but the real problem is:
18:46:35Araq(4+5) should be an int literal too
18:46:45zaharyaha
18:46:56Araqand while not hard to implement
18:47:16Araqit then makes the type dependent of the const capabilities of the compiler
18:47:42zaharyyou mean the const folding capabilities?
18:47:46Araqyes
18:49:03Araqformally tyInt + literal introduces a tyIntLit in the language
18:49:30Araqand then we need to specify that it's converted to tyInt in cases like this:
18:49:32Araqvar x = 0
18:50:10Araqand we have type inference for + et al
18:50:44Araqproc `+` (x, y: intlit): intlit
18:50:56zaharybtw, there is an interesting idea that didn't make into C++ 11 on time
18:50:56zaharythe expression template guys noticed that type inference breaks their libraries
18:50:56zaharyauto product = M1 * M2; // oops, product is the expression template object
18:51:38zaharythe proposed solution is to add an "operator auto" to the language - it allows to plug yourself in the type inference process
18:52:46Araqomg ... :-)
18:53:16Araqterm rewriting macros ftw
18:56:26zahary:) yep, but it's nice to remember this example. also, if IntLit + IntLit just produces another IntLit, the "special type inference" solution solves the problem
18:58:55Araqwell my new solution is to make tyInt less expensive to convert to any other integer type
18:59:10Araqso that i16 and 7 produces i16
18:59:28zaharythe C conversion rules?
18:59:34Araqthat's not C
18:59:55AraqC does i16 & int -> int
19:00:06AraqC promotes smaller types to 'int'
19:00:14zaharyhmm, but is this only for literals then?
19:00:15Araqand else to the larger type
19:00:57Araqno
19:01:19AraqC's hex literals are unsigned int, C's literals are int, afaik
19:01:42Araqand literals which don't fit int, are long, long long etc.
19:02:00zaharyI've never given this any thought, but doing the opposite of C sounds scary :)
19:02:34Araqbut it also solves the "I wanna use int32 everywhere for cache efficiency" problem :-)
19:02:57Araqand the compiler emits a downcast check anyway
19:03:21Araqand if it can be proven to fail at compiler time, the compiler errors out
19:03:47Araqso i18 + 4564 would be a compile-time error
19:03:55Araq*i8
19:04:08Araqbut after type checking
19:04:19Araqit would match the int8 + operator
19:04:37Araqso basically we have the rules:
19:05:01Araqimplicit conversion is allowed if no information is lost (int8 -> int16) (like before)
19:05:35Araq2) 'int' is special and can be downcasted implicitely
19:05:43Araq*narrowed
19:06:15Araqwhich is quite easy and doesn't break any code as far as I tested it
19:06:37Araqplus it makes nimrod more useful on 8 bit cpus than C ... :D
19:09:28zaharyI see. I'm interested in digging up the history on how all the rules in C got established. otherwise, I guess I haven't formed an opinion on the usefulness/dangers of implicit casts
19:11:52zaharythe codegen is quite often casting to NI64 btw, which is something I was always curious about, but never got to the point to chase it down. what kind of code is producing these casts?
19:16:58zaharydamn, gotta go, see you later
19:17:02Araqha
19:17:05Araqsame here
19:17:08Araqsee you later
21:18:05Araqfowl: I don't understand your problem
21:18:32Araqthe compiler passes -lm to gcc anyway via the configuration file I think
21:32:59fowlit seems to work without it now >_>
21:33:01fowlhttps://gist.github.com/3005966
21:39:05Araqshould I add them to math?
21:40:29fowlsure
21:43:06Araqalright
21:43:48Araqwhy does `mod` not use 'fmod'?
21:44:16Araqand should division by 0 really return 'x'?
21:49:39fowlfmod acts differently than i expected it to, it will return a negative number if you give it a negative number
21:51:59Araqthat may be the case for 'mod' for ints too ... :-)
21:54:49fowlo
21:57:10fowlHow can I create a TRect with x/y/w/h wihtout setting each one? something like var r = TRect(x, y, w, h) would be perfect
21:58:24Araqmake TRect a tuple and you can use (x, y, w, h)
21:58:38Araqor make a constructor proc
21:58:51Araqyou can also play syntax games
21:59:47Araqproc `\`(x, y, w, h: int): TRect = ...
22:05:40*apriori_ joined #nimrod
22:05:45fowlhow weird can the proc names get? :)
22:07:43Araq@~??/|||
22:07:56Araqvery weird ;-)