<< 05-02-2015 >>

00:00:48flaviuYep, signal handlers are non-ideal. I want to be able to do dynamic memory allocation in them.
00:01:15flaviuI'm looking to see if I can convince clang or Nim to insert null deference checks.
00:02:54Mat4flaviu: I think recovering from segfaults is at least operating-system dependent
00:03:02def-flaviu: from what google tells me posix doesn't guarantee recovery, but people have written linux-only libraries: https://code.google.com/p/segvcatch/
00:03:26Jehan_flaviu: Doesn't Nim already check for dereferencing nil?
00:03:49flaviuJehan_: Nope, I'm looking at cgen.rdLoc right now.
00:03:59flaviu(*$1)
00:04:28Jehan_flaviu: It does install a segv handler which aborts and prints a traceback.
00:05:12flaviuYes, but I don't want the abort, I want to raise an exception and continue. Unfortunately, I think it's impossible to do that in a thread-safe way.
00:05:18Jehan_*nod*
00:05:45Mat4there is a pitfall here: Limux seem to reset the signal vector after each call
00:05:47Jehan_I think the best solution would be to have the code generator actually insert an explicit nil check (probably as an option).
00:05:52Mat4^Linux
00:06:30Mat4so the handler routine is called only once
00:09:57*JinShil joined #nim
00:12:47*nande joined #nim
00:13:21*Mat4 quit (Quit: Verlassend)
00:26:29*Trustable quit (Quit: Leaving)
00:33:12*Matthias247 quit (Read error: Connection reset by peer)
00:40:09*davidhq quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
00:51:22*gokr_ quit (Quit: IRC for Sailfish 0.9)
01:00:32Araqyup, Jehan_ is right. patch the codegen instead
01:00:46Araqit's some feature request already
01:01:04Araqand there is already --nilChecks:on|off
01:01:21*BitPuffin quit (Ping timeout: 245 seconds)
01:05:04Jehan_I was thinking more of having two ways of doing nil checks, one as an explicit check, one via signals (since the latter is cheaper).
01:05:37Araqwell --nilChecks:off still produces the signal handler
01:07:23Jehan_Huh. Didn't realize that.
01:09:28Araq-d:noSignalHandler removes it
01:10:25Jehan_Duly noted. :)
01:12:03*dv- quit (Ping timeout: 245 seconds)
01:13:36*sillesta quit (Ping timeout: 265 seconds)
01:13:52*dv- joined #nim
01:18:25*vendethiel quit (Ping timeout: 265 seconds)
01:23:13*vendethiel joined #nim
01:26:23flaviuDoing some hackish stuff in cgen.nim, and I wish there was some way to tell C to stop typechecking at a point.
01:27:25AraqI wish C would actually perform some typechecking that deserves that name
01:29:11ldleworkhttp://arrdem.com/2015/01/27/ox:_some_motivation/
01:33:03Araq"The GHC team has a "3% rule", in that if a change improves the language or the type checker and comes at a cost of less than a 3% slowdown it has a high probability of being accepted and acceptance/rejection is publicly debated ala LKML" wtf?
01:33:20Araq3% slowdown is quite a lot
01:33:31Araqand these add up quickly
01:33:52Araqsince the next 3% then refer to the *former* slower compiler
01:34:18Araqso you get some nice exponential slowdown
01:34:20ldleworkThis article is probably not flawless.
01:34:24Jehan_I don't think that's a hard-and-fast rule.
01:34:44Jehan_I suspect that they'd be wary of cumulative performance degradation.
01:34:44flaviuAraq: I'm doing some completely unrelated research, but apparently haskell has had "rewrite rules"/term rewriting macros since at least 2002.
01:34:45ldleworkI just think he has some good rooting in first-motivations
01:35:17flaviuThat's not an argument against term rewriting macros btw, just a remark.
01:35:23Araqflaviu: yeah, but we have some side effect and alias analysis constraints
01:35:53Araqand afaik these are new, nobody has them except Nim
01:36:07flaviuHaskell has the same side effect stuff, they just call it Monands or something
01:36:19ldleworkflaviu: hehe
01:36:42Araqthese are very similar but not identical
01:36:52Jehan_Ugh, I also need to write a response to the options thread, but the hashtable debate is exhausting me.
01:37:00ldleworkone uses the type system, another uses the pragma system?
01:37:15flaviuI guess so.
01:37:35Araqldlework: that's one way of putting it, but the real difference is that E[T] is not the same as (T, E)
01:37:42flaviunoalias is awfully hard to prove.
01:39:18Araqflaviu: it's easier when you have value based datatypes
01:39:55flaviuRight, I was thinking of pointers.
01:44:24*vendethiel quit (Ping timeout: 245 seconds)
01:46:36*vendethiel joined #nim
01:50:04drewsremTrying to use a nim lib which uses dynlib pragma in its codebase to import a shared library on Linux, the example compiles fine but when I try to run it it says "could not load: *libname*.so", I got that this error message is from nims code-gen, is there any additional debug information I can access?
01:50:55*sampwing quit (Ping timeout: 252 seconds)
01:51:01def-you have *libname*.so on your system?
01:51:16drewsremdef-, yes, it's in /usr/lib
01:52:21def-in the correct architecture? (x86_64 vs x86)
01:52:34def-and i think this error also appears when a depenency of *libname*.so is missing, which is confusing
01:53:37drewsremdef-, correct architecture?
01:54:11def-if you compile your program for x86_64 and the library is for x86 it won't work
01:55:00drewsremah, no the lib should be compiled x86_64, as I guess nim does per default on a x86_64 system?
01:55:08def-yes
01:55:20drewsremright
01:55:25drewsremyour second point tho might be it
01:55:33Araqhrm the codegen for 'growObj' is completely wrong, lol
01:56:17def-drewsrem: I would also like to know if there is a way to find out which library exactly is missing
01:56:31Araqthat will be an ugly fix, creating lots of new problems
01:57:13*Angry joined #nim
02:04:30*darkf joined #nim
02:09:23*Demon_Fox quit (Ping timeout: 246 seconds)
02:09:35*vendethiel quit (Ping timeout: 244 seconds)
02:09:56*Demon_Fox joined #nim
02:11:03Araqgood night
02:14:10*vendethiel joined #nim
02:23:15*Jehan_ quit (Quit: Leaving)
02:23:33flaviudef-: $ ldd myexecutable
02:24:18*Puffin joined #nim
02:26:29*EXetoC quit (Ping timeout: 252 seconds)
02:35:06*vendethiel quit (Ping timeout: 245 seconds)
02:36:38*chemist70 joined #nim
02:39:50*chemist69 quit (Ping timeout: 246 seconds)
02:40:07*kapil__ joined #nim
02:42:18*VinceAddons quit (Read error: Connection reset by peer)
02:44:41*Demon_Fox quit (Ping timeout: 245 seconds)
02:44:51*vendethiel joined #nim
02:45:47*Demon_Fox joined #nim
02:49:52*Demon_Fox quit (Ping timeout: 240 seconds)
02:50:26*Demon_Fox joined #nim
02:58:42*tschmid joined #nim
03:02:10drewsremflaviu, ldd doesn't show the shared-library in my problem
03:05:04*Demos joined #nim
03:08:49*vendethiel quit (Ping timeout: 264 seconds)
03:10:51*vendethiel joined #nim
03:10:55*Puffin quit (Ping timeout: 255 seconds)
03:22:08*gunn_ joined #nim
03:23:49*gunn quit (Ping timeout: 264 seconds)
03:29:13tschmidtest
03:32:51tschmidIs there any particular reason why case syntax is `case expr |of expr: |else:` instead of `case expr of |expr: |else:`? The repetitive use of the of keyword and the apparent stylistic standard of not indenting each case make it quite hard to read.
03:34:58dtscodebecause its easier to find the cases in it since they are prefixed with "of"
03:35:09dtscodeim guessing
03:35:23tschmidwhich is what indentation is for
03:35:48tschmidhaving it not indented makes it much harder to read for mw.
03:35:57dtscodeyou can indent it...
03:36:01dtscodecase foo:
03:36:05dtscode of bar:
03:36:30tschmidstill, the repeated use of `of` seems wasteful
03:37:02tschmidand having nonindentation as part of the official style?
03:37:04dtscodethats really a design opinion. i personally like it. makes it easier to mark out cases
03:38:58tschmidindentation blocks are used everywhere else, so why not in this case?
03:39:22dtscode.....................
03:39:25dtscodethey are...
03:39:32dtscodei just said they are...
03:39:35*drewsrem quit (Quit: Leaving)
03:39:54tschmidokay
03:40:03tschmidthen my main issue is the official style not being indented
03:40:06tschmidthat's just weird
03:40:19dtscodenot weird. i like it. like i said its a design opinion
03:40:46tschmidit's visually ambiguous.
03:41:05dtscodenot really...
03:41:07tschmidit looks like a list of statements, not a block of cases
03:41:17dtscodeit is a list of statements
03:41:27tschmid...
03:42:14tschmidit's in a different semantic scope
03:42:27dtscodeok. and?
03:42:48tschmidso that should be denoted, not left as an exercise for the reader.
03:42:58dtscodeit is denoted... with an of
03:43:01dtscode............
03:43:08tschmidgood job
03:43:14tschmidyou win
03:43:16tschmidbye
03:43:29dtscodei really dont see your point here... do you actually know what you are talking about?
03:47:20tschmidokay
03:47:27tschmidof is one letter away from if
03:47:44dtscodealright. and?
03:48:00dtscodeits also a letter away from oh
03:48:10tschmidare you trolling?
03:48:29dtscodeare you? cause you are just running in circles with no point
03:48:35tschmidit is not easy to tell from looking at a segment of code that you're inside a case statement.
03:49:56tschmidthere is no indentation, which provides both a visual denotation of scope and a way to see the head of the statement.
03:50:43*brson quit (Quit: leaving)
03:51:15tschmid`of` is not sufficiently different from `if` for me to tell that it denotes a case statement without reading the line and looking up to find the case keyword.
03:52:44tschmidit's visually ambiguous, and you're trolling.
03:56:10tschmidyour argument is that you think it looks good.
03:57:37dtscodesorry laptop crapped out
03:58:12dtscodeanyways tschmid thats not the fault of nim if you cant tell when you are in a switch block
03:58:35tschmidgood. now to attack my reading comprehension.
03:59:16dtscodenot attacking anything. just pointing out there is nothing wrong with the language
03:59:44tschmidi'm not saying there's anything wrong with the language, i'm saying the official style can be improved.
04:00:00tschmidin what way is it not an objective improvement?
04:00:17dtscode...
04:00:25dtscodeok now i am attacking your reading comprehension
04:00:43dtscodebecause ive told you exactly why its good and why it would be bad to not have of
04:00:46tschmidyou're being condescending but you haven't actually given me any arguments.
04:00:50tschmidi moved on
04:00:55tschmidi'm talking about indentation
04:01:08tschmidshould we discuss your reading comprehension now?
04:01:32TriplefoxArgument has gone on for one half hour
04:01:38tschmidjoy
04:01:48dtscodei have actually, which is why im talking about your reading comprehension. and we never actually switched topics ;) im fairly convinced your trolling now
04:02:19tschmid20:39 < tschmid> then my main issue is the official style not being indented
04:03:27tschmidyou're being either intentionally or unintentionally obtuse, so i'm going to stop replying to you.
04:03:40tschmidas i should have thirty minutes ago.
04:04:00TriplefoxIs the official style documented somewhere, i think I went looking at some point but gave up
04:04:26TriplefoxOr just forgot to actually look
04:04:43dtscodegood. because youve been ignoring what i was saying this whole time :D good luck not knowing your stuff! gotta put you on ignore now though. real stuff to do than bitch about not being able to find case statements
04:06:18tschmidboy, that's not good for my blood pressure
04:11:19tschmidLuckily, nonindented case statements aren't part of the official guide, but all of the nim source I've seen has their case statements non-indented. It's probably an unspoken rule, but if a nimfmt ever gets around to being built, it could become a problem.
04:11:23tschmidhttps://github.com/Araq/Nim/wiki/Style-Guide-for-Nim-Code
04:12:36Demosnonindented case statements are quite common in C as well
04:12:53Demosalthough that is probably because case statements do not open a new scope as far as I know
04:12:55tschmidyeah, and they have braces to make up for it.
04:13:00DemosI don't know if they do in nim either
04:13:07dtscodethey dont in c/c++
04:13:12dtscodenot sure about nim
04:13:20tschmidby semantic scope, I mean the valid keywords change.
04:13:33Demostschmid, lets not even go there
04:13:43tschmidwhat braces vs indentation?
04:13:51Demosno "semantic scope"
04:13:56tschmido...kay
04:14:40Demoslike tons of stuff changes the available keywords.
04:15:09tschmidokay?
04:15:16tschmidit's all deterministic
04:15:16Demosand we don't really use indentation to deal with it, I would actually agree that switches perhaps should be indented if they open a new block
04:15:27Demoshuh
04:15:37DemosI mean it has to be deterministic
04:16:07tschmidyou can't leave a case statement without using the of keyword, can you?
04:16:46tschmidregardless, that doesn't really matter.
04:18:22*vendethiel quit (Ping timeout: 240 seconds)
04:20:02DemosI think you can only use the else portion
04:20:06Demosbut it is a noop then
04:20:11Demosor the case is
04:24:00TriplefoxIf I'm understanding it correctly, we can style case blocks differently but we can't accidentally change the meaning?
04:25:34*lws_ joined #nim
04:25:40tschmid?
04:27:20*vendethiel joined #nim
04:28:23*lws quit (Ping timeout: 272 seconds)
04:44:00*gunn_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
04:46:27*brson joined #nim
05:06:25*ARCADIVS joined #nim
05:19:23dtscodewould pythons socket.bind == nim's sockets.bindAddr?
05:21:55*darkf_ joined #nim
05:23:51dtscodealso, what would be the same as pythons socket.accept()?
05:24:58*darkf quit (Ping timeout: 245 seconds)
05:25:47*brson quit (Ping timeout: 252 seconds)
05:28:43*gunn joined #nim
05:28:50*gunn quit (Max SendQ exceeded)
05:28:53*darkf_ is now known as darkf
05:29:29*gunn joined #nim
05:31:35*JinShil quit (Quit: Konversation terminated!)
05:40:49*johnsoft quit (Ping timeout: 252 seconds)
05:40:58*johnsoft joined #nim
05:44:47*nande quit (Remote host closed the connection)
05:51:25*brson joined #nim
05:55:39fowlmouththis library is neat, lots of use of recursive templates https://github.com/MasonMcGill/tuples
05:59:17dtscodeooo i like this
06:07:23*Puffin joined #nim
06:11:53*Puffin quit (Ping timeout: 250 seconds)
06:23:11*akiradeveloper joined #nim
06:24:44akiradeveloperhttps://gist.github.com/akiradeveloper/aa86259905ca01982d44
06:25:35fowlmouthakiradeveloper, whats the problem?
06:26:06akiradeveloperif we use case 1 the len(c) is 0 but we expect it 1000
06:26:29akiradevelopercase 2, it somehow ends in out of memory
06:26:37fowlmouth.eval echo(len(newseq[char](1000)))
06:26:41Mimbusfowlmouth: 1000
06:27:24fowlmouthakiradeveloper, you should cast p to ptr seq[char]
06:27:24akiradeveloperyes. but after casting the seq is gone
06:29:15akiradeveloperwhat's the difference between addr(s) and addr(s[0])
06:29:24akiradeveloperfowlmouth: it works for case 2
06:30:31fowlmouthaddr s is the address of variable s, addr s[0] is the address of the first member stored in the sequence (the sequence also has length and capacity fields)
06:31:23akiradeveloperI see. so it's not simply an array
06:33:21fowlmouthits not the same as c's arrays or pointers
06:38:31akiradeveloperwell, I need some redesigning on my nim-fuse...
06:38:39akiradeveloperthanks
06:40:43fowlmouthno problem
06:47:51*brson quit (Ping timeout: 250 seconds)
06:48:46dtscodewhy would my server not be recieving anything from telnet dtscode.io 80? https://bpaste.net/show/724df58db281
06:55:13*gunn quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
06:56:08akiradeveloperSome way to make a sequence from (pointer, len:int)?
06:56:55*brson joined #nim
06:57:15dtscodeloop over the pointer maybe?
07:00:51akiradeveloperI don't like copying
07:01:23dtscodemaybe something in system?
07:04:33*sillesta joined #nim
07:10:54*gunn joined #nim
07:27:39*Angry quit (Ping timeout: 264 seconds)
07:36:22*dv- quit (Changing host)
07:36:22*dv- joined #nim
07:47:16Demosthat sounds really unsafe akiradeveloper
07:47:41DemosI could maybe see being able to make it an openarray
07:48:14akiradevelopermakes an openarray from (pointer, size)?
07:48:33DemosI mean I could see it being a safe thing to do
07:49:06fowlmouthakiradeveloper, if you dont want to copy you can just define a type for it, same interface as seq but uses pointer arithmetic
07:49:12Demosyou can cast the pointer to an array[0..2^48] or something
07:49:15*chemist70 quit (Quit: leaving)
07:49:43*chemist69 joined #nim
07:49:48Demosthere is a special pragma that disables bounds checking for a particular variable as well
07:49:59Demosinstead of making the size something insane
07:50:10akiradeveloperok. nim doesn't want normal users go that way
07:50:42Demoswrapping C code (I assume that is what you are doing) is not really "normal" and it can not be totally clean
07:50:45fowlmoutheh just use this https://github.com/fowlmouth/nimlibs/blob/master/fowltek/pointer_arithm.nim
07:50:56akiradeveloperAs a guy from C, it's natural for me to do unsafe cast
07:51:13Demosright, but you gotta realize that seq is garbage collected memory
07:51:34Demosso if you do that cast the GC will free the memory when that seq becomes unreachable
07:51:47Demosthe correct thing to cast to is the array
07:52:03fowlmouthakira you have to also be mindful of that memory, should it be freed after use? if so you can wrap it in a ref type
07:53:22Demoserm, only if it was allocated by nim's GC. I mean you can use destructors but it really depends on what you are doing
07:54:05fowlmouthDemos, he's writing a high level interface to fuse
07:54:16Demosoh
07:54:17akiradeveloperMy nim code often cause SEGV that's maybe because my nim code is terrible
07:54:19Demosthanks
07:55:14Demosyeah, I would go for an interface that casts to an array internally and then uses runtime bounds checking. One may already exist and if not I think it would be a decent thing to have in the standard library
07:55:44fowlmouthakiradeveloper, i have a fuse wrapper but i couldnt even get a basic example running
07:56:05akiradevelopermy nim-wrapper start to say hello
07:56:40akiradeveloperbut not stable. I don't think other guys want to use this kind of toy
07:57:18fowlmouthit would be cool to have something as high level as ruby's fuse wrapper, https://github.com/lwoggardner/rfusefs#the-hello-world-filesystem-in-14-loc
07:57:32akiradeveloperI think I, as a nim layman, should first go with the cleaner way. Pointer arithmetic is not natural in Nim
07:58:02akiradeveloperoh really really great
07:58:40Demosdoes fuse give you the array in question as a return value or an out parameter?
07:58:44akiradeveloperfor now, my nim-wrapper is a porting of rust-fuse
07:59:35akiradeveloperYes. I need to talk with fuse's kernel part via a single buffer
07:59:46DemosI meant which one
08:00:47akiradevelopermaybe the latter. I prepare a buffer and the kernel part write his request in the buffer and nim part handles it.
08:01:05Demosyou can just pass a seq in as the buffer
08:01:10Demosjust make sure it is the right size
08:01:21akiradeveloperyes. I use seq as the buffer
08:01:38akiradeveloperprecisely, a buffer class that wraps seq
08:04:10akiradeveloperBut I think if I write cleaner code, I remove all memory errors (out of memory, SEGV, ... really makes me annoying
08:04:30akiradeveloperruby's binding is really nice. I can learn from this
08:13:34*JinShil joined #nim
08:15:59*Demon_Fox quit (Quit: Leaving)
08:17:19*dumdum joined #nim
08:19:13*kuzy000_ joined #nim
08:19:22*Demos quit (Read error: Connection reset by peer)
08:19:30*Trustable joined #nim
08:23:49*brson quit (Ping timeout: 256 seconds)
08:24:21fowlmouthakiradeveloper, rusts fuse looks good
08:27:20*akiradeveloper quit ()
08:28:32fowlmouthgn
08:29:21*JinShil quit (Quit: Konversation terminated!)
08:42:05*ARCADIVS quit (Quit: ARCADIVS)
08:46:57*sillesta quit (Ping timeout: 245 seconds)
09:03:25*gunn quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
09:04:48*akiradeveloper joined #nim
09:07:59Araqtschmid: the indentation of 'of' follows the logic of 'if ... elif ... elif .. else'
09:09:18gokrAraq: Morning!
09:09:55Araqor ' try ... except except finally'
09:10:26*sillesta joined #nim
09:20:49*kapil__ quit (Quit: Connection closed for inactivity)
09:26:01*johnsoft quit (Ping timeout: 250 seconds)
09:47:24*gunn joined #nim
09:52:15*bjz joined #nim
10:04:01*tschmid quit (Ping timeout: 255 seconds)
10:08:26dtscodeoh i see how it is gokr. no good morning for me :D
10:08:37gokrdtscode: Nope ;)
10:08:42dtscode:(
10:08:51dtscodei may have legitimately found a bug
10:09:04gokrNo, we don't have legit bugs.
10:09:17dtscodei may have unlegitimately found a bug**
10:09:18dtscodemy mistake
10:09:23*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
10:09:25*VinceAddons joined #nim
10:09:41*MajorWork joined #nim
10:09:54dtscodeor are you secretly nikki and going to tell me that nim has no bugs?
10:10:11gokrHehe
10:10:20gokrDid she actually ever pop up here?
10:10:20darkfit doesn't have bugs, just happy little features
10:10:38gokrThe bugs are simply exercises for the community.
10:10:45dtscodeXD gokr dont think she did
10:10:59*MajorWork quit (Changing host)
10:10:59*MajorWork joined #nim
10:11:10darkfit's just a test of faith
10:11:19gokrBut I do think she is a she - one of the posts implied it. Or someone pretending of course.
10:11:52darkfor you could just say 'it' or 'he'
10:12:09darkf(or 'they')
10:12:29dtscodemeh. its easier to call nikki a she. thats what the general theory was iirc
10:12:35Araqekarlso: try --gc:markAndSweep as a workaround. I have a proper fix, but it requires way more testing.
10:13:05darkfdtscode: did you ask about / file the socket error stuff?
10:13:19dtscodei havent documented it yet
10:13:26darkfwell get on it
10:13:26darkf:D
10:13:47dtscoderemind me to do it in the morning? i was going to go to bed after this criminal minds episode
10:16:42*BlaXpirit joined #nim
10:20:16*codmajik joined #nim
10:27:50*bjz joined #nim
10:37:31*gsingh93 quit (Quit: Connection closed for inactivity)
11:03:24*akiradeveloper quit (Remote host closed the connection)
11:03:58*akiradeveloper joined #nim
11:08:32*akiradeveloper quit (Ping timeout: 264 seconds)
11:08:40*JinShil joined #nim
11:16:24*davidhq joined #nim
11:27:13*akiradeveloper joined #nim
11:30:58*gunn quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
11:38:50*JinShil quit (Quit: Konversation terminated!)
11:41:01*dumdum quit (Ping timeout: 256 seconds)
11:55:30*dumdum joined #nim
13:19:09*EXetoC joined #nim
13:20:55*Jehan_ joined #nim
13:30:26akiradeveloperopenarray isn't covariant
13:32:17*novist` is now known as novist
13:43:11*gokr quit (Quit: Leaving.)
13:46:54*Puffin joined #nim
13:48:07*titaniumone^ quit (Ping timeout: 255 seconds)
13:48:09*Puffin is now known as BitPuffin
13:52:19*gmoore joined #nim
13:52:26*akiradeveloper quit ()
13:53:20Araqer ... arrays are not covariant in general
13:54:41Araq goto BeforeRet;
13:54:56Araq tcell45546* c = usrtocell_49446(p);
13:55:05Araq BeforeRet: ;
13:55:48Araq--> jump to label BeforeRet crosses initialization of 'c'
13:55:57Araqwhat the ...?
13:58:54Araq"there is no place for a lower level language than C++" my ass
13:59:07wtwis this a specific bug or are you complaining about c in general?
13:59:09wtwah i see :D
13:59:41AraqC++'s spec assumes no dataflow analysis is done in compilers
14:00:14Araqthat's false for every commercial C++ compiler out there
14:00:33Araqseriously what the fuck. How should a C++ codegen then work?
14:00:57AraqI can't emit 'break' as that is defective in a 'switch' statement
14:01:06AraqI can't emit 'return' either
14:01:56Araqand I already pass -fpermissive
14:02:29wtwcould you emit _asm something? ;) (out of interest, not considering it'd be non-portable, ugly etc)
14:02:54wtwwell, probably the compiler would catch that also...
14:03:00def-Araq: put everything inbetween the goto and destination into a scope with {}?
14:08:30Jehan_Araq: I'm sort of missing the context here?
14:08:57AraqJehan_: my improved C++ codegen works with VS but fails with GCC
14:09:21Araqand I don't see how to generate C++ code that adheres to the spec
14:09:27Jehan_What's the issue? I can only vaguely guess at it from the fragment above?
14:09:43Jehan_Does gcc emit an error/warning for it?
14:09:52Araqhttp://stackoverflow.com/questions/11578936/getting-a-bunch-of-crosses-initialization-error
14:10:02Araqan error. warning wouldn't matter
14:10:14*BlaXpirit quit (Read error: Connection reset by peer)
14:10:19*ramnes quit (Ping timeout: 265 seconds)
14:10:39*ramnes joined #nim
14:10:40AraqIf you have
14:10:42Araqgoto err_exit;
14:10:43Araqint a = 1;
14:10:45Araqit complains.
14:10:46AraqAdd -fpermissive to your command line, and substitute:
14:10:48Araqgoto err_exit;
14:10:49Araqint a;
14:10:51Araqa = 1;
14:10:52Araqno complaints.
14:10:56*BlaXpirit joined #nim
14:11:17*Gonzih quit (Ping timeout: 265 seconds)
14:11:25Jehan_Hmm. It looks like you have to hoist the declaration out of the block and generate the assignment separately from the declaration?
14:11:34*Gonzih joined #nim
14:11:37Araqoh well, let's try that
14:11:59AraqJehan_: note that 'int' is a POD.
14:12:20Araqso that's clearly an issue with the c++ spec
14:12:44AraqI can see the reasons for these restrictions when you have destructors
14:12:54Araqbut for plain 'int'? come on.
14:13:23Jehan_Araq: I guess they did it in order to not make the spec even bigger than it already is. :)
14:13:39Araqand how hard is it to determine 'a' is not read before it's written in spite of the 'goto label'?
14:13:58Jehan_Someone could offer me a million Euros to write a spec-compliant C++ compiler and I wouldn't take the job. :)
14:14:51Araqalso ... I now map 'var T' to '&T'
14:15:13Araqbut guess what, posix.nim uses 'var' instead of 'ptr' ... so this breaks all code
14:15:31Jehan_Oh dear.
14:15:46Araqso now we get a " 'var' in 'importc' " special case
14:17:19Jehan_Or enhance importc so that it can take code templates rather than just names?
14:17:24*lws_ quit (Remote host closed the connection)
14:17:45Araqthat doesn't solve it, code breakage is bad
14:17:55Araqbtw we got that feature for 'importcpp'
14:17:56Jehan_This would also allow for the importc of operators.
14:18:01*lws joined #nim
14:18:15Jehan_Oh, I see.
14:18:18EXetoCJehan_: not much for challenges, eh?
14:18:30Jehan_EXetoC: Que?
14:19:01ekarlsodom96: you around ?
14:23:00Araqdef-: interesting. pointless {} work
14:24:13Jehan_Araq: Would it be possible to make "x.foo y" work similar to how function calls don't need parentheses?
14:24:13*plopsmcgee joined #nim
14:24:28Jehan_If there's only a single argument etc., I mean.
14:24:49Jehan_(Nothing that's important to me, just something I wondered about.)
14:24:52Araqdoesn't it work like this already?
14:25:10Araqhi plopsmcgee welcome
14:25:12Jehan_Hmm. I tried it earlier and it didn't, but I may have screwed up the code.
14:26:02Jehan_Oh, nevermind, it does.
14:26:05def-Jehan_: i think it works, but not if the function has a return type?
14:26:12plopsmcgeethanks Araq :)
14:26:45Jehan_Ah, it breaks inside parentheses.
14:26:57Jehan_E.g. "f(1.op 2)"
14:27:09Jehan_Anyhow, I have to be off for a talk. Talk to you folks later.
14:27:15*lws quit (Remote host closed the connection)
14:27:18*Jehan_ quit (Quit: Leaving)
14:27:50*lws joined #nim
14:30:42ekarlsodom96: you gotten any time to look at the nimble stuff ?
14:49:22*gokr joined #nim
15:01:27*mwbrown joined #nim
15:02:56*tschmid joined #nim
15:03:51*gokr quit (Quit: Leaving.)
15:10:01*BlaXpirit quit (Read error: Connection reset by peer)
15:10:11*BlaXpirit joined #nim
15:16:10*Angry joined #nim
15:22:23*johnsoft joined #nim
15:28:57reactormonkAraq, hlists in nim would be hilarious.
15:29:12Araqhlists?
15:32:13*dumdum quit (Ping timeout: 256 seconds)
15:35:13reactormonkAraq, a heterogeneous list
15:35:44reactormonka list with different types in it. Enabled by typeclasses.
15:36:01EXetoCobject variants?
15:36:22reactormonkEXetoC, no, entirely different types
15:36:59reactormonkAraq, and what is a concept exactly?
15:37:36Araqreactormonk: nobody knows. that's the beauty of the term :P
15:37:47reactormonkAraq, -.- why not just typeclass?
15:39:34*darkf quit (Quit: Leaving)
15:40:59Araqbecause it's longer
15:41:23AraqI like "concept" better
15:41:33Araqtype Iterable = concept ...
15:41:42Araqtype Iterable = typeclass ..
15:42:13Araqand I'm sure it's different enough from Haskell's typeclasses anyway
15:42:34reactormonkI only know scala's typeclasses...
15:42:39Araqso the academics will scream "that is not a typeclass! I will kill you!"
15:43:24Araqlike my math teacher used to say
15:43:46Araq"That is not the inverse function! I will kill you!"
15:47:46ekarlsoAraq: looked at the packages idea ?
15:47:55ekarlsoor Iguess you are too busy :D
15:48:53reactormonkAraq, got an idea how to implement e.g. Read with the concepts/typeclasses?
15:50:43*gokr joined #nim
16:02:23*webskippa joined #nim
16:03:09*webskippa quit (Client Quit)
16:04:16*devalru joined #nim
16:04:37devalruhi
16:06:01devalruIn installed the win x64 version but get this error when execute "nim compile": nimbase.h:385:13: error: size of array 'assert_numbits' is negative
16:06:05*Varriount|Mobile joined #nim
16:06:57devalruIn addition I have no build64.bat like https://github.com/Araq/Nim/wiki/Unofficial-FAQ said
16:07:07Varriount|MobileAraq: C++ bootstrapping is broken
16:08:49AraqVarriount|Mobile: I noticed
16:09:14Araqdevalru: Nim ships with a version of GCC for a reason
16:09:39Araqalso if you install, there is no need to run build64.bat
16:11:15devalruTarget: i686-w64-mingw32 - I guess I have to set the env path ? (vagrant installed)
16:11:34reactormonkAraq, https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-630004.1
16:11:46Varriount|Mobiledevalru: yes
16:12:40devalruI suggest to add it to the start.bat
16:13:18Varriount|Mobiledevalru: Are you using the compiler that comes with Nim?
16:13:21devalrubecause nimrod installs the mingw to dist/ the start.bat should use this installation. what you think ?
16:13:31Varriount|Mobile(The gcc compiler)
16:13:37devalruy
16:15:04Varriount|MobileAnd is the Nim compiler actually using that compiler?
16:17:35Varriount|Mobiledevalru: If it isn't, then there's a problem with the installer
16:17:43devalrumom
16:17:51reactormonkAraq, do we have return type overloading? Would be kinda cruical for e.g. the typeclass Read
16:18:05Varriount|Mobilereactormonk: No
16:18:09reactormonkpretty sure I've asked that one before.
16:19:15devalruVarriount: start.bat -> gcc -v -> gcc version 4.9.1 (x86_64-win32-seh-rev1, Built by MinGW-W64 project)
16:19:33*dumdum joined #nim
16:23:47devalruVarriount: PATH is set correctly to the dist/mingw/, so I don't know why nim compile fails than
16:28:12Varriount|Mobiledevalru:The original error you got indicates that the Nim executable was built for one architecture, and GCC another
16:28:16dom96ekarlso: I looked at it briefly and I would prefer if you moved package repo related stuff to a separate module.
16:28:46Varriount|Mobiledevalru: You installed the 32 bit version of Nim?
16:29:03Varriount|MobileOr the 64-bit version?
16:29:19ekarlsodom96: really why ?
16:29:21devalruVarriount: I have two installations, I think there is a conflict. When I start the start.bat and execute gcc -v AFTER nim compile the shell gives me the wrong mingw version.
16:29:46dom96ekarlso: Because I like to keep things separated.
16:30:50ekarlsodom96: so you want to support both old and new ?
16:31:17dom96ekarlso: Of course
16:31:24ekarlso:/
16:31:25Varriount|Mobiledevalru: Odd.
16:32:12ekarlsodom96: but how the crap you code around both ?
16:34:25ekarlsodom96: just seems there's alot of duplicate work then :/
16:38:09dom96make a PR and i'll make comments in the diff
16:38:41Varriount|Mobiledevalru: If you can be on here in about 2 hours from now, I can give you more help, and also guide you through setting up two Nim installations
16:39:00ekarlsoyou dont have time to explain now dom96 ?
16:39:23devalruVarriount: First mingw (x32) is installed with vagrant and added to PATH. I think I have to update the PATH or remove vagrant.
16:39:56devalruVarriount: thank you for help but I try it tomorrow ;)
16:40:46dom96ekarlso: it's simple, you put your 'register' function inside a nimregistry module
16:41:16ekarlsodom96: but why do you need to continue supporting package.json
16:41:53dom96ekarlso: for backwards compatibility, your packages website still hasn't been tested.
16:42:11dom96I also want to allow support for custom packages.json
16:42:31ekarlsocustom how ?
16:43:15dom96nimble update http://mywebsite.me/myOwnPackages.json
16:43:18dom96works
16:43:52ekarlsoah hmmms
16:45:17*devalru quit ()
16:53:12*superfunc joined #nim
16:55:59ekarlsodom96: suggestions for supporting both ?
16:56:05ekarlsoI mean the list / install / search funtions
17:03:49*plopsmcgee quit (Ping timeout: 246 seconds)
17:04:43codmajikhi guys, is there anywhere I can find BNF version of http://nim-lang.org/manual.html#grammar
17:05:03codmajikbefore I go down converting back
17:05:25codmajikam working on an IntelliJ IDEA plugin
17:05:46codmajiktheir grammerkit only works with plain old BNF
17:15:18gmpreussner|workdo we have a mechanism for declaring generic procs only for generic parameters that fulfill certain conditions? for example, in D i could use static_if within the class body.
17:15:37gmpreussner|workin Nim i can filter for equality, i.e. "proc cross[T](v: Vector[3, T]): Vector[3, T]" where N == 3, but what if i want to filter non-equality conditions, such as N < 5?
17:15:41dom96ekarlso: Add an option in the config file to switch between them.
17:16:13dom96gmpreussner|work: perhaps 'when' is what you want?
17:16:43dom96codmajik: Don't think there is a BNF version. That grammar is pretty close though I think.
17:17:36superfuncshouldn't be too hard to convert it
17:18:28gmpreussner|workdom96: can 'when' filter on generic parameters inside its scope? i wouldn't expect that to work. i.e.: when N < 5: proc foobar[N](f: Foo[N]) = ...
17:19:05dom96gmpreussner|work: I think it can. Perhaps you should put it inside the body of the proc.
17:19:53gmpreussner|workdom96: but if i put it inside, then what is the else condition? empty body? i would rather not have the proc be available at all if the condition is not fulfilled.
17:20:57codmajikdom96: yeah its close, would work on converting back
17:21:13dom96gmpreussner|work: You can raise a compile-time error for example
17:21:49codmajikdom96: but I would probably want to run it by you so I don't miss something, since am a nim-noob
17:22:35gmpreussner|workdom96, i guess that would work, yes
17:23:16codmajikdom96: better still, is there a single source file that exercises all of nim's grammer I could use to verify
17:24:27*davidhq quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
17:25:16ekarlsodom96: wondering if I should move out the "old" functions then kinda
17:25:24ekarlsointo like legacy.nim or smth
17:25:33ekarlsoand have nimble.nim have top level methods
17:25:50*davidhq joined #nim
17:25:55dom96codmajik: no comprehensive one unfortunately.
17:26:25dom96ekarlso: please don't
17:26:37dom96ekarlso: make minimal changes to get your stuff working
17:26:47ekarlsodom96: it's not that easy..
17:26:51codmajikdom96: cool. let you guys know what I come up with
17:27:55ekarlsodom96: would you like to help out on the nimble part ?
17:29:06dom96ekarlso: I'm busy with other things currently.
17:29:13*sillesta quit (Remote host closed the connection)
17:29:24ekarlsoyeye, then it'll have to wait, because doing it simpler then I have now I'm unsure of
17:29:37ekarlsobut I guess it's fine with the ackages.json format atm
17:29:38*sillesta joined #nim
17:31:07*codmajik quit (Ping timeout: 246 seconds)
17:33:50*sampwing joined #nim
17:34:02ekarlsoI just know that having a packages index is a nice thing to have for users and in general
17:39:19*davidhq quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
17:40:17*dumdum quit (Ping timeout: 256 seconds)
17:45:04*Matthias247 joined #nim
17:51:19*Jehan_ joined #nim
17:53:50*MajorWork quit (Quit: Leaving)
18:03:20*gunn joined #nim
18:04:10reactormonkdoes the proc type have type arguments?
18:04:25*sampwing quit (Ping timeout: 252 seconds)
18:09:09*matkuki joined #nim
18:10:17Jehan_reactormonk: What do you mean?
18:10:36reactormonkJehan_, proc[int, bool]
18:11:07Jehan_reactormonk: Still not sure what you mean by that?
18:11:28reactormonkJehan_, as in, is `proc` a proper type by its own?
18:11:54Jehan_proc is really a family of types.
18:12:14Jehan_Dependent on arity, argument types, and return type, plus calling convention.
18:13:10Jehan_You can do, for example: var a: proc(x: int): bool
18:16:05*sampwing joined #nim
18:29:14ekarlsodom96: how would you really want it organized then ?
18:29:58*codmajik joined #nim
18:30:26*davidhq joined #nim
18:33:45*sampwing quit (Ping timeout: 252 seconds)
18:37:16*sampwing joined #nim
18:41:08*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
18:44:41matkukiIs there an overhead for a types procedure attribute? Example: https://bpaste.net/show/7d0e829d95cd
18:44:43matkukiIs "power(12)" faster than "ObjProcType.AttribProc(12)"
18:46:17Araqno.
18:46:30Araqoh wait
18:46:31matkukiGreat, thanks.
18:46:41matkukiWait?
18:46:47Araqwhen you do it this way, there is an overhead, yup
18:47:02matkukiWhen is there no overhead?
18:47:29Araqwhen you do foo.bar(4) as syntactic sugar for bar(foo, 4)
18:48:39matkukiIs the overhead small or significant if used in loops?
18:49:38Araqusually measurable
18:49:47matkukiOK, thanks.
18:50:16BlaXpiritwat
18:52:27*sampwing quit (Ping timeout: 252 seconds)
18:56:33*alexruf joined #nim
18:57:02*sampwing joined #nim
18:58:50matkukiI was thinking of making types that would act as namespaces when instanciated, since there are no static classes.
18:58:52matkukiThen I could do "module.namespaceTypeInstance.namespaceProc", for example.
18:59:56matkukiWas hoping there was no overhead.
19:00:12BlaXpiritand that, Araq, is what you're gonna have people doing if there are no namespaces
19:00:40BlaXpiritmatkuki, all i can tell you is... why don't you replace a dot with an underscore and call that a namespace
19:01:24matkukiBlaXpirit: Will try it, thanks for the suggestion.
19:01:32Jehan_Umm, you want namespaces *within* a module? Why?
19:02:05BlaXpiritfirst of all, modules are very limiting
19:02:18BlaXpiritsecond, using them as namespaces very rarely works out
19:02:30Jehan_You'll have to explain that.
19:02:32BlaXpirit(talking import nil and whatnot)
19:02:55BlaXpiritwell, i've stated a few times that from ... import nil is almost always useless
19:02:56Jehan_I mean, I'm not crazy about the "from x import nil" syntax myself, but that could be fixed.
19:03:02BlaXpiritbecause it doesn't import operators, methods, etc
19:03:35Jehan_For purposes of generics/templates, you mean?
19:03:43BlaXpirithuh.. no?
19:03:47EXetoCthe problem is not actually "modules as namespaces" then, is it?
19:04:10Jehan_I'm also not sure how a namespace would fare better in that regard.
19:04:29BlaXpiritfirst of all, you could put these things outside the namespace
19:04:44Jehan_Unless we're miscommunicating and you mean something by it that's different from what I think you mean.
19:05:04BlaXpiritnim basically doesn't have namespaces
19:05:22BlaXpiritall it has is one global namespace, with conflict resolution mechanism
19:05:49Jehan_Umm …
19:06:03Jehan_That strikes me as the mother of all overstatements.
19:06:14*bjz joined #nim
19:06:33Jehan_I mean, at a very minimum, if I define a symbol in a module and do not export it, it's not visible anywhere else.
19:07:00Jehan_Which is sort of the exact opposite of one global namespace.
19:07:05BlaXpiritthat is not really about namespaces
19:07:22BlaXpiritbut this does raise another dire problem
19:07:45BlaXpiritthere is public and private, but no protected
19:08:14Araqit's called dot-aholic. People.who.are.only.happy.when.everything.is.separated.with.a.dot.
19:08:20EXetoCwhat you said is not about namespaces either
19:08:29BlaXpirityup
19:08:32Araqit also has nothing to do with programming.
19:08:36BlaXpirithence "another problem"
19:08:48Jehan_So? Protected only really makes sense in the presence of inheritance, and even there it's arguable whether there's a point to having different private and protected visibility.
19:09:23BlaXpiritthere is no point to having private and protected, but if there's private, there needs to be protected
19:09:39ldleworkthat seems self-contradictory
19:09:42ldleworkdid you word that wrongly?
19:09:51EXetoComitting the namespace from symbols or not doing nil importing does not mean that there now is no namespace
19:09:56Jehan_I'm not even sure what protected would mean without inheritance.
19:10:17AraqI'm out.
19:10:19BlaXpiritJehan_, basically my concern is
19:10:20Jehan_Unless it's supposed to have some different semantics from C++/Java/etc.
19:10:32BlaXpirityou can't improve on the implementation of something
19:11:48BlaXpiriti can't completely understand what I'm thinking, let alone explain it
19:12:02BlaXpiritso let's just go back to the lack of namespaces
19:13:52EXetoCagain, what lack of namespaces?
19:14:01BlaXpiritNim's lack of namespaces
19:14:02Jehan_It sounds like you want some sort of inheritance scheme for modules. Where you want to import and modify a module and export the result.
19:14:23BlaXpiritno, Jehan_, I want inheritance for classes, across modules
19:14:28EXetoCdid you just not say "modules as namespaces"?
19:14:45BlaXpirityou said that :|
19:15:01BlaXpiritwell i did implicitly say that, ok
19:15:19Jehan_I'm still not sure what a namespace would provide that a module does not.
19:15:25EXetoCyou did, just that you worded it differently
19:15:33EXetoCright
19:15:51ldleworknamespaces should be ethereal
19:15:59ldleworkI can't wait until this opinion is more popular
19:16:18ldleworks/ethereal/transient
19:16:40BlaXpiritJehan_, trivial namespaces indeed seem exactly the same as a module
19:17:21BlaXpiritand I haven't felt a huge need for namespaces per se
19:17:27Jehan_Okay. What would non-trivial namespaces do that modules don't?
19:17:55BlaXpiritnesting
19:18:15ldleworkJehan_: namespaces spanning multiple files
19:18:21BlaXpiritbut that's a different topic, this is not important
19:18:30ldleworkor make modules not the same thing as files
19:18:35BlaXpiritldlework, well, you can get that by importing everything in one file :|
19:18:53ldleworkBlaXpirit: I know there are tons of stupid ways to get Nim to do what you expect to be able to do in 2015
19:18:57Jehan_That seems like what include is for? Unless you want multiple modules within the same file.
19:19:14ldleworkJehan_: include breaks the import contract
19:19:22BlaXpiritJehan_, ever thought about importing part of a namespace
19:19:44ldleworkI should be able to have a module/namespace made up of several files, each file of which is able to import just the things it needs from the other files.
19:19:58BlaXpiritI just realized one usecase for namespaces that i totally forgot I needed
19:20:13BlaXpiritC++ libraries tend to have classes with generic names
19:20:22Jehan_BlaXpirit: No, not really. I think that would be a symptom of a poorly designed module.
19:20:22ldleworkBlaXpirit: all libraries do
19:20:24BlaXpiritand that's OK, because they're in a namespace
19:21:08BlaXpiritthat SFML library I've been rattling about
19:21:24BlaXpirityou are encouraged to always write sf::SomeClass
19:21:37ldleworkWe should just copy rust modules outright :/
19:21:44EXetoCnamespaces? check
19:21:45BlaXpirituh probably
19:22:30BlaXpiritEXetoC, what does that mean
19:23:32ldleworkIn Rust all this module business is utterly decoupled from the filesystem/files
19:23:42ldleworkAnd you're free to organize your project literally any way you wish
19:23:56ldleworkAnd subsequently, build up and expose your module in any manner you wish
19:24:01ldleworkThose idiots.
19:24:10BlaXpiritlel
19:24:25*JehanII joined #nim
19:24:28BlaXpiritwell C++ has almost all of the same advantages
19:24:34ldleworkAnd in nim we have
19:24:46JehanIISomedays I hate my ISP ...
19:24:47ldlework"Just use include"
19:24:53EXetoCyou just have to convince the BDFL that hierarchies are good
19:24:57*Jehan_ quit (Ping timeout: 265 seconds)
19:25:01codmajikAraq: is there any reason why folders are not considered when generating c sources files
19:25:03ldleworkEXetoC: impossible
19:25:05JehanIILet me just quickly catch up on the logs ...
19:25:49*JehanII is now known as Jehan_
19:26:26*Angry quit (Ping timeout: 246 seconds)
19:27:02Jehan_ldlework: I wouldn't mind having a module system decoupled from the file system, but I don't really see this making a big difference, one way or the other.
19:27:20EXetoCI don't really care much myself
19:27:24Jehan_It's irritating in languages like Java and Eiffel with a one-class-per-file restriction.
19:27:38BlaXpiritjust you wait until big corporations that write real code get to Nim
19:27:42Jehan_But a Nim module is really a general enough container that it's not hugely critical.
19:27:52BlaXpiritoh wait, they won't, because they'll consider the language a joke
19:27:52ldleworkJehan_: you must not value freedom to organize your project how you see fit
19:28:04ldleworkas much as I do, I mean
19:28:17Jehan_ldlework: Eh, that's mostly determined by project guidelines.
19:28:28ldleworkJehan_: of which I am allowed to define most of the time
19:28:38Jehan_What I would be very much in favor of is to clean up the module lookup semantics.
19:28:54ldleworkAnd I plan to write tons of personal Nim, assuming we don't hard-line Nim's unsanded edges.
19:29:36Jehan_But with respect to the module/file boundary:
19:30:42Jehan_There are really two cases: One, multiple files making up a module (include handles that easily). Two, multiple modules in the same file. That would be annoying to do, but I haven't encountered much of a need for it.
19:31:10*fowlmouth left #nim ("Leaving")
19:31:22Jehan_As I said, it's more of annoyance in languages where each class needs its own file.
19:31:40BlaXpiritas if there are so many of them
19:31:51BlaXpiriti can think of only one
19:32:02ldleworkI don't need multiple modules per file
19:32:11Jehan_Well, I hear that Java is sort of popular these days. :)
19:32:54*nande joined #nim
19:33:07Jehan_Eiffel also pretty much enforces it (not per the language spec, which is OS-agnostic, but any actual implementation).
19:33:46Jehan_And a number of other languages really discourage multiple classes per file, even where you can theoretically do it. But that's not really important. I just note that it can be an annoyance and that I don't like it.
19:34:31ldleworkJehan_: have you used Python much at all?
19:34:41Jehan_What I'd find more interesting to discuss, honestly, is how modules are organized within directories, module lookup semantics, etc. I think there are some rough edges that could be filed off.
19:34:51Jehan_ldlework: I used to use it a lot.
19:35:06BlaXpiritthe module system really seems to have been "inspired" directly by Python
19:35:08ldleworkJehan_: I find its module system and its import semantics to be incredibly flexible
19:35:17ldleworkBlaXpirit: except that we crippled it badly
19:35:28ldleworkIt 'looks' like python's import semantics but work nothing like them
19:35:40BlaXpiritldlework, that was i was gonna say
19:35:43ldlework'import foo' in python and nim are drastically different
19:35:53Varriountldlework: How is it crippled?
19:36:17ldleworkVarriount: Python's import semantics cover just about every case you might want
19:36:17Varriount(I'm not offended, just curious)
19:36:21ldleworkWe support one of those.
19:36:23Jehan_ldlework: Hmm. The difference between Python and Nim (or other statically typed languages) is that Python can't disambiguate between entities with the same name, but different signatures (or classes vs. defs etc.).
19:36:31BlaXpiritVarriount, only "import x" syntax is any useful
19:36:35ldleworkIn python, you can import a namespace, import a name under a namespace, or import a name directly
19:36:44ldleworkIn Nim, you get everything, and fuck you.
19:36:57ldlework(not you Varriount)
19:36:57BlaXpirityes
19:37:16*JehanII joined #nim
19:37:18VarriountWhat about 'from x import y' in Nim?
19:37:27JehanIISo, Python has to be very careful with importing names into the current namespace, while statically typed languages do not have to be.
19:37:33BlaXpiritVarriount, it is useless
19:37:42BlaXpirit:03:00] <BlaXpirit> because it doesn't import operators, methods, etc
19:37:50ldleworkJehanII: importing something that way also allows me to instantly discover where a name comes from
19:38:14ldleworkI -want- to be careful
19:38:44ldleworkFurther more
19:38:54EXetoCjust discuss it on the forum at some point. if you don't like the forum, then so be it
19:38:57ldleworkI want to be able to import something, without it's owning module clobbering that name (how stupid!)
19:39:16VarriountHm. I haven't actually looked at the Nim compiler module handling code yet.
19:40:32matkukiJust to make my idea clear, I don't care for inheritance, protected, ... All I was asking was, if there is a possibility to make blocks of statements grouped together in a namespaces inside a module.
19:40:33matkukiSo they could be called either "mymodule.proc" or "mymodule.mynamespace.myproc", that's all. The namespace should NOT be exportable, inheritable, washable, ...
19:40:35matkukiI don't care if it's done by a macro or some other Nim magic. But if it's not possible, there's no problem.
19:40:41JehanIIBlaXpirit: Not sure what you mean, but for me it does import operators and methods?
19:40:54*Jehan_ quit (Ping timeout: 265 seconds)
19:41:27VarriountJehanII: He means it doesn't import operators and methods related to a type
19:41:48BlaXpirityes
19:41:54JehanIIIn any event, I think that whether the default is importing a name into a namespace or not is a matter of taste, where one is not objectively better or worse than the other.
19:41:57BlaXpiritif a type has 50 methods and 20 operators
19:41:58JehanIIVarriount: Ah.
19:42:03BlaXpiritand you just import a type
19:42:03EXetoCldlework: I'll just say again that most people are not bothered about that
19:42:07BlaXpirityou're left with just a useless shell
19:42:11VarriountEg, 'from tables import Table' only imports the type, and not any of the procedures applicable to the type
19:42:26BlaXpiritand how is that ever useful
19:42:29ldleworkEXetoC: "most people put up with this wart" is literally the weakest reasoning I can hear
19:42:31ldleworkEXetoC: but ok
19:42:37JehanIII'd prefer Nim to have full OO support myself, but I think that ship has sailed.
19:42:48EXetoCyou're the one who calls it a wart
19:42:51*JehanII is now known as Jehan_
19:43:13ldleworkEXetoC: because there is a potentially objectively more flexible option that exists as a superset of functionality
19:43:17EXetoCothers might, but not many peopled have discussed it
19:43:35ldleworkEXetoC: it is objectively a wart, regardless if other people don't worry about it because it is not fundamental to their experience
19:43:45ldleworkBecause that functional superset exists.
19:43:48Jehan_One could probably write a "smart" "from x import …", though, as an approximation.
19:43:57*Mat4 joined #nim
19:44:00Mat4hello
19:44:01BlaXpirityes, that is my main wish in all this
19:44:13BlaXpiritdot-syntax could grab any associated functions
19:44:21BlaXpiritand operators could be grabbed as well
19:44:51Jehan_The one problem I see with that is that (once you get the transitive closure), you might be grabbing a lot.
19:45:17Jehan_At which point you can just import everything. :)
19:45:29BlaXpiritJehan_, only dot-syntax would look globally
19:45:58VarriountBlaXpirit: Well, the importing code (compiler/importer.nim) doesn't look *too* complicated. It's mostly symbol lookup
19:46:20matkukiMat4, you have joined what seems like a war zone :)
19:47:18Mat4hi matkuki, it seems so
19:47:20VarriountBlaXpirit: You could implement the 'smart' import, and send a PR
19:48:39BlaXpiritno, i couldn't, i really couldn't
19:48:57BlaXpiritif i could, i would be making my own language
19:55:48BlaXpiritdoes this seem sane though? would be nice to state this clearly on github or somethin
19:56:35EXetoCyes, somewhere where it doesn't get as convoluted
19:56:42VarriountBlaXpirit: The key difference between Python and Nim, in this case, is symbol lookup
19:57:07VarriountBlaXpirit: Nim supports overloading/static dispatch
19:57:35VarriountFurthermore, modules aren't objects in Nim as they are in Python
19:57:46Mat4I beg your pardon interrupting the discussion, have someone here an idea how to improve code-size optimization ? A simple program priniting 'hello world' compiles with -d:release --opt:size to ~26 kb (Linux, x86) at current
19:59:13VarriountMat4: http://forum.nim-lang.org/t/679/1
20:00:19Jehan_Mat4: That seems reasonably small to me, given that this contains at the minimum the startup code and the garbage collector?
20:02:14VarriountBlaXpirit: To be succinct, I fear having a 'smart' import, while conveniant, would cause confusion. The only 'problem' I percieve that it solves is being explicit with what types you are using. Procedure names would still be implicitly imported
20:02:14Mat4I plan to test some code for PIC32 MCU's running with RetroBSD. The PIC has 64 kb of ram avariable so each byte is important
20:02:51VarriountMat4: --os:standalone and --gc:off ?
20:03:22Varriount(If you only have 64 kb of memory, you probably want to manually manage memory anyway)
20:03:30*dumdum joined #nim
20:03:34Jehan_SHould be --gc:none.
20:04:05VarriountBlaXpirit: Also,
20:04:54ldleworkfrom foo import Bar*
20:05:18Varriount'smart' importing could get very... complex. What happens to procedures that operate on a type an imported type contains? What if I have procedures imported from a different module that act on the same type contained in a type from another module??
20:05:41ldleworkVarriount: that is already possible in both cases
20:06:26Varriountldlework: Yes, I know. But having a 'smart' import complicates matters. How should it act in those cases?
20:06:29BlaXpiritVarriount, I am talking only about dot-syntax about operators
20:06:36BlaXpiritit should not import procedures at all
20:06:42ldleworko_O
20:07:13ldleworkVarriount: it should just do what it is supposed to do, and the compiler will complain in each of those cases
20:07:19ldleworkjust as if you had manually done those imports yourself
20:07:23Mat4-d:release --opt:size --gc:off --stackTrace:off --lineTrace:off -> 15kb (x64), ~25kb (MIPS32, PIC)
20:08:27Jehan_Umm, not sure why that distinction between operators and procs.
20:08:36ldleworkMe either
20:08:43ldleworkan operator is a proc
20:08:52reactormonkJehan_, there is none
20:09:11reactormonkMat4, can you find out what takes how much space?
20:09:11ldleworkreactormonk: read what BlaXpirit just said?
20:09:14Jehan_ldlework: Yeah, exactly.
20:09:40reactormonkldlework, not everything you read on the internet is true
20:09:55ldleworkreactormonk: I think you're missing context or something
20:10:00ldleworkor trolling
20:10:12VarriountMat4: Have you stripped the executable?
20:10:26reactormonkldlework, ok, lemme read some stuff
20:10:39VarriountMat4: Also, this link might help: http://stackoverflow.com/questions/200292/process-for-reducing-the-size-of-a-executable
20:10:45BlaXpiritso, what do you think... the only change I suggest is, operators and methods called using dot should be looked up in all modules even if they were "imported nil"
20:10:58ldleworkWhat?!
20:11:03ldleworkWithout even importing them?!
20:11:29ldleworkInterrobang?!
20:11:55BlaXpiriti dunno, just suggesting
20:12:42ldleworkimport foo, from foo import Bar, from foo import Bar*
20:12:46ldleworkall cases covered.
20:12:54VarriountJust checking, what exactly is this change supposed to fix/improve?
20:13:04BlaXpiritmaking from x import y useful at all
20:13:10ldleworkyeah
20:13:23Mat4reactormonk: not sure, seem to be code for debugging purposes ?!??
20:13:40reactormonkldlework, from what I see my point still stands. There is no difference between procs and ops
20:14:07Mat4Varriount: strip helped, thanks. 11 kb (x86), ~20 kb (MIPS32)
20:14:08ldleworkreactormonk: right, a statement I agreed with, Jehan agrees with
20:14:09reactormonkMat4, huh. Can I take a look? Pastebin etc.
20:14:26ldleworkreactormonk: Jehan_ wasn't asking "Seriously, what's the difference, tell me the different that exists but that I do not know"
20:14:37ldleworkreactormonk: Jehan_ was asking "Is there really a difference?"
20:14:47ldleworkreactormonk: I was asking you to look at the statement to which Jehan_ was replying
20:14:56*codmajik quit (Quit: Page closed)
20:15:10Jehan_To be precise, I was asking why he wanted to treat operators and procs differently.
20:15:14reactormonkldlework, ok.
20:15:15ldleworkWhich is that BlaXpirit was saying t.. yeah that
20:15:43reactormonkBlaXpirit, yeah, so we don't know how tod differentiate between ops and procs
20:15:45Jehan_Since I didn't see the point. If it makes sense for operators, it also makes sense for procs.
20:15:53ldleworkie
20:16:28Jehan_I guess you could do it by name. I.e. if the name is all operator characters, it's an operator.
20:16:45Mat4reactormonk: uno momento
20:17:26Jehan_My guess it's because operator syntax doesn't allow the operator to be qualified with a module name.
20:17:29VarriountMat4: I wonder why the size difference is so drastic between platforms?
20:17:40Jehan_So you'd have to do mod.`+`(x, y) or something like that.
20:17:56reactormonkJehan_, so be it
20:17:58Jehan_At the same time, this also holds for x.foo(y).
20:18:11reactormonkJehan_, unified calling syntax etc.
20:18:15Jehan_So I'm still not sure why there's a point in leaving out procs.
20:18:31Mat4Varriount: MIPS32 has a typical RISC encoding with fixed opcode depth whereby x86 is 2x more compact (more or less)
20:19:07reactormonkMat4, works
20:21:39VarriountMat4: Ah, I see. (I actually just did a presentation on the x86 instruction set :D )
20:21:44ldleworkJehan_: there is none, as he said he was just thinking outloud
20:21:53ldleworkVarriount: is it online?
20:22:57Varriountldlework: Yeah. It's not very good. It was for a basic comp-sci course. I had to... simplify things in order to make the information comprehensible to the class.
20:23:13ldleworkI'd still love to watch it.
20:23:16ldleworkI used to be...
20:23:26ldleworkahem, heavy into black-hat reverse engineering
20:23:29ldleworkso nostalgia
20:23:33AraqJehan_: this 'goto' stuff is killing me
20:23:40*shodan45 joined #nim
20:23:55Varriountldlework: Well, the presentation itself wasn't recorded. I just have the paper and the slideshow
20:23:59ldleworkoh
20:24:00ldleworkokay
20:24:17Araqseems like I *really* need to avoid generating 'goto' for 'if'
20:24:20VarriountThe slideshow was thrown together in about 15 minutes - I spent too much time researching
20:24:54shodan45Araq: goto is bad, mmmkay? ;)
20:24:57Jehan_Araq: C++ again?
20:25:06Araqyes
20:25:29Araqshodan45: so name a single instruction set that has no 'goto'.
20:25:43Varriountldlework: For example, I simplified the reasons why a 32 bit processor could only address 4GB of memory. I left out things like lookup tables and memory maps.
20:26:08shodan45Araq: HTML? :D
20:26:09ldleworkshodan45: xu do kelci lo barduku
20:26:10ldleworkshit
20:26:14ldleworkshodan45: do you play go?
20:26:47shodan45ldlework: no...
20:27:11ldleworkshodan45: okay just checking 'shodan' is a rank there (I understand its a rank in other places too, was just checking)
20:27:25shodan45ldlework: shodan == http://en.wikipedia.org/wiki/SHODAN
20:27:55*shodan45 contemplates switching to "SHODAN"
20:28:23ldleworkhttp://en.wikipedia.org/wiki/Shodan_(rank)
20:28:32shodan45ldlework: what language was that?
20:28:47ldleworklojban, sorry
20:29:30ldleworkstrange, the first time I've emitted it on accident without being aware of it
20:31:32shodan45ldlework: my IRC font makes you look like "Idlework"... I was having fun trying to tab-complete your nick
20:31:54*ldlework writes down 'shodan45' next to the number 33294
20:32:05shodan45:P
20:33:09shodan45is there a way to get a screen shot in nim? in linux/x11?
20:33:26ldleworkshodan45: you can shell out to some system command
20:33:42shodan45ldlework: yeah, trying to avoid that
20:34:28ldleworkshodan45: https://github.com/nim-lang/x11
20:35:37shodan45hmm, bare x11? I've heard it's "fun" :)
20:36:51ldleworkshodan45: how do you expect to do it without an external command otherwise?
20:38:41ldleworkI mean
20:38:47ldleworkyou could use a different external lib
20:38:53ldleworkffmpeg, etc
20:41:58*Mat4 is now known as Mat4-backend_cod
20:42:17*Mat4-backend_cod is now known as Mat4-be_coding
20:42:21*alexruf quit (Quit: My Mac has gone to sleep. ZZZzzz…)
20:43:02*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
20:45:43matkukiHows the "mitems" iterator coming along?
20:47:41BlaXpiritshodan45, http://blaxpirit.github.io/nim-csfml/csfml_graphics.html#capture,RenderWindow
20:47:49BlaXpiritas usual blabbering about my lib
20:48:35BlaXpiritbut it does do a lot
20:49:31*alexruf joined #nim
20:50:54ldleworkBlaXpirit: I think he's asking for full screen capture
20:51:19Araqmatkuki: nim devel has it in system.nim
20:51:32matkukiYuhu, thanks.
20:51:45BlaXpiritldlework, it is
20:51:54Araqok I think I got it now. I simply need to emit *more* braces
20:51:55ldleworkBlaXpirit: it sounds like it only captures what is in your csfml window?
20:51:58BlaXpiritwait, it's not
20:52:00ldlework:)
20:52:07BlaXpiritsorry
20:52:36Mat4-be_codingAraq: *lol*
20:53:49*bjz joined #nim
21:00:52dtscodeAraq, when in doubt, use goto
21:02:04*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
21:06:20*brson joined #nim
21:17:13Mat4-be_codingif I have a procedure: 'proc pick (stackDepth : tStackDepth) : tMachineCode'
21:17:53Mat4-be_codingwith tMachineCode ->
21:17:56Mat4-be_coding tMachineCode = object
21:17:56Mat4-be_coding aSequence : array [0..32] of uInt8
21:17:56Mat4-be_coding nSequence : range [0..32]
21:18:42Mat4-be_codingcan I write 'result.aSequence[0] = 0x48 ...'
21:18:59Mat4-be_coding?
21:19:18Mat4-be_coding(a bit of tacit programming)
21:19:59Araq result.aSequence = [0x48u8, 0x8, ...]
21:20:27Araqonly the very first array element needs the 'u8' suffix, I think.
21:22:03*zacts quit (Ping timeout: 245 seconds)
21:22:04Mat4-be_codingthanks
21:25:35Mat4-be_codingwhat's the reason for the 'u8' suffix ?
21:26:20Araqthe compiler is too stupid to guess what you mean
21:31:35*sampwing quit (Ping timeout: 252 seconds)
21:39:24*kuzy000_ quit (Ping timeout: 245 seconds)
21:52:38matkukiCan someone help me with an import problem: https://bpaste.net/show/3b2c9f55a30e ?
21:54:19matkukiIf the "collisions" import is deleted out of "objects.nim", the error dissapears.
21:55:23matkukiI only added the top lines of the modules! There is more code in them.
22:03:33*alexruf quit (Quit: Textual IRC Client: www.textualapp.com)
22:07:11*dumdum quit (Ping timeout: 256 seconds)
22:08:22*ARCADIVS joined #nim
22:13:32dom96matkuki: I think that's because it becomes a circular dependency
22:14:21matkukidom96: Oh, OK. Need to reshuffle a few proc's then.
22:28:33shodan45aporia is still the recommended editor/IDE for nim?
22:29:02Mat4-be_codingyes
22:29:07Mat4-be_coding(as I know)
22:29:23*Angry joined #nim
22:29:26shodan45because "nimble install aporia" failed for me :(
22:30:03shodan45CustomStatusBar.nim(41, 24) Error: undeclared identifier: 'False'
22:31:33EXetoCtry aporia#head
22:31:33dom96shodan45: nimble install aporia@#head
22:31:39EXetoCoh right
22:31:44EXetoCnew syntax
22:31:54shodan45dom96: ok, will do
22:32:09Mat4-be_codingI'm a Vim user so haven't tried compiling the current Aporia sources
22:32:22Mat4-be_coding(yet)
22:32:49shodan45dom96: yay, that worked :)
22:40:08shodan45btw, how's the compile-to-javascript stuff going?
22:41:14shodan45I saw that Scala.js announced that they're "production ready"
22:43:58shodan45tbh, if scala compiled to native binaries instead of JVM bytecode, I'd be a lot less interested in nim
22:50:03Angryhttps://gcc.gnu.org/java/
22:50:19*semperos joined #nim
22:51:11flaviuI think that scala uses modern bytecodes that GCJ doesn't support.
22:52:09flaviuAnd Java bytecode really is designed for a JIT. It wouldn't do well with native compilation where devirtualization isn't a common optimization.
22:57:05Matthias247flaviu: android seems to think different about that recently ;)
22:57:15dom96shodan45: We use it in production for http://nim-lang.org/lib.html#nimble
22:57:23dom96It works well I think.
22:57:25Matthias247but maybe the main reason for ahead-of-time is startup time for them
23:00:02flaviuMatthias247: Looks like android has devirtualization: https://android.googlesource.com/platform/art/+/e3cd2f0
23:00:31*sampwing joined #nim
23:01:34Matthias247"Rough statistics show that we devirtualize using this change around 2.5% of
23:01:35Matthias247the time, whilst some apps like GMS core devirtualize over 3.4% of the time."
23:01:49Matthias247Seems like a minor win
23:05:10*Jehan_ quit (Quit: Leaving)
23:05:37shodan45dom96: that page could probably use a separated-out .css file..... most of the source is actually css o_O
23:06:40dom96shodan45: But then you need to make sure you keep two files around when you want to share documentation.
23:06:52shodan45hm, true
23:07:08shodan45noooooo...... aporia just crashed on me
23:08:22*mwbrown quit (Ping timeout: 240 seconds)
23:09:21shodan45dom96: (aporia:6273): GLib-CRITICAL **: Source ID 6368 was not found when attempting to remove it
23:09:30shodan45if that helps
23:09:49dom96what were you doing when that happened?
23:11:21shodan45dom96: just typing a for loop... after typing the 2nd "." in "for x in 0..", I got a weird message about not finding the nim compiler
23:11:31shodan45I just hit escape or something
23:11:36shodan45the poof
23:11:38shodan45then*
23:11:54dom96have you got suggest enabled?
23:12:32shodan45dom96: looks like it
23:12:48dom96disabling it should help
23:14:29shodan45ok
23:14:43shodan45I'll also be saving my work frequently ;)
23:16:35*Mat4-be_coding is now known as Mat4
23:16:48Mat4ciao
23:17:10*Mat4 quit (Quit: Verlassend)
23:18:22*matkuki quit (Quit: ChatZilla 0.9.91.1 [Firefox 35.0.1/20150122214805])
23:18:37*superfunc quit (Ping timeout: 245 seconds)
23:26:28*sillesta quit (Ping timeout: 264 seconds)
23:28:55*sampwing quit (Ping timeout: 252 seconds)
23:35:25*BlaXpirit quit (Quit: Quit Konversation)
23:36:58*gsingh93 joined #nim
23:39:06*Varriount|Mobile quit (Read error: Connection reset by peer)
23:39:11*Var|Mobile joined #nim
23:39:49*semperos quit (Ping timeout: 245 seconds)
23:43:35*Var|Mobile quit (Ping timeout: 252 seconds)
23:53:29*sampwing joined #nim
23:56:57*JinShil joined #nim