00:03:12 | cazov | ahh, yeah, they were introduced in vista and they do look to be C++. pretty unfortunate but not very surprising |
00:03:53 | cazov | MS doesn't really seem to care much about people who develop for windows and don't use VS |
00:04:07 | Varriount | cazov: Although, that's the only occurence of a C++ api set that I've seen |
00:04:33 | Varriount | I can only hope that someone realized the folly of creating a C++ API for an operating system |
00:04:34 | * | HakanD___ quit (Quit: Be back later ...) |
00:05:30 | cazov | yeah, i dunno. hopefully |
00:08:49 | cazov | it looks like they have some other stuff that's c++ -or- CLR, like the iTV api and GDI+ |
00:09:09 | Varriount | Ugh |
00:13:51 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
00:27:00 | * | bcinman joined #nim |
00:31:49 | * | pregressive joined #nim |
00:37:47 | * | saml_ joined #nim |
00:39:41 | * | brson joined #nim |
00:43:47 | * | Varriount quit (Ping timeout: 276 seconds) |
00:44:04 | * | Varriount joined #nim |
00:55:45 | * | lepot joined #nim |
00:57:20 | lepot | can someone please give me a hint as to why I can't assign to self.drinks in this example? https://dpaste.de/wJPO/raw |
01:02:55 | lepot | anyone used nim before? |
01:04:46 | flaviu | lepot: Parameters are immutable. |
01:05:24 | lepot | flaviu: thanks for replying. so I can't have something like an instance variable? |
01:05:45 | flaviu | In lots of languages, every type is a pointer, but in Nim you have to explicitly make it a pointer. |
01:06:01 | flaviu | lepot: Sure. `type Person = ref object`. |
01:06:32 | lepot | flaviu: oh! awesome! thanks! |
01:06:46 | lepot | flaviu: I'll go back and give the docs a closer read |
01:10:28 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
01:15:56 | * | lepot left #nim (#nim) |
01:20:16 | * | MightyJoe quit (Ping timeout: 240 seconds) |
01:24:25 | * | MightyJoe joined #nim |
01:24:27 | * | vendethiel joined #nim |
01:32:56 | * | TEttinger quit (Ping timeout: 240 seconds) |
01:33:40 | * | bcinman joined #nim |
01:36:47 | * | MightyJoe quit (Ping timeout: 250 seconds) |
01:37:15 | * | HakanD___ joined #nim |
01:40:15 | * | MightyJoe joined #nim |
01:42:00 | * | HakanD___ quit (Ping timeout: 256 seconds) |
02:00:30 | * | brson quit (Ping timeout: 252 seconds) |
02:02:53 | * | brson joined #nim |
02:14:46 | * | brson quit (Quit: leaving) |
02:35:11 | * | BitPuffin quit (Ping timeout: 252 seconds) |
02:36:24 | * | darkf joined #nim |
02:42:04 | * | pregressive quit () |
03:11:56 | * | onionhammer joined #nim |
03:26:10 | * | HakanD___ joined #nim |
03:30:51 | * | saml_ quit (Remote host closed the connection) |
03:31:01 | * | HakanD___ quit (Ping timeout: 264 seconds) |
03:36:20 | * | gsingh93 joined #nim |
03:58:41 | * | endragor joined #nim |
04:08:04 | * | vendethiel quit (Ping timeout: 272 seconds) |
04:08:38 | * | Senketsu quit (Quit: Leaving) |
04:09:33 | * | vendethiel joined #nim |
04:14:30 | * | Senketsu joined #nim |
04:30:31 | Joe-T | is there a built in iterator for |
04:30:36 | Joe-T | strings to chars? |
04:32:53 | * | ChrisMAN quit (Ping timeout: 248 seconds) |
04:36:02 | fowl | Joe-T, items |
04:37:07 | Joe-T | ah thanks, that worked |
04:37:26 | Joe-T | I assumed it didn't as I tried to echo it and syntastic complained |
04:38:26 | MagusOTB | how do I make a generic that takes an array? |
04:40:45 | MagusOTB | I have this http://pastebin.com/vnYSJqNh and I don't know how to make a generic proc that the last line will call. |
04:41:58 | * | HakanD___ joined #nim |
04:46:14 | * | HakanD___ quit (Ping timeout: 252 seconds) |
04:55:59 | * | vendethiel quit (Ping timeout: 276 seconds) |
04:57:52 | fowl | MagusOTB, proc test[T: not openarray](val: T) |
04:59:05 | MagusOTB | oh cool, thanks |
04:59:22 | MagusOTB | is there docs on other thing syou can do to constrain types in generics? |
05:02:08 | fowl | http://nim-lang.org/manual.html#type-classes |
05:38:46 | * | gsingh93 quit (Ping timeout: 244 seconds) |
05:39:27 | * | wink-s quit (Quit: Page closed) |
05:42:46 | * | HakanD___ joined #nim |
05:46:56 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
05:47:04 | * | HakanD___ quit (Ping timeout: 250 seconds) |
06:25:31 | * | bcinman joined #nim |
06:31:07 | * | awesomo4000 joined #nim |
06:35:26 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
06:38:13 | * | bcinman joined #nim |
06:38:42 | awesomo4000 | anyone know how to compile nim itself against musl-libc |
06:49:27 | fowl | awesomo4000, i guess you would do it similar to this http://www.schipplock.software/2015/02/static-linking-with-nim.html |
06:49:46 | fowl | try passing those options to koch |
06:49:58 | * | endragor quit (Ping timeout: 245 seconds) |
06:50:35 | * | adam12 quit (Ping timeout: 244 seconds) |
06:51:53 | * | adam| joined #nim |
06:55:04 | * | endragor joined #nim |
06:55:55 | * | Kingsquee quit (Quit: Konversation terminated!) |
07:02:39 | * | Ven joined #nim |
07:03:23 | * | vendethiel joined #nim |
07:05:30 | * | endragor_ joined #nim |
07:05:41 | * | HakanD___ joined #nim |
07:07:49 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
07:08:37 | * | endragor quit (Ping timeout: 248 seconds) |
07:14:37 | * | Ven joined #nim |
07:18:52 | * | HakanD___ is now known as HakanD |
07:21:46 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
07:24:31 | * | endragor_ quit (Remote host closed the connection) |
07:26:16 | * | vendethiel quit (Ping timeout: 240 seconds) |
07:26:56 | * | Trustable joined #nim |
07:29:18 | * | bjz joined #nim |
07:39:58 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
07:40:32 | * | BlaXpirit joined #nim |
07:46:06 | * | Ven joined #nim |
07:48:34 | * | HakanD_ joined #nim |
07:51:37 | * | HakanD quit (Ping timeout: 256 seconds) |
08:07:52 | * | coffeepot joined #nim |
08:08:37 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
08:09:36 | * | awesomo4000 left #nim (#nim) |
08:15:13 | * | Arrrrrrr joined #nim |
08:15:21 | Arrrrrrr | Hello Nimrod. |
08:15:45 | coffeepot | Good morning :) |
08:16:08 | Arrrrrrr | How is your game going on coffeepot ? |
08:16:50 | coffeepot | right now, slowly - haven't had time to do anything on it for the past few days |
08:17:02 | coffeepot | working on physics atm tho |
08:17:35 | Arrrrrrr | I made this http://i.imgur.com/h2V0o7c.gif |
08:17:43 | coffeepot | how's your stuff going? What are your thoughts of nim so far? |
08:18:17 | coffeepot | awesome :) |
08:19:17 | Arrrrrrr | Good, i get a lot of help here. For now i'm just trying to settle down everything that i learned. But there's so much. |
08:21:43 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:22:27 | Arrrrrrr | Btw, is 'generic' and 'constraint' the 'interface' of nim? |
08:25:01 | coffeepot | yeah I'm still really just getting my feet wet in nim - still a lot to learn for me, especially macros and things |
08:25:27 | coffeepot | as for your question, I don't know. Hoepefully someone else with more knowledge can answer |
08:25:48 | HakanD_ | Arrrrrrr: No, no, hell no |
08:25:52 | HakanD_ | Don't go that way (: |
08:26:39 | Arrrrrrr | Hah, so? |
08:26:43 | HakanD_ | They look like interfaces, but sadly they don't work that way, they are a different thing all together, at least in it's curren state |
08:26:57 | Arrrrrrr | will they evolve then? |
08:27:07 | HakanD_ | No idea. |
08:27:32 | HakanD_ | Maybe, if enough people bugs Araq :P |
08:27:45 | coffeepot | what's the intended purpose of constraints? |
08:27:55 | coffeepot | to constrain generics? |
08:28:11 | coffeepot | for params, etc? |
08:28:22 | HakanD_ | constraints for generics |
08:28:35 | coffeepot | ah |
08:28:43 | * | bjz joined #nim |
08:29:23 | HakanD_ | They are awesome, and opens of lots of interesting options. I really wish they also worked like Go's interfaces tho. |
08:30:22 | coffeepot | i'm sure someone is working on adapting constraints to be interfaces, I think there was a discussion about it the other day |
08:30:37 | HakanD_ | some topics if you are interested: http://forum.nim-lang.org/t/673 http://forum.nim-lang.org/t/282 http://forum.nim-lang.org/t/754/1 http://forum.nim-lang.org/t/278/1 |
08:31:37 | * | Ven joined #nim |
08:31:51 | HakanD_ | there is something fowlmouth posted here: https://gist.github.com/fowlmouth/ac51baef7956af1ebdf8 |
08:32:20 | Arrrrrrr | Thanks HakanD_ |
08:32:26 | coffeepot | hakenD_ that's what I was thinking of :) |
08:36:15 | * | bjz quit (Ping timeout: 250 seconds) |
08:37:27 | coffeepot | what Araq mentions in one of your links is pretty interesting - using closures. I guess that'd be much more adaptable than interfaces |
08:38:58 | * | milosn quit (Ping timeout: 255 seconds) |
08:41:22 | HakanD_ | As lots of people are looking for interfaces in Nim, I'm sure some proper way to do them will emerge, either baked in to the language or in userland |
08:41:52 | HakanD_ | bbl |
08:41:54 | * | HakanD_ quit (Quit: Be back later ...) |
08:42:11 | coffeepot | yeah I was looking at the closures equivalent and thinking that someone will macro-ise this sooner or later |
08:42:42 | coffeepot | one of the reasons why I chose nim out of the newer languages was because it's so extensible |
08:42:55 | coffeepot | some degree of future proofing |
08:44:11 | coffeepot | tbh tho nim kinda ruins me for other languages for simple things like templating. Kind of like super-inlining really, saves bugs, increases run time speed and reduces reading complexity |
08:45:42 | coffeepot | as an aside from game programming I'm looking at a native sql library |
08:46:45 | coffeepot | since I do a lot of sql server at work. Actually that reminds me, must look at nim's rtti capabilities to see how easy it'd be to create a simple ORM framework |
08:49:15 | reactormonk | coffeepot, what would you like the API to look like? |
08:49:32 | coffeepot | well you know, that's what i was wondering |
08:50:25 | coffeepot | i wonder if it'd be possible to attach some kind of trait to an object's fieldname that represents the fieldname in the db and uses that access things |
08:50:36 | coffeepot | it depends how flexible and fast the rtti is |
08:50:41 | reactormonk | rtti? |
08:50:47 | coffeepot | run time type information |
08:50:52 | reactormonk | none. |
08:50:53 | coffeepot | reflection |
08:51:15 | reactormonk | nim doesn't have a VM, so you can't do reflection. |
08:52:10 | coffeepot | ideally i'd like to be able to define an object and tag each field with it's db fieldname, perhaps tag the object as a table, and be able to query the db by making a seq of clauses |
08:52:24 | coffeepot | not even static reflection? |
08:52:31 | reactormonk | that's macro. |
08:52:49 | coffeepot | i thought it might involve some macro wizardry :) |
08:53:41 | coffeepot | queryseq.addclause(myobject.id, clauseEquals, 17) or something |
08:54:21 | coffeepot | and queryseq.addclause(myobject.description, clauseLike, "%test%") |
08:54:31 | reactormonk | I'd prefer something like select[Foo].where(bar == 2)) |
08:54:45 | coffeepot | yeah that's nice |
08:55:32 | coffeepot | how would you do multiple clauses though? |
08:55:38 | coffeepot | in that syntax |
08:55:50 | BlaXpirit | chain more onto it |
08:55:58 | reactormonk | select[Foo].where(bar == 2).group_by("baz") |
08:55:59 | coffeepot | fair enough :) |
08:57:19 | reactormonk | just make sure to handle TaintedString correctly |
08:57:23 | coffeepot | how would you pass "bar == 2" as a parameter and have it be equate to the field bar - pass as an expression? |
08:57:45 | reactormonk | pretty much |
08:58:00 | coffeepot | yeah I remember seeing this http://nim-lang.org/manual.html#avoiding-sql-injection-attacks |
08:58:00 | emilsp | aren't there predicates in nim ? |
08:58:11 | reactormonk | emilsp, what's a predicate? |
08:58:17 | * | endragor joined #nim |
08:58:21 | * | endragor quit (Remote host closed the connection) |
08:59:06 | * | endragor joined #nim |
09:00:36 | Arrrrrrr | (x: T) -> bool |
09:00:38 | Arrrrrrr | i believe |
09:01:22 | coffeepot | I guess with expression parameters you don't need reflection, and there's no speed penalty. However not sure if that would work if you wanted to dynamically query at runtime, would it? As in, if a user gets to select the field and data to search on |
09:02:47 | * | bjz joined #nim |
09:04:02 | reactormonk | you can't go for dynamic queries anyway on an ORM |
09:04:07 | * | Demon_Fox quit (Quit: Leaving) |
09:04:15 | coffeepot | why not? |
09:04:38 | reactormonk | depends on your ORM I guess. but when the select return type is typed, you're kinda set |
09:05:39 | coffeepot | i wrote a simple orm that does dynamic user queries in delphi for an app at work, I'm sure nim can do it better |
09:05:54 | BlaXpirit | .eval macro test(e: varargs[expr]): expr = e; discard test(a) |
09:05:55 | reactormonk | yup, but you probably can't type them in an ORM way |
09:05:56 | Mimbus | BlaXpirit: eval.nim(4, 13) Error: undeclared identifier: 'a' |
09:05:59 | BlaXpirit | why? |
09:07:15 | BlaXpirit | well that's actually a bad example |
09:07:48 | BlaXpirit | .eval import macros; macro test(e: expr): expr = bindSym"true"; echo test(a) |
09:07:50 | Mimbus | BlaXpirit: true |
09:07:55 | BlaXpirit | .eval import macros; macro test(e: varargs[expr]): expr = bindSym"true"; echo test(a) |
09:07:56 | Mimbus | BlaXpirit: eval.nim(5, 10) Error: undeclared identifier: 'a' |
09:09:19 | * | akiradeveloper joined #nim |
09:11:11 | coffeepot | In delphi I just parsed the object fields at start up (using traits on the fields to associate the object fields with the DB fieldnames) and allowed users to select from this list, then I just construct the sql myself |
09:17:51 | * | HakanD_ joined #nim |
09:22:36 | * | vendethiel joined #nim |
09:26:29 | Arrrrrrr | I read the links about type classes and i have a light idea of what they are, but still can't see what do people when they want interfaces. Real scenarios. I'm so used to them i cannot think without them |
09:27:27 | reactormonk | Arrrrrrr, a typeclass is basically a definition of an interface, except you don't attach the implementation to the object. |
09:28:45 | HakanD_ | Arrrrrrr: tuple of closures work, but they require a slightly different type of thinking |
09:29:37 | HakanD_ | https://gist.github.com/fowlmouth/ac51baef7956af1ebdf8 this might give some ideas |
09:31:29 | HakanD_ | it took me a few days to grok nim way of thinking regarding to interfaces. |
09:32:00 | HakanD_ | still not sure if i really understood totally tho. still hacking on stuff. |
09:32:06 | Arrrrrrr | But does it reduce the number of lines one needs to produce interfaces? |
09:32:22 | Arrrrrrr | or it is more like "better than nothing" |
09:32:41 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:33:05 | HakanD_ | not an expert, but it looks to me is the way forward regarding interfaces |
09:33:14 | HakanD_ | I still haven't dived into macros and stuff |
09:33:44 | Arrrrrrr | I haven't seen anythig about concepts |
09:34:40 | reactormonk | I think we need some more concepts in the stdlib |
09:35:20 | BlaXpirit | yes |
09:35:34 | BlaXpirit | down with openarray |
09:35:40 | coffeepot | haha |
09:35:40 | HakanD_ | btw, 'MyConcept: generic x' is now 'MyConcept: concept x' |
09:36:43 | Arrrrrrr | Ah, ok ok |
09:36:48 | Arrrrrrr | Now i see it |
09:36:55 | fowl | the idea is that we can get an interface type from a concept that defines functions like draw(obj); shouldDelete(obj) is bool; ... |
09:37:33 | Arrrrrrr | So, does your example work out of the box with 0.10.3 ? |
09:38:08 | BlaXpirit | fowl, why is such a type needed? |
09:38:24 | fowl | Arrrrrrr, it does |
09:40:11 | fowl | BlaXpirit, i dunno, kind of cool to show that it can be implemented without a compiler extension, working at compile time and run time to provide polymorphism |
09:40:37 | coffeepot | do concepts have any overhead? |
09:40:47 | * | milosn joined #nim |
09:41:45 | BlaXpirit | i bet they do have a considerable compile time overhead |
09:42:08 | fowl | coffeepot, if you have a large generic library and it gets instantiated a couple times your exe would be bigger |
09:42:31 | coffeepot | compile time or file size i'm not bothered about, just wondering if i could refactor my gaming stuff to use them |
09:43:21 | fowl | they would come in handy in places where you would use multiple inheritance in c++ |
09:43:24 | * | milosn quit (Read error: Connection reset by peer) |
09:44:04 | fowl | in fact you can use generics in place of multiple inheritance in cpp wrappers |
09:44:11 | coffeepot | the example you give fowl is actually the one i was thinking of: drawable (also has physics etc) |
09:44:17 | * | vendethiel quit (Ping timeout: 250 seconds) |
09:45:50 | * | milosn joined #nim |
09:47:07 | Arrrrrrr | I can only pray for a simpler way to introduce interfaces in the future. |
09:47:41 | BlaXpirit | this is the simplest way |
09:48:03 | HakanD_ | fowl: the geninterface macro still doesn't work on its own tho |
09:48:05 | Arrrrrrr | I will pray harder |
09:48:12 | HakanD_ | (: |
09:48:51 | fowl | HakanD_, i know, when i print out the code and paste into the file it works, need to examine the ast |
09:54:36 | * | akiradeveloper quit (Read error: Connection reset by peer) |
10:01:59 | * | irrequietus joined #nim |
10:02:47 | BlaXpirit | I have tried to implement this bottom example here https://github.com/flaviut/nre/issues/11#issuecomment-92144985 but have run into a problem that you can't pass unexisting identifiers to varargs macro, although without varargs/commas it works. |
10:02:55 | BlaXpirit | .eval import macros; macro test(e: varargs[expr]): expr = bindSym"true"; echo test(a) |
10:02:56 | Mimbus | BlaXpirit: eval.nim(5, 10) Error: undeclared identifier: 'a' |
10:03:05 | BlaXpirit | fowl, maybe you know something about this? |
10:03:06 | * | milosn quit (Write error: Connection reset by peer) |
10:07:20 | * | milosn joined #nim |
10:08:06 | fowl | BlaXpirit, i think its a bug because expr is supposed to be untyped |
10:08:29 | fowl | so it doesnt need to be semantic'd |
10:08:51 | BlaXpirit | how would you name such a bug? |
10:09:11 | fowl | you can just make the macro immediate |
10:09:29 | BlaXpirit | no, actually i can't |
10:09:52 | fowl | i dunno |
10:09:54 | BlaXpirit | actually is macro `{}`*(pattern: Regex, options: varargs[expr]): expr = |
10:09:57 | fowl | naming is half the battle |
10:17:22 | * | milosn quit (Read error: Connection reset by peer) |
10:17:41 | * | milosn joined #nim |
10:21:54 | * | milosn quit (Ping timeout: 244 seconds) |
10:30:01 | * | milosn joined #nim |
10:32:15 | * | BitPuffin joined #nim |
10:40:29 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:48:23 | * | Ven joined #nim |
10:49:19 | * | Ven quit (Client Quit) |
10:51:19 | * | milosn quit (Read error: Connection reset by peer) |
10:51:42 | * | milosn joined #nim |
10:56:08 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
10:57:17 | * | coffeepot joined #nim |
10:58:29 | * | milosn quit (Read error: Connection reset by peer) |
10:58:55 | Arrrrrrr | Right now, are contributors working into introducing a 'major' feature? or just bugs fixing? |
10:59:01 | * | milosn joined #nim |
10:59:36 | BlaXpirit | right now is the worst time for major features |
11:04:33 | Arrrrrrr | And is something planned for the future? |
11:04:46 | Arrrrrrr | *anything |
11:05:27 | * | milosn quit (Read error: Connection reset by peer) |
11:05:59 | dtscode | BlaXpirit, why is that? |
11:06:26 | BlaXpirit | next release is sorely needed |
11:06:31 | * | bogen joined #nim |
11:06:45 | * | milosn joined #nim |
11:06:55 | BlaXpirit | a low percentage of my code compiles in 0.10.2 |
11:08:27 | * | untitaker quit (Ping timeout: 276 seconds) |
11:13:08 | BlaXpirit | btw maybe 0.11.0 is warranted |
11:14:15 | * | untitaker joined #nim |
11:18:49 | * | milosn quit (Read error: Connection reset by peer) |
11:20:44 | coffeepot | yeah current version on website is well old now, in nim terms |
11:21:23 | HakanD_ | well, new release also means updating the docs |
11:22:21 | * | nulpunkt left #nim (#nim) |
11:35:26 | * | Ven joined #nim |
11:36:50 | * | saml_ joined #nim |
11:43:25 | * | milosn joined #nim |
11:52:32 | Arrrrrrr | "in nim terms" haha |
11:54:17 | * | milosn quit (Read error: Connection reset by peer) |
11:55:22 | * | milosn joined #nim |
12:02:37 | * | milosn quit (Read error: Connection reset by peer) |
12:03:01 | * | milosn joined #nim |
12:03:58 | Arrrrrrr | It is possible to breakthrough in case statements? |
12:04:18 | BlaXpirit | Arrrrrrr, i remember something like that |
12:04:45 | BlaXpirit | might have been from a different language :p |
12:05:00 | Arrrrrrr | Hah, no wonder |
12:05:02 | def- | go has an explicit fallthrough |
12:05:30 | BlaXpirit | wow, nim doesn't |
12:05:30 | def- | in nim you can list multiple cases, but i don't think we have a fallthrough |
12:05:39 | def- | case 2, 5, 10..20: |
12:05:45 | Arrrrrrr | I see. |
12:05:59 | Arrrrrrr | That is quite usefull, but not the same. |
12:06:39 | * | milosn quit (Read error: Connection reset by peer) |
12:08:02 | * | milosn joined #nim |
12:08:09 | coffeepot | had too look up what case fallthrough was :D why would you even want this? |
12:08:18 | coffeepot | or rather why would people want this |
12:08:46 | * | BitPuffin quit (Ping timeout: 272 seconds) |
12:09:47 | coffeepot | aside from the duff engine thing that more or less sounds like a hack |
12:09:51 | BlaXpirit | http://programmers.stackexchange.com/questions/116221/appropriate-uses-of-fall-through-switch-statements |
12:10:01 | dom96 | duff's device mainly benefits from it |
12:10:27 | coffeepot | thanks BlaXpirit that explains it quite well :) |
12:11:14 | Arrrrrrr | could be done with an "and": http://pastebin.com/VEiuTg7C |
12:11:30 | BlaXpirit | naaaaah |
12:11:33 | coffeepot | ok so i only read about duffs device today but sounds like it wouldn't provide much performance with modern hardware |
12:11:38 | BlaXpirit | case 2..10 {.fallthrough.} |
12:11:47 | BlaXpirit | much more in the spirit of the language |
12:12:14 | Arrrrrrr | but that's longer. |
12:12:23 | dom96 | yeah, it's a pity that most languages optimise their syntax for the edge case here. |
12:12:25 | Arrrrrrr | and "and" is there. |
12:12:27 | BlaXpirit | well it should be as long as reasonably possible |
12:12:34 | BlaXpirit | Arrrrrrr, you don't get it :| |
12:12:59 | Arrrrrrr | sorry |
12:13:17 | BlaXpirit | {.intentionalFallthough.} is pretty good too |
12:13:30 | BlaXpirit | well ok it's not |
12:14:13 | Arrrrrrr | c# has goto if i recall well |
12:14:29 | BlaXpirit | that can't be right |
12:14:43 | * | milosn quit (Read error: Connection reset by peer) |
12:14:46 | BlaXpirit | oh it does :| |
12:15:17 | Arrrrrrr | Hah, "goto case x" |
12:15:18 | * | milosn joined #nim |
12:15:40 | BlaXpirit | is actually pretty good |
12:15:58 | coffeepot | i'm now in two minds about duffs device - on the one hand it is really slick, on the other hand it makes me recoil in buggy terror |
12:16:20 | BlaXpirit | geez, i'll have to google this |
12:16:55 | * | saml_ quit (Quit: Leaving) |
12:26:20 | * | milosn quit (Read error: Connection reset by peer) |
12:26:43 | * | milosn joined #nim |
12:33:20 | Arrrrrrr | BlaXpirit: in which languages have you programmed before? |
12:35:25 | * | vendethiel joined #nim |
12:38:13 | * | milosn quit (Read error: Connection reset by peer) |
12:40:44 | * | Arrrrrrr quit (Quit: Page closed) |
12:45:13 | coffeepot | is nim's approach to GC unique in the programming world? Seems most languages that use GC use the boehm type. Also: is nims GC kind of like what swift calls ARC? |
12:49:33 | * | milosn joined #nim |
12:52:55 | emilsp | isn't sphinxs GC more like C++ shard_ptr approach? |
12:53:19 | emilsp | tfu, not sphinx's but nim's |
12:53:56 | coffeepot | i didn't think it was, as the gc runs thread local and you need to put extra work in to share GC'd objects across threads. |
12:54:37 | coffeepot | as i understand it shared_ptr has more overhead as it has to be shared between threads? |
12:54:49 | emilsp | yes |
12:55:11 | * | milosn quit (Read error: Connection reset by peer) |
12:55:19 | coffeepot | the reason i ask is because i was reading this http://sebastiansylvan.com/2015/04/13/why-most-high-level-languages-are-slow/ |
12:55:36 | coffeepot | and thought that his comments might not apply to nim's GC |
12:55:54 | * | milosn joined #nim |
12:57:03 | coffeepot | i assume he hasn't heard of nim since he comments "I’m relatively convinced that you could write a GC more suitable for high performance and low latency applications (e.g. an incremental GC where you spend a fixed amount of time per frame doing collection)" which AIUI is what you can do with nim's GC |
12:58:02 | coffeepot | anyway, it's a common comment for some people "GC = slow" without considering that there's different types of GC - though I'm sure the writer knows more about this than I do |
12:59:37 | * | vendethiel quit (Ping timeout: 248 seconds) |
13:01:33 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:04:02 | * | vendethiel joined #nim |
13:07:42 | emilsp | to be honest, nims memory model doesn't make allocating stuff cheap either, does it ? |
13:08:26 | Varriount | emilsp: Not as cheap as, say, Java's allocator |
13:08:29 | coffeepot | emilsp, i'd be interested to know this |
13:09:08 | Varriount | Java (and other languages) can move objects around in memory |
13:09:20 | Varriount | Which enables them to use a slab allocator |
13:09:52 | Varriount | The cost comes in the form of GC and runtime complexity. |
13:10:16 | emilsp | yes, indeed. How would one deal with the cost of allocations in nim ? Construct used stuff as far top as possible ? |
13:11:31 | Varriount | emilsp: Huh? What do you mean? |
13:12:18 | emilsp | Well, do stupid stuff such as use a massive object to hold intermediate strings in ? |
13:12:43 | Varriount | emilsp: Well, try to reuse memory. |
13:13:10 | emilsp | yes |
13:13:26 | Varriount | emilsp: You'll have to ask Araq about the particulars of memory allocation. |
13:13:44 | emilsp | I wish I had more time on my hands to do something awesome in nim |
13:14:24 | Varriount | I know very little concrete information. I know that it uses memory maps, it's primarily refcount based, and it hasn't been much of a problem |
13:16:27 | Varriount | emilsp: Also, though Java might have faster allocation times, it's still very memory hungry. |
13:17:19 | emilsp | Varriount, java is memory hungry and slow until you warm it up. But don't worry, I'd never use Java if I don't have to |
13:17:48 | * | Varriount looks at the 1.5 GB of ram taken up by IntelliJ Idea |
13:18:34 | * | milosn quit (Ping timeout: 245 seconds) |
13:18:47 | emilsp | >not using vim |
13:18:55 | Varriount | emilsp: And (although this a completely uninformed guess) I'd wager that the cost of allocations isn't too much higher than that of standard malloc in C/C++ |
13:19:52 | * | Ven joined #nim |
13:20:16 | emilsp | Varriount, I'd guess there should be no oberhead when compared to c/c++ |
13:24:40 | * | vendethiel quit (Ping timeout: 256 seconds) |
13:33:50 | * | vendethiel joined #nim |
13:33:59 | coffeepot | i've been very impressed by the speed of nim without having to do anything particularly optimise-y |
13:35:14 | coffeepot | to be honest I'm always amazed by how fast java is for an 'interpreted' language |
13:35:51 | repax | Java is commonly jitted |
13:36:01 | coffeepot | but you know, there's the joke about "enterprise fizzbuzz" that seems to apply to most java |
13:36:38 | coffeepot | i find it impressive how effective on the fly jitting is |
13:37:37 | * | milosn joined #nim |
13:38:03 | repax | I don't dare guess how many hundreds of man-years have gone into the development of Java |
13:38:23 | coffeepot | yeah it's a pretty huge language |
13:39:15 | repax | I think nim has found a sweet niche, though |
13:39:19 | coffeepot | definitely |
13:39:34 | * | BitPuffin joined #nim |
13:40:27 | coffeepot | i was looking for ages for a new language and before nim it was "fast, powerful, sane - choose two" |
13:40:40 | HakanD_ | ^ |
13:40:52 | coffeepot | i think nim *finally* provides all three |
13:41:01 | repax | Indeed |
13:41:29 | repax | Also, productive |
13:41:33 | coffeepot | yeah |
13:41:54 | coffeepot | i've heard it said many times with regard to nim and I agree: "nim makes me love programming again" |
13:42:14 | repax | :) |
13:43:01 | a5i | Crystal and Nim are the only 2 languages that provide those traits as of now |
13:43:37 | * | ChrisMAN joined #nim |
13:43:48 | coffeepot | i remember the first time I tried to write something with python at work and it was fairly productive, then I realised in order to distribute it to collegues they would have to carry around a python interpretter o_O Eventually got it compiles into one file but it was just so disappointing |
13:44:10 | coffeepot | crystal is definitely on my radar but it's a bit of a case of nim got there first and is further along |
13:44:41 | a5i | Yeah |
13:44:43 | repax | Haven't had the time yet to look at crystal |
13:45:12 | repax | Anything in particular it does better than nim? |
13:45:14 | coffeepot | also I really like Araq's focus on efficiency and elegance |
13:46:06 | coffeepot | crystal: "Ruby-inspired syntax" that's actually a turn off fo rme |
13:46:08 | coffeepot | for me |
13:46:50 | a5i | Nim and Crystal are roughly the same, one compiles to C and the other to LLVM |
13:47:54 | a5i | They both have amazing native speed, syntactic sugar and low-level functionalites |
13:48:00 | a5i | like C bindings |
13:48:04 | repax | I used to like C++ for its goal of zero-cost abstractions. In the end any large piece of software is a heap of abstractions. Writing in c++ is not productive though |
13:48:43 | repax | Nim might someday go straight to llvm |
13:49:36 | a5i | I'm myself love Ruby syntax, the better thing is that they fix some of Ruby's issues |
13:49:53 | coffeepot | repax: totally agree. in C++ I feel drunk with power at the freedom, but then fall down drunk with freedom |
13:49:54 | repax | I don't see that as important right now though because the C and C++ back ends are both powerful and portable |
13:50:45 | coffeepot | my time with nim has left me wondering why do we need all these pointless symbols everywhere in most languages |
13:52:33 | * | detox joined #nim |
13:53:46 | a5i | detox is an irc bot written in crystal, it has an eval function I would use to compare behaviors between Mimbus and detox |
13:54:06 | a5i | !eval p "test" |
13:54:07 | detox | "test" |
13:54:32 | a5i | .eval "tesT" |
13:54:34 | Mimbus | a5i: eval.nim(3, 0) Error: value of type 'string' has to be discarded |
13:54:41 | a5i | .eval echo "tesT" |
13:54:42 | Mimbus | a5i: tesT |
13:55:09 | BlaXpirit | a5i pls |
13:55:28 | BlaXpirit | not cool |
13:55:31 | a5i | D: |
13:56:01 | BlaXpirit | even Mimbus is not really welcome here, and this... |
13:56:05 | emilsp | repax, but crystal isn't even typed |
13:56:30 | repax | I like typed languages though |
13:56:45 | a5i | emilsp: What do you mean it isnt typed ? |
13:57:07 | emilsp | >Never have to specify the type of a variable or method argument. |
13:57:20 | emilsp | this is why I am starting to get sick of python |
13:57:34 | a5i | You don't have to, but you can |
13:57:36 | coffeepot | i was trying to find more info on crystals type system myself... |
13:57:54 | coffeepot | i have developed a real aversion to dynamic typing |
13:58:12 | coffeepot | thanks to python |
13:58:24 | a5i | !eval x = 35.to_i64; p x.is_a?(Int64) |
13:58:25 | detox | true |
13:58:33 | a5i | Types ^ |
13:58:37 | repax | It's too easy to mess things up with dyn typing |
13:59:01 | a5i | It's type inferencing, you can declare it if you want to |
13:59:42 | * | bcinman joined #nim |
14:00:09 | coffeepot | yeah i remember the first time i started db access in python and was like "wait wtf is this returning, how does any of this work?" and the answer seems to be "you just hope the caller sends you the right bindings" |
14:00:10 | repax | But worse than that are languages with automatic var declarations, i.e. no declarations |
14:00:31 | * | clynamen_ joined #nim |
14:00:43 | coffeepot | repax: like old BASIC? :D |
14:00:49 | a5i | !eval p StringIO{1,2,3} |
14:00:50 | detox | #<StringIO:0xCACFC0 @buffer=Pointer(UInt8)@CADFA0, @bytesize=3, @capacity=64, @pos=0> |
14:01:05 | repax | Yeah, or just php |
14:01:05 | * | bcinman quit (Client Quit) |
14:01:17 | BlaXpirit | a5i, seriously, please stop |
14:01:37 | coffeepot | thankfully never done any php. Was going to learn a few years back. Feel like I've saved myself some sanity! |
14:01:42 | BlaXpirit | (i'm not any kind of authority here, but whatever) |
14:01:53 | * | Jehan_ joined #nim |
14:01:57 | * | bcinman joined #nim |
14:02:11 | coffeepot | what is this !eval business anyway? |
14:02:18 | coffeepot | what's it calling? |
14:02:37 | repax | Anything determined at runtime is a liability, imho |
14:02:38 | * | clynamen quit (Ping timeout: 246 seconds) |
14:03:45 | coffeepot | repax: totally agree - was astounded when i learnt how python objects are basically just collections of things set up at runtime. Then came the __init__ and I was checked out |
14:04:39 | repax | coffeepot: yeah dreadful |
14:05:21 | repax | But I like its syntax, and nim'so |
14:05:32 | coffeepot | yeah same, the syntax is great up to a point |
14:05:33 | repax | nim's |
14:05:43 | coffeepot | nim does it cleaner in my opinion |
14:06:53 | repax | Ok. I'm just glad to not seeing all the brackets and semi-colons :) |
14:07:20 | coffeepot | yeah |
14:08:19 | a5i | The eval is evaluating another file and read the output in yet another file |
14:08:40 | a5i | since there is kno eval() in compiled languages |
14:08:46 | a5i | no* |
14:08:51 | repax | At some point a almost wanted to write a c++ preprocessor just to insert those for me ;) |
14:10:03 | Jehan_ | a5i: Huh? |
14:10:17 | repax | a5i: haven't really ever needed one |
14:10:51 | a5i | Write given Crystal code to file -> run file and save output to file -> read from file and return |
14:10:57 | repax | One can accomplish a lot with compile-time eval |
14:11:01 | Jehan_ | Nevermind that being compiled or not is not a property of the language, but there are languages with compilers and eval capability. |
14:11:20 | a5i | oh well Crystal doesn't have one, so that's the process |
14:11:32 | a5i | I mean run-time eval |
14:11:38 | Jehan_ | Not to mention that the difference between interpreters and compilers can get pretty blurry these days. |
14:11:43 | Jehan_ | a5i: So did I. |
14:11:46 | a5i | true |
14:11:58 | a5i | oh well, I take that back |
14:13:27 | * | Arrrrrr joined #nim |
14:13:50 | a5i | how does mimbus eval code form the bot ? |
14:14:01 | repax | Ahoy, Arrrrrr! |
14:14:18 | coffeepot | well I don't know if Araq still feels this way but here http://forum.nim-lang.org/t/787 he mentions the tantalizing prospect of having dynamic code changes at runtime |
14:14:27 | Jehan_ | Speaking of crystal, is there any reason why `for` doesn't work and why `if` doesn't take a `then` keyword after the condition? |
14:14:52 | Arrrrrr | Hello repax, hello nimrods |
14:15:00 | coffeepot | hello arrrrr |
14:15:08 | coffeepot | :) |
14:15:09 | a5i | They dumped for loops in favor for times loops and other variants |
14:15:22 | a5i | you can write a macro though for a for loop |
14:15:35 | Jehan_ | a5i: O…kay. |
14:15:50 | a5i | I have a better way od explaining |
14:15:54 | a5i | of* |
14:16:12 | a5i | Jehan_: http://www.reddit.com/r/crystal_programming/comments/31hjtg/crystal_loops/ |
14:16:25 | Jehan_ | It's just weird. One of the attractions of crystal would be to port Ruby code fairly easily, but then this stuff puts obstacles in your way. |
14:16:55 | a5i | We didnt just want to port Ruby, we wanted to make it better |
14:17:03 | a5i | replace "we" with "they" |
14:17:15 | coffeepot | "10.times do |i|" wow that syntax does not parse well for my eyes |
14:17:17 | a5i | I;m just a 16 year old interested in experimental languages |
14:18:04 | * | detox quit (Quit: Crystal) |
14:18:17 | coffeepot | a5i: good to get started early :) |
14:18:18 | Jehan_ | a5i: Fair enough, though one could argue about what is better. :) |
14:18:49 | a5i | Yeah, but then again you could just use that macro that user provided and problem solved |
14:18:58 | a5i | Jehan_: thanks :) |
14:19:04 | emilsp | a5i, how does crystal differentiate itself from Julia ? |
14:19:06 | a5i | coffeepot* |
14:19:22 | a5i | emilsp: I havent looked into Juila, so I cannot say |
14:19:39 | coffeepot | can't you do this in nim btw? for i in 0.countup(10): |
14:19:53 | emilsp | coffeepot, you can |
14:20:11 | emilsp | as far as I remember, at least ;) |
14:20:27 | coffeepot | macros are great but personally I am wary when they're used as an excuse for more work |
14:20:42 | a5i | there was this: http://www.reddit.com/r/programming/comments/31mzu1/go_vs_rust_vs_d_vs_crystal_etc_perlin_noise/ |
14:21:27 | coffeepot | I still don't understand what this is doing in crystal:def foo |
14:21:27 | coffeepot | # -1 becomes the default scope where methods |
14:21:27 | coffeepot | # are looked up in the given block |
14:21:27 | coffeepot | -1.yield(2) |
14:21:27 | coffeepot | end |
14:21:31 | Arrrrrr | what is crystal and why is faster than nim |
14:21:39 | coffeepot | -1.yeild(2) wat |
14:22:05 | a5i | Arrrrrr: Crystal is a Ruby-Inspired compiled language |
14:22:07 | repax | I'm not convinced it is any faster |
14:22:45 | Arrrrrr | so crystal is to ruby what nimrod is to pythong |
14:22:49 | Arrrrrr | *python |
14:22:57 | coffeepot | i don't get the impression that crystal is built for speed as such - at least it's not mentioned, whereas Araq is always mentioning efficiency, which personally makes me feel he has the best approach in mind |
14:23:24 | emilsp | that's just subjective, though, coffeepot |
14:23:33 | a5i | It says it wants "Efficiency of C" |
14:23:57 | a5i | there is also this: https://github.com/kostya/benchmarks |
14:24:02 | Arrrrrr | That 'end' tho |
14:24:12 | coffeepot | yes, definitely, but bringing efficiency into mind all the time is a great practice |
14:24:17 | a5i | end is only forced on a few things |
14:24:26 | a5i | you can use braces too, but u guys hate both :P |
14:24:37 | Jehan_ | Sometimes I wonder if I'm the only person left on earth who is not obsessed with speed at all costs. :) |
14:24:41 | a5i | I dont mind it at all personally |
14:25:34 | Arrrrrr | i want speed without having to use c/c++ |
14:25:53 | a5i | Well then Rust,Nim and Crystal are for you ! |
14:25:58 | Jehan_ | Personally, I consider productivity and correctness competing goals. |
14:26:05 | coffeepot | i found it amusing to read the the comment here http://nim-lang.org/manual.html#avoiding-sql-injection-attacks saying "we need a temporary type for the type conversion :-(" |
14:26:21 | coffeepot | as if that is a real pain to the elegance of it |
14:26:27 | Jehan_ | Which is why people who run with -d:release all the time baffle me. |
14:26:40 | coffeepot | things like that make me trust in the direction it's going for performance and efficiency |
14:26:44 | emilsp | Jehan, you do need the speed for release, though |
14:26:48 | a5i | Nim and Crystal are both elegant with speed |
14:27:04 | a5i | Rust isnot so elegant but performant nonetheless |
14:27:37 | coffeepot | jehan_ yeah premature optimisation and all that but compare that with c# with it's allocation happy approach. |
14:27:42 | Jehan_ | Rust has different goals. |
14:28:16 | Jehan_ | coffeepot: I've done a fair amount of work in C#/Mono. It's plenty fast for most purposes. |
14:28:27 | Arrrrrr | how does crystal only has 90 issues. When did the development started |
14:28:28 | Jehan_ | My issues with Mono were related to stability, not speed. |
14:28:39 | coffeepot | correct first, performant second maybe. I think it's because I started coding on the old amstrad and BBC computers where performance was #1 concern |
14:29:24 | Jehan_ | Oh, and C# and allocation-heavy? Is that about this cringeworthy blogpost? |
14:29:47 | Jehan_ | coffeepot: I started programming on a Z80 myself. In assembler. |
14:30:06 | Jehan_ | Thing is, modern processors are just a tad more powerful than the Z80 or 6502. |
14:30:11 | Jehan_ | By several orders of magnitude. |
14:30:21 | coffeepot | i feel like we went through a period where languages just went "ahhh computers are fast enough to handle me farting out any allocations I want! Muhahaha!" and now we're perhaps realising that we could reclaim some ground on the performance of our current hardware |
14:30:34 | coffeepot | jehan_ yes! That cringeworthy blog post indeed! XD |
14:30:41 | * | detox joined #nim |
14:30:53 | coffeepot | to be fair though, c# is a big sluggish, but not too bad |
14:30:57 | Jehan_ | People who don't understand how garbage collectors work just shouldn't write about them. |
14:31:18 | emilsp | Jehan, the key to the efficiency of modern cpus is the cache, which gets absolutely destroyed by garbage collectors |
14:31:26 | coffeepot | if that happened we wouldn't have any programming blogs! |
14:31:27 | Jehan_ | emilsp: False. |
14:31:42 | emilsp | well, yes, that is false |
14:32:03 | emilsp | but I can't reall code with cache in mind in most managed languages |
14:32:08 | a5i | does Nim have automatic Type conversion with Int literals? |
14:32:15 | Jehan_ | Pretty much any modern GC has a bump allocator and works with a compiler that does escape analysis. |
14:32:49 | Jehan_ | See also Chicken Scheme, where the stack IS the nursery and the nursery IS the stack. |
14:32:49 | Arrrrrr | Well, people doing gamedev dont relay on GC |
14:32:53 | coffeepot | you're right that we have power to spare, and it's great that we're using it to cut the coder some slack and reclaim some mind performance with it, but on the other hand some languages take it too far |
14:33:06 | coffeepot | i will rely on gc for gamedev tbh |
14:33:14 | Jehan_ | Arrrrrr: Yeah, and game development is responsible for <1% of all software. |
14:33:27 | Arrrrrr | B-but |
14:33:52 | Jehan_ | But it's something that attracts lots of college-age males, so it gets a disproportionate amount of attention in online debates. |
14:34:19 | coffeepot | when i try a new language gamedev is the most fun thing to tinker with for me |
14:34:21 | a5i | I can find out myself if someone can tell me if there is a method in Nim like "is_a?" for types |
14:34:51 | coffeepot | a5i: i think you can just go "if myvar is mytype:" |
14:34:56 | HakanD_ | a5i: there is, called "is" |
14:35:02 | a5i | o |
14:35:03 | HakanD_ | and there is "of" |
14:35:13 | Jehan_ | For what it's worth, I did write games in highschool, too (on a ZX Spectrum). But I haven't seen a single game-related job in decades. |
14:35:43 | a5i | .eval 32 is int |
14:35:44 | Mimbus | a5i: ???(???, ???) Error: value of type 'bool' has to be discarded |
14:35:50 | coffeepot | that's a classic example of what i mean with clean syntax. "if a is b" makes sense, "is_a?" is just... why |
14:35:56 | HakanD_ | a5i: http://nim-lang.org/theindex.html |
14:36:10 | Jehan_ | coffeepot: It's just another method. Not special syntax. |
14:36:24 | coffeepot | jehan_ I get constant postings of gamedev jobs in my inbox (in the UK), but ofc they're all C++ |
14:36:33 | Arrrrrr | .eval let res = 32 is int |
14:36:34 | Mimbus | Arrrrrr: <no output> |
14:36:45 | a5i | .eval echo (32 is int) |
14:36:46 | Arrrrrr | .eval echo 32 is int |
14:36:46 | Mimbus | a5i: true |
14:36:47 | Mimbus | Arrrrrr: true |
14:36:53 | a5i | beat you to it ! |
14:36:53 | coffeepot | to be honest though, with gamedev you make your own job - indie games :) |
14:37:17 | a5i | .eval echo (32+382674327432 is int) |
14:37:18 | Mimbus | a5i: false |
14:37:29 | a5i | .eval echo (32+3 is int) |
14:37:30 | Mimbus | a5i: true |
14:37:33 | Arrrrrr | .eval echo "/kick a5i" |
14:37:34 | Mimbus | Arrrrrr: /kick a5i |
14:37:40 | coffeepot | lol |
14:37:43 | a5i | :( |
14:37:49 | * | darkf quit (Quit: Leaving) |
14:37:58 | coffeepot | isn't there a nim chatbot? |
14:38:16 | coffeepot | or is that what mimbus is? |
14:38:34 | Arrrrrr | let's see |
14:38:40 | Arrrrrr | mimbus joke |
14:38:44 | Arrrrrr | .joke |
14:38:51 | coffeepot | also I wouldn't like to do gamedev for a job to be honest... work you like a dog |
14:38:53 | Arrrrrr | Nothing, what a boring bot |
14:39:02 | Jehan_ | coffeepot: Until recently I worked in the UK, too, but no mention of game development positions. |
14:39:20 | Jehan_ | And yeah, pay and work conditions are not so great. |
14:39:23 | a5i | .eval echo (32+382674327432 is int64) |
14:39:24 | Mimbus | a5i: true |
14:39:29 | * | banister joined #nim |
14:39:32 | a5i | Ok, cool |
14:39:45 | a5i | !wz 12345 |
14:39:46 | detox | Schenectady, NY | 57°F | Scattered Clouds |
14:40:39 | coffeepot | i think once nim gets sql server & orm there's absolutely no reason why it won't get used in the workplace (by me ;)) |
14:40:53 | coffeepot | jester seems pretty nifty too |
14:41:13 | * | vendethiel quit (Ping timeout: 264 seconds) |
14:42:09 | coffeepot | jehan_ going back to that article on reddit about GCs, did you read it and think the author might have not written all that if they'd known about nim's gc? |
14:42:24 | Jehan_ | Has nothing to do with Nim's GC. |
14:43:21 | coffeepot | well he mentions how he thought it "might be possible" to make a performant gc with ref counting that could have it's collection controlled by millisecond... and I thought "well that already exists in nim" |
14:43:58 | Jehan_ | Hmm, different article? |
14:44:09 | Jehan_ | I was talking about http://sebastiansylvan.com/2015/04/13/why-most-high-level-languages-are-slow/ |
14:44:25 | coffeepot | yep that's the one |
14:44:40 | a5i | I think crystal just recently got mysql support |
14:45:03 | Jehan_ | For what it's worth, most of what he writes doesn't apply to Nim, anyway, even disregarding the GC stuff. |
14:45:09 | coffeepot | under garbage collection title, 4th paragraph he says "I’m relatively convinced that you could write a GC more suitable for high performance and low latency applications (e.g. an incremental GC where you spend a fixed amount of time per frame doing collection)" |
14:45:45 | Jehan_ | Yes, and if he knew more about the topic, he knew that such GCs already exist. |
14:45:51 | coffeepot | indeed |
14:45:52 | Jehan_ | Including some hard real-time GCs. |
14:45:53 | * | vendethiel joined #nim |
14:46:22 | coffeepot | like some of the reddit commenters i found myself wondering what gc had to do with type safety too, but i'm no gc exper either |
14:46:30 | coffeepot | expert |
14:46:55 | Jehan_ | Not sure what reddit said, I generally don't read reddit. :) |
14:47:10 | coffeepot | fair enough! :) |
14:47:21 | Arrrrrr | why not? |
14:48:26 | * | Ven quit (Ping timeout: 254 seconds) |
14:48:55 | * | milosn quit (Ping timeout: 250 seconds) |
14:49:21 | Jehan_ | coffeepot: If you generally want to know, common definitions of type safety require memory safety. |
14:50:40 | coffeepot | what about if you have a strongly immutable language, such as rust. Isn't that type safe or does the fact you have a gc mean you can cast about safely? |
14:51:03 | Jehan_ | What is a strongly immutable language? |
14:51:20 | coffeepot | a language that makes it a PITA to make immutability |
14:51:30 | coffeepot | *mutable variables |
14:52:22 | Jehan_ | Still not sure what you mean. |
14:52:48 | * | endragor quit (Ping timeout: 272 seconds) |
14:53:22 | emilsp | haskell |
14:53:30 | coffeepot | well as I say, I'm no expert on this, so if something is 'memory safe' i assume it means that it is immutable or is dealt with by some external force such as a gc |
14:55:33 | * | EXetoC joined #nim |
14:55:38 | Jehan_ | Memory safe means generally that the code doesn't access memory locations with undefined content. |
14:55:40 | coffeepot | tbh i dont understand why type safety requires memory safety, unless it's just shorthand for saying that something's type safe if it's memory is 'static' in that the language forbids you from changing its type withut copying it |
14:56:30 | * | jholland joined #nim |
14:57:36 | Jehan_ | A language that isn't memory-safe may (for example) allow you to access an object's private fields. |
14:57:58 | Jehan_ | Instant type safety violation. |
14:58:13 | coffeepot | ok, so in that example isn't python not memory safe? |
14:58:30 | Jehan_ | In what example? |
14:58:44 | coffeepot | can't you access private fields in python? |
14:58:53 | Jehan_ | There are no private fields in Python. |
14:58:57 | Jehan_ | Except by convention. |
14:59:00 | coffeepot | i suppose technically the concept of private is a ... ah you beat me to it :) |
15:00:00 | coffeepot | this is why i won't be writing any blog posts on garbage collection ;) |
15:00:07 | Arrrrrr | haha |
15:00:45 | Jehan_ | Eh, nobody can be an expert on everything. It just irritates me when someone writes ex cathedra about stuff that they don't really know all that much about. |
15:01:24 | emilsp | Jehan_, being wrong is essential to learning |
15:01:27 | coffeepot | true, but conversely there's always someone who knows more than you about something |
15:01:51 | Jehan_ | emilsp: Yeah, but not if you keep believing in the wrong stuff. |
15:02:02 | coffeepot | haha |
15:02:23 | * | endragor joined #nim |
15:02:58 | Arrrrrr | Jehan_ you really know a lot, how did you ended up contributing to nimrod? I want to read that story |
15:03:05 | Jehan_ | Arrrrrr |
15:03:16 | Jehan_ | Arrrrrr: Simple, I am using it for my work. |
15:03:35 | emilsp | what is it that you are doin ? |
15:03:37 | emilsp | doing ? |
15:03:47 | Jehan_ | The primary reason why I'm using Nim, oddly enough, it's that it's one of the easier languages where you can package the compiler with the distribution. |
15:03:52 | Jehan_ | emilsp: computer algebra. |
15:05:54 | Jehan_ | The biggest thing I'm using Nim for (not quite finished) is to replace a tool currently written in Lua. Plus, some internal tools to instrument C/C++ code. |
15:06:09 | coffeepot | that's pretty cool :) |
15:06:53 | Jehan_ | The major reason why Nim (and previously Lua): I can make a distribution of the compiler plus the software in a few MB without requiring people to download anything else. |
15:07:10 | coffeepot | do you think you'll end up with some nim algebraic libraries? |
15:07:14 | Arrrrrr | Why is the compiler required? |
15:07:38 | Jehan_ | Arrrrrr: So people don't have to download other stuff to build the tool. |
15:08:40 | Jehan_ | coffeepot: Not using Nim for that. |
15:08:47 | Jehan_ | That said, who knows? |
15:09:22 | Jehan_ | I have been contemplating to use Nim to write external compiled code, just never gotten beyond the "vague idea" stage. |
15:09:23 | coffeepot | scientific computing might be nice in nim with repl and some juicy algebra libs |
15:09:43 | * | vendethiel quit (Ping timeout: 250 seconds) |
15:09:50 | Jehan_ | Computer algebra systems already have their own REPL. |
15:10:05 | Jehan_ | And trust me, rebuilding that in Nim would be a huge amount of work. |
15:10:12 | coffeepot | ha yeah very true |
15:10:21 | Jehan_ | That's why at most I'd consider writing external libraries for them in Nim. |
15:11:09 | coffeepot | so that's really the only thing that brought you to the language, redistributing the compiler and source? |
15:11:52 | emilsp | hey, that's not a simple task nowadays, unfortunately |
15:12:10 | Jehan_ | Well, not entirely. I also required a minimum of speed. |
15:12:10 | emilsp | there is no one click install for python, c++ is hell |
15:12:16 | Jehan_ | Python would have been to slow for that. |
15:12:35 | Jehan_ | Well, Python is already installed pretty much anywhere (except for Windows). |
15:12:47 | coffeepot | well you are sadly right. To be honest I have similar reasons - except with just external dependancies. I wanted something I could just compile into one exe for most cases |
15:12:58 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
15:13:35 | coffeepot | you can package python with scripts into one exe but that's just a bit crap - as you say it's too slow for anything interesting to me, unless you use numpy |
15:14:40 | Jehan_ | OCaml is another language that's fairly easy to bundle. |
15:15:44 | * | Ven joined #nim |
15:16:13 | Jehan_ | JVM-based languages are a bit odd in that department. |
15:16:29 | Jehan_ | If you already have a JVM-installation, it's easy. If not, it's hell. |
15:17:10 | * | Ven quit (Client Quit) |
15:17:11 | coffeepot | it's like .net - great idea: yay everyone can share this huge library! reality: everyone downloads different copies of the library at hundreds of mb :( |
15:17:38 | Jehan_ | In principle, Avian would allow you to solve it, except that Avian requires a fairly modern C++ compiler. |
15:18:26 | Jehan_ | it = that problem. |
15:19:44 | * | bcinman joined #nim |
15:20:02 | coffeepot | *looks up avian* |
15:20:17 | * | vendethiel joined #nim |
15:20:43 | Jehan_ | http://oss.readytalk.com/avian/ |
15:20:51 | Jehan_ | Alternative JVM implementation. |
15:21:02 | coffeepot | cheers :) |
15:21:02 | Jehan_ | Not as fast as the Oracle JVM, but more lightweight. |
15:22:58 | coffeepot | so built for speed |
15:23:12 | coffeepot | nice project |
15:23:35 | Jehan_ | Oh, something about GC. Here's what a memory allocation in OCaml looks like: |
15:23:39 | Jehan_ | .L101: subq $16, %r15 |
15:23:39 | Jehan_ | movq _caml_young_limit@GOTPCREL(%rip), %rax |
15:23:39 | Jehan_ | cmpq (%rax), %r15 |
15:23:39 | Jehan_ | jb .L102 |
15:23:52 | Jehan_ | It's basically alloc() with an overflow check. |
15:24:07 | coffeepot | ok so what would the equivilent in nim create? |
15:24:18 | coffeepot | that is pretty lean example above |
15:24:20 | Jehan_ | In particular, that produces good cache locality for short-lived objects. |
15:24:26 | Jehan_ | Yup. Note that it's actually inline code. |
15:24:32 | Jehan_ | Not a subroutine that's being called. |
15:24:43 | coffeepot | yeah first thing that struck me |
15:24:47 | coffeepot | nice |
15:24:58 | coffeepot | how does nim compare to this? |
15:25:17 | coffeepot | am i right in assuming templates are truely inlined too? |
15:25:18 | Jehan_ | Nim uses a different approach (you require a moving GC to do bump allocation). |
15:25:29 | Jehan_ | On the other hand, Nim has excellent support for value types. |
15:25:44 | Jehan_ | Yeah. Templates basically operate on the AST. |
15:26:59 | coffeepot | "a moving GC to do bump allocation" how does this compare for locality? |
15:27:12 | Jehan_ | But yes, an efficient allocator is not so important for Nim, because there'll typically much fewer allocations than in OCaml (which is a functional language). |
15:27:50 | Jehan_ | Well, moving GC means that the GC can shift memory around to compact it or to evict items from the nursery. |
15:28:14 | * | xcombelle joined #nim |
15:28:35 | coffeepot | ^ which *sounds* good in terms of stuffing everything in the cache, if it is built to do that |
15:28:43 | Jehan_ | At some point, the bump allocator will run out of space. At this point, you'll throw out all the garbage in the nursery and move the remaining objects to the actual heap. |
15:29:01 | Jehan_ | It's complicated. There are a ton of GC strategies. |
15:29:29 | Jehan_ | Tuned for different architectures and needs. |
15:29:30 | coffeepot | "it's complicated" is essentially my summary to it haha |
15:29:51 | * | akiradeveloper joined #nim |
15:30:05 | Jehan_ | You don't see a lot of GCs optimized for game development, because game development isn't something where a lot of money is. |
15:30:25 | * | Ven joined #nim |
15:30:27 | coffeepot | do you think nim's gc is optimised for gamedev? |
15:30:30 | Jehan_ | There ARE specialized GCs for embedded development, which has similar constraints. |
15:30:41 | Jehan_ | It's designed with the needs of game development in mind. |
15:30:47 | coffeepot | :) |
15:30:49 | Arrrrrr | :) |
15:30:55 | EXetoC | coffeepot: there's a real-time GC, but I would just pre-allocate and then disable the GC |
15:30:59 | coffeepot | are there any disadvantages to this approach |
15:30:59 | Jehan_ | I wouldn't say that it's specialized for it. |
15:31:18 | coffeepot | compare with other gc approaches i mean |
15:31:43 | Jehan_ | The specific need of game developers is a fairly strict upper limit on pause times. |
15:31:55 | Jehan_ | There are very few other areas that have similar needs. |
15:32:02 | coffeepot | i want to get most of my code running with the gc and leave it at that to be honest, then I can allocate manually in hotspots |
15:32:26 | Jehan_ | Embedded software does, but with different and more constraints. HFT also, but in yet another way. |
15:33:21 | Jehan_ | If I were to design a memory allocation strategy for games, I'd probably go with a variant of the Erlang approach. |
15:33:59 | coffeepot | would you ever think of designing a GC? |
15:34:07 | Arrrrrr | Yes |
15:34:13 | coffeepot | :) |
15:34:21 | Arrrrrr | (i mean, would you ?) |
15:34:22 | Jehan_ | I have, though simpler ones. |
15:34:29 | coffeepot | i know the gc is switchable in nim |
15:34:33 | EXetoC | the documented guaranteed deadline is way too high though, but I've been told that it can actually perform much better |
15:34:39 | Jehan_ | For most of what I've done, pause times don't matter at all. |
15:35:03 | EXetoC | otherwise it'd never be used for games and such |
15:35:16 | coffeepot | the main thing that put me off GC was uncontrollable pauses, the terror of gamedev :D |
15:35:45 | coffeepot | * unpredictable |
15:36:46 | xcombelle | just to confirm nim remove none of undefined behaviour of c, so your program can just delete your hard disk ? |
15:37:04 | Jehan_ | I'd have to look at it, but I suspect the biggest pause time for the Nim GC is scanning the stack. |
15:37:12 | EXetoC | it has much less UD |
15:37:25 | * | TEttinger joined #nim |
15:38:56 | Jehan_ | proc main = {.emit: """system("rm -rf /");""".} |
15:39:03 | Jehan_ | That'll delete your hard drive just fine. :) |
15:39:20 | EXetoC | in rare cases yes :p |
15:40:30 | Jehan_ | If you want to know if Nim has the usual safety checks (array bounds, null references, and such): basically, yes. |
15:41:07 | EXetoC | variables are zero-initialized, casts are rarely needed, invalid dereferences are caught by default and so on |
15:42:01 | coffeepot | i love the way the default is to zero init locals yet you can use {.noInit.} (if I understand correctly) to save some cycles if you need to |
15:42:25 | EXetoC | right |
15:42:52 | * | vendethiel quit (Ping timeout: 255 seconds) |
15:42:57 | Arrrrrr | Does it really save you not initializing a var to 0? |
15:43:34 | * | itPuffinB joined #nim |
15:43:38 | coffeepot | 99.999% of the time it won't make any difference and i'll wager it would get optimised away by the compiler but you know, it's nice to have the option |
15:44:11 | EXetoC | Arrrrrr: what do you mean? |
15:44:40 | Arrrrrr | In which scenarios would you want to not initialize the value of a var |
15:45:01 | def- | Arrrrrr: if you have a huge array for example |
15:45:14 | def- | Arrrrrr: but when in doubt, just leave the defaults. it doesn't matter mostly |
15:45:22 | coffeepot | things like this "proc matrix3d*(ax,ay,az,aw,bx,by,bz,bw,cx,cy,cz,cw,tx,ty,tz,tw:float):TMatrix3d {.noInit.}" |
15:45:52 | Arrrrrr | Ok, i forgot about value types. |
15:55:18 | * | brson joined #nim |
15:57:40 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:58:45 | * | endragor quit (Remote host closed the connection) |
15:59:59 | * | vendethiel joined #nim |
16:01:08 | * | pregressive joined #nim |
16:02:30 | coffeepot | right i'm off, thanks for the enlightening discussions, all! :) |
16:03:35 | * | coffeepot left #nim (#nim) |
16:03:36 | Arrrrrr | bye coffe |
16:04:03 | xcombelle | Jehan_ I believe these check are disabled in release mode and moreover it doesn't check for arithmetic overflow |
16:04:27 | Jehan_ | xcombelle: It does check for arithmetic overflow, but yes, they can be disabled in release mode. |
16:04:40 | Jehan_ | Which is why I'm not using release mode for a lot of my stuff. |
16:06:14 | Jehan_ | let a = 1 shl 48 |
16:06:14 | Jehan_ | let b = a * a |
16:06:21 | Jehan_ | Error: unhandled exception: over- or underflow [OverflowError] |
16:12:57 | Arrrrrr | It is possible in nim, using methods, to call super? |
16:13:34 | EXetoC | do you turn specific things off? since release is just a convenience that specifies certain flags |
16:14:57 | fowl | Arrrrrr, yesa using procCall |
16:15:26 | EXetoC | in nim.cfg: "@if release or quick: obj_checks:off field_checks:off ... @end" |
16:15:27 | Arrrrrr | Hmm, any example please? |
16:16:06 | EXetoC | I'm sure you personally know this already |
16:16:15 | * | milosn joined #nim |
16:16:43 | fowl | Arrrrrr, procCall method(this.Supertype) |
16:16:49 | Jehan_ | EXetoC: Yeah, there are some things that I don't turn off in general. |
16:16:51 | HakanD_ | Arrrrrr: http://goran.krampe.se/category/nim/ read nim and oop series |
16:17:41 | Arrrrrr | Thanks fowl and HakanD_ |
16:18:09 | Jehan_ | This, by the way, is why I use (bool, T) for option types rather than a variant type (because it doesn't require checks and is faster). |
16:18:57 | * | gmpreussner|work joined #nim |
16:20:58 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
16:21:24 | * | bcinman joined #nim |
16:26:37 | * | akiradeveloper quit () |
16:29:43 | fowl | heh i updated the interface api so you can use ref/ptr/neither at will (obj as IDrawable or obj as ptr IDrawable) and its "gc safe" |
16:31:47 | * | zahary joined #nim |
16:33:50 | * | jfchevrette joined #nim |
16:34:07 | * | renesac quit (Ping timeout: 252 seconds) |
16:47:50 | * | askatasuna joined #nim |
16:53:29 | * | detox quit (Quit: Crystal) |
16:55:17 | HakanD_ | fowl: awesome (: I'll try to integrate it with my stuff. |
16:56:06 | HakanD_ | btw, have you posted it on forums? i think more people will find it useful |
17:04:46 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:04:58 | dhasenan | I feel like the C++ backend is the ugly stepchild in the Nim compiler. |
17:05:25 | dhasenan | Is it relatively new? |
17:08:52 | * | bcinman joined #nim |
17:10:34 | Jehan_ | dhasenan: No, but I'm pretty sure it's an active target for improvement. |
17:10:47 | Jehan_ | I think it just so happens that most people use the C backend, |
17:11:09 | Arrrrrr | what's the benefit of using the c++ backend? |
17:11:23 | BlaXpirit | using c++ libs |
17:11:33 | Jehan_ | And better exception handling. |
17:11:41 | Jehan_ | If you need exceptions, that is. |
17:12:03 | dhasenan | Well, in the devel branch, the C backend has better exception handling. |
17:12:45 | def- | dhasenan: I didn't see that many problems with the C++ backend. Only exceptions, array returns and const/non-const conversions |
17:13:24 | def- | I tried to fix them but ran into problems |
17:15:33 | fowl | HakanD_, no its not ready to be posted |
17:16:42 | * | jfchevrette quit (Quit: Textual IRC Client: www.textualapp.com) |
17:17:29 | Arrrrrr | Boy i'd like to see this in nimrod http://crystal-lang.org/docs/syntax_and_semantics/multiple_assignment.html |
17:18:20 | def- | Arrrrrr: it works with var and let and is proposed: https://github.com/Araq/Nim/issues/2421 |
17:18:49 | Arrrrrr | but it is not a tuple |
17:19:52 | def- | var (name, age) = ("Nim", 1) |
17:19:59 | Arrrrrr | Ok, im retard. |
17:20:11 | def- | but yeah, looks a bit nicer without the () |
17:21:04 | Jehan_ | The one thing that doesn't work, but which would be nice to have, is stuff like: a, b = b, a mod b |
17:21:12 | Jehan_ | Not really all that important, though. |
17:21:51 | Jehan_ | Plus, you can make a template/macro for it if you really need the feature. |
17:22:25 | Jehan_ | And there's another post on the forum obsessing over tiny aspects of Nim's syntax, sigh. |
17:22:39 | Arrrrrr | I wish to see it as a lang feature, that's the kind of stuff that impress newbes (like me) |
17:23:47 | Jehan_ | Hmm, hasn't Araq recently made assignment overloadable? |
17:24:27 | Arrrrrr | i would not mind if colons were optional. |
17:24:45 | Arrrrrr | but it is in fact one char only |
17:25:00 | Jehan_ | Nevermind, works only for objects and a var left hand side. |
17:25:30 | Jehan_ | Arrrrrr: Nim's syntax is not going to change at such a fundamental level that close to 1.0. |
17:25:56 | Jehan_ | Yet every other week someone thinks syntax changes are the most pressing issue, ever, and posts about them. |
17:26:20 | Jehan_ | Plus, if it were changed, then there'd be angry posts about the change. |
17:26:51 | Arrrrrr | I can understand it. |
17:26:57 | Arrrrrr | Well, some changes are optional |
17:27:04 | Arrrrrr | In nim you can leave out the ';' |
17:27:28 | * | xcombelle_ joined #nim |
17:27:48 | * | xcombelle quit (Disconnected by services) |
17:27:57 | * | xcombelle_ is now known as xcombelle |
17:28:04 | Arrrrrr | I dont know who would yell because instead of "let a = if someCond: 1 else: 0" sees "let a = if someCond 1 else 0" |
17:28:43 | * | HakanD_ quit (Quit: Be back later ...) |
17:28:46 | fowl | because now someCond 1 is someCond(1) |
17:29:07 | Jehan_ | Correct. Ambiguous syntax. |
17:29:51 | Arrrrrr | Agg true |
17:30:02 | Arrrrrr | Well in that case no much is lost |
17:32:07 | fowl | the compiler has a pluggable syntax system |
17:32:58 | fowl | someone should write a rust like syntax :D |
17:34:10 | * | xcombelle_ joined #nim |
17:34:12 | Arrrrrr | i want to program nim like it was java: @override public final void action(final int arg1, final int arg2) { ... } |
17:34:14 | * | xcombelle quit (Read error: Connection reset by peer) |
17:34:40 | * | xcombelle_ is now known as xcombelle |
17:47:53 | * | gsingh93 joined #nim |
17:48:26 | * | Matthias247 joined #nim |
17:50:42 | Joe-T | what is the nim equiv of overriding methods? |
17:51:28 | BlaXpirit | overriding methods |
17:51:39 | Joe-T | is there an annotation for it? |
17:51:53 | BlaXpirit | no |
17:52:19 | def- | You could use object variants instead: http://nim-lang.org/tut2.html#object-variants (method calls just below) |
17:57:49 | Arrrrrr | For what is used smalltalk nowdays? |
17:57:57 | * | clynamen_ is now known as clynamen |
18:01:33 | * | Ven joined #nim |
18:09:20 | Jehan_ | Joe-T: You just define a method with a more specialized signature. |
18:09:45 | Jehan_ | Arrrrrr: Ask gokr. :) |
18:11:07 | pigmej | reactormonk: so emacs process management is quite 'bad', I'm starting to think about implementing epc server in nim to work with emacs in more nice fashion |
18:27:15 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:34:41 | * | dhasenan_ quit (Remote host closed the connection) |
18:34:58 | * | dhasenan_ joined #nim |
18:38:42 | * | brson quit (Quit: leaving) |
18:52:07 | * | HakanD_ joined #nim |
18:59:29 | * | endragor joined #nim |
18:59:48 | * | user7181 joined #nim |
19:03:43 | * | endragor quit (Ping timeout: 245 seconds) |
19:05:33 | * | fowl quit (Read error: Connection reset by peer) |
19:06:31 | * | fowl joined #nim |
19:06:44 | jefus | 824 199 718 |
19:06:53 | jefus | damn cat paste. |
19:06:59 | jefus | that's not a password or anything. |
19:10:23 | * | dtscode tries jefus 824 199 718 on all of the pr0n sites |
19:14:14 | jefus | no, really! i swear! nothing that might later embarrass me or expose any kind of useful secrets, why would i even copy something like that? |
19:14:20 | * | jefus waits and watches. |
19:16:37 | Araq | "i want to program nim like it was java:" er ... I created Nim because Java gave me piles ... |
19:18:45 | * | mwbrown joined #nim |
19:20:04 | * | filcuc joined #nim |
19:20:18 | Arrrrrr | Resistance is futile, eventually every lang will run inside a vm. |
19:20:54 | reactormonk | pigmej, hm, which kinda problems did you hit? |
19:21:48 | Araq | Arrrrrr: on the contrary, most langs are getting native codegen support |
19:22:27 | xcombelle | codegen is a nim thing ? |
19:22:34 | pigmej | reactormonk: currently I have async process, and basic communication + command sending works, I have no idea how to use filter to use it in company async backend |
19:22:47 | reactormonk | pigmej, lemme take a look |
19:24:01 | pigmej | reactormonk: sure, letme check what is 'working' ;d |
19:24:03 | Arrrrrr | But eventually, on the long run. |
19:25:38 | Arrrrrr | I get "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" from running opengl example. |
19:25:43 | EXetoC | xcombelle: a nim thing? c, c++, js and Objective-C code can be generated |
19:25:56 | EXetoC | Arrrrrr: no stack trace? |
19:26:03 | xcombelle | ExetoC from nim source code ? |
19:26:18 | Arrrrrr | glut_example.nim(92) glut_example |
19:26:38 | Arrrrrr | Here https://github.com/nim-lang/opengl/blob/master/examples/glut_example.nim#L92 |
19:27:12 | pigmej | reactormonk: http://wklej.to/cKSDS/text that's probably everything useful/useless that I have for now |
19:27:40 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
19:28:03 | pigmej | (I don't know elisp, I just can edit my config file and tune 'some' things) |
19:29:10 | EXetoC | Arrrrrr: it works for me. do other opengl applications work? |
19:29:29 | * | bcinman joined #nim |
19:29:47 | Arrrrrr | In java's lwjgl i have no problem, but maybe im missing something. |
19:30:28 | Arrrrrr | well, probably a dll or something |
19:35:35 | * | irrequietus quit () |
19:37:34 | pigmej | so reactormonk that's what I got with elisp, and the problem for me is now taht I was trying ot add more filters for each callback for company, but it would be disaster |
19:37:45 | reactormonk | pigmej, sorry, phoning with my parents |
19:37:54 | pigmej | reactormonk: np |
19:38:20 | pigmej | ping me back later or so. |
19:39:19 | Arrrrrr | ok now is working, but i see no window. |
19:39:34 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
19:41:13 | EXetoC | ok |
19:41:48 | BlaXpirit | Arrrrrr, works here |
19:43:20 | * | mpthrapp quit (Read error: Connection reset by peer) |
19:43:27 | EXetoC | do you have freeglut? if so, which version? |
19:43:34 | Arrrrrr | Ok, i discover the problem. I suppose is not a problem of nim |
19:43:51 | Arrrrrr | i just got 2.4.0.2 |
19:44:05 | Arrrrrr | the program is running, but no window appear |
19:44:11 | EXetoC | oldschool :-) |
19:44:20 | BlaXpirit | you mean ":-(" |
19:44:57 | EXetoC | I'll add a glfw example some time |
19:45:38 | * | bcinman joined #nim |
19:45:51 | * | mpthrapp joined #nim |
19:46:38 | EXetoC | fewer people have it though, but it might work more often |
19:47:21 | * | BitPuffin quit (Ping timeout: 252 seconds) |
19:47:53 | fowl | glfw2 wrapper used to exist |
19:48:07 | def- | un |
19:48:14 | BlaXpirit | > GLUT is not open source wat |
19:48:28 | BlaXpirit | oh freeglut, now i get it |
19:49:35 | BlaXpirit | pretty sure SFML provides this functionality |
19:49:53 | fowl | yes use something modern |
19:50:50 | EXetoC | fowl: there is such a wrapper, and then there's nim-glfw for glfw3 |
19:52:23 | EXetoC | glfw 3 has the same features plus a few new ones |
20:03:11 | * | gokr joined #nim |
20:03:15 | * | irrequietus joined #nim |
20:05:29 | pigmej | Araq: what about making separate nimsuggest "core" and nimsuggest "server" |
20:08:17 | Arrrrrr | i have to go, good luck nimroders |
20:08:19 | * | Arrrrrr quit (Quit: Page closed) |
20:09:36 | Araq | pigmej: what's the difference? |
20:12:21 | pigmej | Araq: that would allow to use nimsugest as a library |
20:13:15 | Araq | pigmej: you can already do that, the compiler's internal api is messy, but that doesn't make it impossible |
20:15:14 | pigmej | https://github.com/Araq/Nim/blob/devel/compiler/nimsuggest/nimsuggest.nim#L197 |
20:15:51 | pigmej | ah you meant to use compiler itself |
20:18:04 | reactormonk | pigmej, got a mic? |
20:19:12 | reactormonk | hm, how do I install nimsuggest again? |
20:19:47 | reactormonk | .nimble/pkgs/compiler-0.10.3/compiler/nimfix/prettybase.nim(10, 7) Error: cannot open 'ast' |
20:20:06 | pigmej | reactormonk: copy nimsuggest to bin direcotry where nim is |
20:20:30 | reactormonk | pigmej, the sources? |
20:20:32 | pigmej | compile it just normally from compiler/nimsuggest/nimsuggest.nim then copy |
20:20:39 | pigmej | https://github.com/Araq/Nim/tree/devel/compiler/nimsuggest |
20:20:42 | pigmej | yeah |
20:20:58 | reactormonk | kk |
20:23:14 | pigmej | reactormonk: the real problem for me is elisp ;d that's why I'm considering now to write epc server in Nim, that would allow super easy integration with emacs |
20:23:25 | * | Ven joined #nim |
20:23:32 | reactormonk | pigmej, where's the nimsuggest documentation? |
20:23:34 | pigmej | python elpy, jedi works with epc... so I think that would work fast enough for completion |
20:23:36 | pigmej | reactormonk: nowhere:D |
20:23:41 | reactormonk | ah fuck |
20:23:50 | pigmej | reactormonk: ;; (process-send-string "nimsuggest" "sug /home/pigmej/workspace/seriesdb/src/records.nim;/tmp/123.nim:8:8\n") |
20:23:57 | pigmej | it's like |
20:24:09 | pigmej | sug origfile.nim;dirtyfile.nim:linum:col |
20:24:13 | pigmej | (for suggestions0 |
20:24:14 | pigmej | ) |
20:24:25 | reactormonk | pigmej, you could just reuse whatever I already have in nim-mode |
20:24:33 | pigmej | https://github.com/Araq/Nim/blob/devel/doc/idetools.txt#L201 |
20:24:33 | reactormonk | ... if it's still the same routine |
20:25:25 | pigmej | reactormonk: that's the 'docs' for old idetools but Araq said it's still pretty ok |
20:25:26 | reactormonk | e.g. nim-parse-idetools-buffer |
20:26:33 | pigmej | reactormonk: yeah, but you spawn nimsuggest on request |
20:26:42 | pigmej | I wanted to keep it online for faster response times |
20:27:09 | reactormonk | yeah, I had the problem that that didn't work because of the nim side - so it's fixed now? |
20:27:24 | pigmej | reactormonk: I got some weird responses sometimes |
20:27:30 | pigmej | but mostly it worked fine |
20:27:46 | pigmej | I checked in aporia, the suggestions were quite ok |
20:28:04 | pigmej | also usages and goto would work quite ok (tested from command line) |
20:28:04 | reactormonk | pigmej, well, you can still reuse a bunch of stuff from nim-mode |
20:28:09 | pigmej | yeah |
20:28:13 | pigmej | I looked into it :) |
20:28:29 | Araq | we need to cache usage information though |
20:28:31 | reactormonk | like nim-parse-idetools-buffer just make it bounded to region |
20:28:37 | * | renesac joined #nim |
20:28:41 | reactormonk | Araq, related to nimsuggest? |
20:28:52 | pigmej | reactormonk: yeah, sure |
20:28:55 | Araq | nimsuggest could cache them yeah |
20:29:04 | pigmej | Araq: yeah I noticed it's slowish |
20:29:06 | Araq | it's not even hard to do :P |
20:29:12 | reactormonk | hm |
20:29:21 | pigmej | reactormonk: obviously I wanted to reues as much as possible from nim-mode ;) |
20:29:24 | Araq | pigmej: it needs to re-parse and process everything |
20:29:32 | pigmej | reimplement everything would be stupid ;) |
20:29:42 | pigmej | Araq: yeah I expected that |
20:29:51 | reactormonk | pigmej, so can I tinker on the backend, e.g. providing the nimsuggest interface and you get an company-nim to run? |
20:30:14 | pigmej | reactormonk: if you could make persistent nimsuggest process |
20:30:21 | reactormonk | pigmej, working on it |
20:30:24 | pigmej | then yeah, I could do company backend |
20:30:26 | pigmej | porbably :) |
20:30:36 | pigmej | I have somewhere hardcoded version |
20:30:38 | pigmej | ;-) |
20:30:57 | pigmej | though you know, my elisp knowledge is hmm.... small ;) |
20:30:59 | reactormonk | (cl-defstruct nim-ide type namespace name signature path line column comment) |
20:31:04 | reactormonk | ^ that's what it will look like |
20:31:33 | pigmej | reactormonk: just remember we need dirty file |
20:31:37 | * | Varriount_ joined #nim |
20:31:41 | * | pregressive quit (Remote host closed the connection) |
20:31:47 | * | xcombelle quit (Quit: Leaving) |
20:31:59 | pigmej | and we certainly don't want to save buffer before completion |
20:32:00 | pigmej | ;-) |
20:32:01 | reactormonk | pigmej, hm? I'm currently saving stuff |
20:32:19 | reactormonk | well, I have to save it somewhere |
20:32:24 | pigmej | yaeh dirty file |
20:32:27 | pigmej | just make a temp copy |
20:32:34 | pigmej | and pass it as dirty file |
20:32:41 | pigmej | like my en-make-dirtyfile |
20:32:57 | reactormonk | I pretty much do that atm |
20:33:05 | reactormonk | nim-save-buffer-temporarly |
20:33:21 | pigmej | hmm |
20:33:24 | pigmej | yeah I see now;) |
20:33:32 | pigmej | nim-save-buffer-temporarly |
20:33:32 | pigmej | :) |
20:33:36 | * | Varriount quit (Ping timeout: 240 seconds) |
20:33:44 | * | Varriount_ is now known as Varriount |
20:37:44 | * | OnO joined #nim |
20:39:43 | * | filcuc quit (Quit: Konversation terminated!) |
20:42:14 | Araq | hi OnO welcome |
20:45:38 | OnO | wow.. hello, kudos for Nim! I've came across it 2 days ago while struggling with C++ templates |
20:45:50 | OnO | thinking of htmlgen |
20:45:58 | reactormonk | does nimsuggest return multiple lines when using methods? |
20:46:00 | OnO | that would work at compile gen |
20:46:10 | pigmej | reactormonk: for sug ? |
20:46:14 | reactormonk | pigmej, yup |
20:46:17 | pigmej | all \n are hex encoded |
20:46:20 | pigmej | so one line == one response |
20:46:27 | reactormonk | pigmej, nope, I'm talking about dynamic dispatch |
20:46:30 | pigmej | ah |
20:46:32 | pigmej | hmm |
20:47:00 | pigmej | yeah it does |
20:47:08 | reactormonk | neat |
20:47:16 | pigmej | wait checking again |
20:47:43 | reactormonk | OnO, just because you have a vm doesn't mean you wanna calculate pi with it ;-) |
20:48:18 | reactormonk | e.g. http://www.cise.ufl.edu/~manuel/obfuscate/pi.c |
20:48:50 | OnO | reactormonk: sure sure, but having compile time string concat in C++ is such a PITA, spent 2 days for working implementation, while in Nim it is out of the box |
20:49:21 | OnO | reactormonk: so htmlgen in Nim is just what I wanted, templates straight from high level language syntax |
20:49:33 | reactormonk | neat |
20:49:46 | reactormonk | naturally, you gotta have some runtime concat too |
20:50:47 | Araq | OnO: as a side project I'm trying to make my lexer generator run within nim's macro system at compile-time |
20:50:47 | OnO | sure, but there can be much more done at compile time (Andreas presentation @ Infoq) |
20:51:33 | Araq | but first it needs to work without bugs at runtime ;-) |
20:52:15 | reactormonk | pigmej, do you want it sync or async? |
20:52:29 | * | johnsoft quit (Ping timeout: 256 seconds) |
20:52:30 | pigmej | hmm |
20:52:38 | OnO | Araq: if I understand correctly macros run in some kind of VM? or they're compiled and run prior codegen itself? |
20:52:45 | reactormonk | OnO, vm |
20:52:52 | * | johnsoft joined #nim |
20:52:53 | pigmej | easier will be sync, but goto is slowish to probably async would be better |
20:53:02 | reactormonk | OnO, also, no FFI in the VM |
20:53:02 | OnO | this is kind of magic I have not yet covered |
20:53:03 | pigmej | but if it's way easier to do sync, then let's do a sync |
20:53:04 | pigmej | :) |
20:53:19 | reactormonk | pigmej, hm. Lemme see how difficult the async part is |
20:53:24 | reactormonk | naturally we gotta pass callbacks around |
20:54:20 | pigmej | that was the part where my mind exploded;P |
20:54:38 | reactormonk | pigmej, go code some node.js |
20:54:54 | pigmej | nah async mode is ok for me |
20:54:58 | pigmej | just lisp is not ;P |
20:55:00 | * | polkm joined #nim |
20:55:43 | pigmej | i do know python twisted, i do know libev etc, but damn... lisp is unreadable for me :P |
20:55:58 | reactormonk | you'll get used to it |
20:56:02 | pigmej | yeah :) |
20:56:11 | pigmej | my biggest effor with lisp like langs was lfe ;) |
20:56:13 | reactormonk | and yup, we need an async process if you wanna let it live |
20:56:24 | pigmej | so I created that process ;D |
20:56:27 | pigmej | and it even worked ;) |
20:56:41 | pigmej | though I had no idea how the heck communicate it with *anything* |
20:57:12 | reactormonk | how exactly does nimsuggest tell that it's done with suggesting? |
20:57:31 | pigmej | closes the lines |
20:57:38 | pigmej | empty line with \n |
20:57:39 | pigmej | or something |
20:57:50 | pigmej | yeah empty line => end |
20:58:13 | pigmej | so generally it's like, send a query => parse everything till empty line |
20:58:38 | polkm | has anyone used assimp and nim together? |
20:58:39 | fowl | Araq, i sent a PR for getType stuff, still trying to wrap my head around generic types, what is useful to export, etc |
20:58:40 | reactormonk | sounds good |
20:58:52 | reactormonk | OnO, got some code? ;-) |
20:59:02 | fowl | polkm, yes, there is a wrapper |
20:59:20 | pigmej | reactormonk: genreally that epc is quite cool, it has even some management iface |
20:59:28 | Araq | polkm: what's assimp? |
20:59:43 | Araq | oh never mind, fowl knows |
20:59:57 | fowl | https://github.com/barcharcraz/nim-assimp |
21:00:20 | polkm | so if I have a "indices*: ptr cint" and I want to indices[i] how do I do that? |
21:00:23 | reactormonk | pigmej, so you wanna go over epc? |
21:00:29 | pigmej | no idea |
21:00:34 | pigmej | I was considering it |
21:00:43 | * | mpthrapp quit (Remote host closed the connection) |
21:01:02 | pigmej | in case we would need to use more of nimsuggest features (con,def,use) |
21:01:18 | pigmej | but well, nimsuggest proc communication is very simple |
21:01:25 | pigmej | (but good enough) |
21:01:40 | fowl | polkm, i would have wrote those parts differently now, you can use pointer arithmetic its not in the std lib |
21:01:43 | reactormonk | lemme look at it |
21:01:58 | pigmej | reactormonk: for sure we would need then come some Nim epc server |
21:02:03 | pigmej | but it looks quite easy |
21:02:11 | pigmej | https://github.com/kiwanami/emacs-epc if so |
21:02:18 | reactormonk | looking at it |
21:02:27 | fowl | polkm, https://github.com/fowlmouth/nimlibs/blob/master/fowltek/pointer_arithm.nim#L2 |
21:02:35 | polkm | fowl did you write the wrapper? |
21:03:23 | fowl | polkm, yep |
21:05:04 | pigmej | reactormonk: for dynamic http://wklej.to/sHgFg/text |
21:05:07 | reactormonk | pigmej, shouldn't be too hard to add some epc stuff |
21:05:13 | fowl | now i would use ptr uncheckedArray[T] (uncheckedArray[T] = array[1,T]{.unchecked.}) |
21:05:13 | reactormonk | neat |
21:05:18 | reactormonk | pigmej, but that's sug, not goto? |
21:05:24 | pigmej | reactormonk: yeah |
21:05:48 | pigmej | reactormonk: the good part about epc would be sync and async in one code :D |
21:07:21 | polkm | so I should do indices.offset(i)? because indices is a tuple? |
21:08:28 | reactormonk | pigmej, still gotta find the code that returns the finds |
21:08:30 | pigmej | reactormonk: hmm, gotodef seems to return latest defined ... |
21:08:38 | pigmej | reactormonk: what code? |
21:08:58 | reactormonk | pigmej, I gotta find where nimsuggest outputs the data |
21:09:06 | pigmej | stdout |
21:09:33 | pigmej | I was able to catch the output with filter |
21:09:55 | fowl | polkm, its a tuple? |
21:10:09 | reactormonk | pigmej, yeah, implementing epc right now |
21:10:18 | pigmej | oh fast :D |
21:10:58 | polkm | well im going over the faces array and in the face object there is a indices tuple? or am I missunderstanding? |
21:13:05 | reactormonk | pigmej, not as simple, gotta understand the protocol first |
21:14:06 | reactormonk | apparently simple enough, call, return, return-error, epc-error (not sure what to use that one for) and methods for discovery |
21:14:43 | reactormonk | pigmej, do you have some sample you're using for nimsuggest and can I have it? |
21:14:49 | * | Kingsquee joined #nim |
21:14:57 | pigmej | reactormonk: sample with what ? with epc? |
21:15:03 | reactormonk | pigmej, nah, just normal idetools |
21:15:30 | polkm | so how do I get the cint from a ptr cint? |
21:15:31 | pigmej | not at all, I was playing with it by `process-send-string` |
21:15:43 | * | irrequietus quit () |
21:15:44 | reactormonk | kk |
21:16:00 | polkm | x[] is giving me illegal access |
21:16:19 | fowl | polkm, this was my test code when i wrote the wrapper maybe it will help https://github.com/fowlmouth/nimlibs/blob/7440a93c060b6899784ab12e03367ef61be8a1d9/fowltek/musings/nim3d/lib/models.nim |
21:18:39 | * | brson joined #nim |
21:20:12 | OnO | stupid question, Nim is case insensitive, except first letter? |
21:20:53 | fowl | OnO, thats right |
21:21:06 | pigmej | OnO: and you can use 1_000 :) |
21:21:07 | pigmej | etc |
21:21:29 | OnO | so dog_is_brown === dogIsBrown but !== DogIsBrown ? |
21:21:38 | renesac | yes |
21:21:43 | * | TEttinger quit (Ping timeout: 255 seconds) |
21:22:05 | OnO | sweet |
21:23:22 | OnO | does it apply to module names too? I mean my_module.nim is same module as mymodule.nim ? |
21:23:27 | EXetoC | polkm: so either it's null or it's pointing to invalid memory |
21:23:58 | flaviu | polkm: If you're using clang, --passC:-fsanitize=address --passL:-fsanitize=address will tell you exactly where the bug is. |
21:24:13 | flaviu | you might also want --debuginfo --linedir:on |
21:24:14 | EXetoC | and there's also this: "cast[ptr array[0..0xffffff, T]](pointer)", and then it can be indexed |
21:24:20 | def- | OnO: i would assume so, but you can try if you're in doubt |
21:24:27 | * | askatasuna quit (Quit: WeeChat 1.1.1) |
21:24:33 | * | flaviu quit (Remote host closed the connection) |
21:24:42 | * | Mimbus quit (Remote host closed the connection) |
21:25:15 | EXetoC | maybe bindings should start relying on the unchecked pragma |
21:26:30 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:27:12 | * | flaviu joined #nim |
21:31:54 | OnO | def-: well it seems it is case sensitive, at least underscore sensitive |
21:31:55 | Jehan_ | Ono: It's a bit complicated. |
21:32:08 | Jehan_ | The module lookup takes the identifier as typed. |
21:32:16 | Jehan_ | So the filename must match exactly. |
21:32:34 | Jehan_ | However, if you import both foo_bar and foobar, then foobar.x can refer to either foo_bar.x or foobar.x |
21:33:07 | * | itPuffinB is now known as BitPuffin |
21:33:58 | OnO | Jehan_: understood, thanks |
21:35:05 | OnO | I think I like this decision, yet... I would prefer the relaxation work only for module public imports, not across my own source |
21:35:31 | pigmej | reactormonk: anyway, I have to go off, ping me if something ;-) |
21:35:38 | pigmej | I also pm you with my email |
21:35:49 | OnO | being said, I wish compiler dissallow me to call one variable: someVariable and some_variable in other place |
21:35:53 | * | pregressive joined #nim |
21:36:09 | OnO | that could (possibly) lead to some strange errors |
21:36:41 | OnO | or maybe at least issue me a warning |
21:37:44 | * | mwbrown quit (Ping timeout: 245 seconds) |
21:40:26 | OnO | Jehan_: also regarding your answer on forum, can you please tell if colon is necessary for syntax disambiguation? |
21:41:45 | OnO | I don't really mind colon, but wish to understand better reason of its existence :> |
21:42:06 | Jehan_ | OnO: Simple example: "if foo 1 + 1" could be parsed as either "if foo(1): 1" or "if foo: 1+1" |
21:42:27 | Jehan_ | The primary reason it exists is the same as in Python. As a visual marker. |
21:42:38 | Jehan_ | Same reason we have punctuation in sentences, basically. |
21:42:42 | OnO | oh, sure this is clear for one liner |
21:42:57 | OnO | but if I use indent for block, is it really necessary? |
21:43:15 | polkm | so fowl, in your tests you wrote "face.indices[iii] " but when I do that I get "expression has no address" |
21:43:44 | Araq | OnO: there are ways to do without it |
21:43:48 | * | HakanD_ quit (Quit: Be back later ...) |
21:44:20 | * | Trustable quit (Quit: Leaving) |
21:44:54 | fowl | polkm, face here is a pointer (from above: let face = mesh.faces.offset(ii)) |
21:45:17 | OnO | Araq: so it could be optional, right? and Nim could let complainers to skip it |
21:47:42 | Jehan_ | OnO: Yes, but then you'd have multiple dialects. |
21:48:08 | * | OnO_ joined #nim |
21:49:21 | polkm | fowl, I coppied that line too, but am still getting the error, my code: http://pastebin.com/8HeBieW6 |
21:49:25 | reactormonk | for an s-expression serializer/deserializer, take the json module as example? |
21:49:59 | Jehan_ | I'm planning to have an FAQ for my own language that says that any requests for syntax changes have to be accompanied by a peer-reviewed study. :) |
21:50:49 | * | OnO quit (Ping timeout: 264 seconds) |
21:52:21 | Araq | OnO_: yeah, but there is always be a lighthouse, there is always a man, there is always a city |
21:52:22 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
21:53:38 | OnO_ | okay, fair enough, as I said, I don't mind colon, even I'd say I like it as it provides punctuation |
21:53:57 | Jehan_ | Ono: The guy also wants "then" as a keyword in lieu of the colon. Then someone will want "do" for while, and someone else prefers "then" for while instead (because consistency). |
21:54:30 | Jehan_ | At some point, someone has to make a decision. It's easier to learn a common language rather than having N different dialects. |
21:54:37 | OnO_ | Jehan_: if deferred RC is the one is default, why I see major speedup using M&S GC in my little benchmark? |
21:54:58 | Araq | because throughput != responsiveness |
21:55:45 | OnO_ | so M&S GC would cause regular hiccups or sthing? |
21:56:17 | Araq | exactly |
21:56:26 | Jehan_ | OnO_: Because you're dealing with a small heap, presumably. |
21:56:45 | Jehan_ | Or a heap that gets collected in its entirety. |
21:57:01 | Jehan_ | The bigger the "unchanging" part of a heap, the worse M&S gets. |
21:57:10 | pigmej | cu guys! |
21:57:23 | OnO_ | cya |
21:57:24 | Jehan_ | Because you have to do tracing work for it each time even though you aren't collecting it. |
21:58:31 | Araq | that said, M&S could do bulk deallocations more easily (but doesn't) |
21:58:49 | OnO_ | okie, but still I don't understand why RC suck so much, are there any autorelease pools or sthing like in ObjC |
21:59:46 | OnO_ | so we can defer deallocation once the response is completely over for this web example? |
21:59:53 | Jehan_ | DRC doesn't suck. |
22:00:14 | Jehan_ | But it has some overhead for small heaps that M&S doesn't have, such as a write barrier. |
22:00:36 | Jehan_ | On the plus side, it generally has less memory overhead than M&S. Or should. :) |
22:01:40 | Jehan_ | Basically, each time you write a pointer to the heap (or a global variable), the write barrier needs to update reference counts. That's a cost that the M&S collector doesn't have. |
22:03:28 | Jehan_ | Oh, M&S can also be slower for some simple programs for other reasons. |
22:03:44 | Araq | a pointer *in* the heap to the heap to be more precise |
22:04:21 | Araq | but async transforms stack allocations into heap allocations |
22:04:25 | Jehan_ | Araq: May have been unclear, but I meant writing a pointer to the heap. |
22:04:37 | Araq | so the pointers actually are in heap and not on the stack |
22:04:50 | Araq | and the write barrier gets expensive |
22:04:53 | Araq | for async |
22:05:50 | Jehan_ | Incidentally, if you build the Boehm GC for parallel mark and sweep, you can sometimes outperform both the built-in M&S collector and deferred reference counting. |
22:06:01 | Jehan_ | Pauses are still going to be long for multi-GB heaps. |
22:06:10 | * | bcinman joined #nim |
22:06:20 | Jehan_ | But it's useful for certain kinds of batch processing of data. |
22:07:05 | Araq | when we decided on this async implementation we had 2 ideas of how to do it |
22:07:06 | OnO_ | Jehan_: I just wonder if multi GB heaps will be a case for web service |
22:07:36 | Jehan_ | OnO_: It's what the Azul GC optimizes for, for example. |
22:07:45 | OnO_ | Jehan_: I don't see why you should handle more than N x CPU cores, where N is not so high constant |
22:08:06 | Araq | 1. do a continuation passing transformation in the compiler and don't touch the GC |
22:08:15 | Jehan_ | Depends on what you are doing in your backend. |
22:08:16 | OnO_ | just let other request wait till I finish what I am doing now |
22:08:34 | Araq | 2. implement a stack switching primitive and tell the GC a thread can have different stacks |
22:08:58 | * | transfuturist joined #nim |
22:08:59 | Araq | we picked (1). in retrospect (2) is likely to be much faster ... ;-) |
22:09:23 | transfuturist | does the dynlib pragma look up symbols at compile time? |
22:09:39 | Araq | transfuturist: no it does not |
22:10:06 | OnO_ | Jehan_: true, that can be many requests that will stall on IO in some services.. and can grow stack |
22:10:15 | transfuturist | so you can unload and reload the library, call the proc, and it'll use the new library? |
22:10:22 | * | polkm quit (Ping timeout: 246 seconds) |
22:10:31 | Araq | transfuturist: yep |
22:10:39 | transfuturist | not what i'm getting... |
22:10:43 | Araq | well with a little codegen patch, it can |
22:10:48 | Jehan_ | Araq: Well, stack switching might be painful with non-C backends. |
22:11:15 | Jehan_ | Depending on how C++ compilers implement exceptions, for example. |
22:12:44 | transfuturist | Araq: but the pragma has to be given a non-nil LibHandle? |
22:13:11 | Jehan_ | Also, it's worth keeping in mind that Stackoverflow/Stackexchange runs on some pretty modest hardware and is written in C#. |
22:13:13 | Araq | transfuturist: the pragma doesn't get any libhandles from your code |
22:13:43 | transfuturist | i was using symAddr/checkedSymAddr like in the opengl package |
22:13:54 | OnO_ | or have thread-groups with single GC and GIL? |
22:14:23 | Jehan_ | There are very few things that you need hyperoptimized code for. |
22:14:50 | transfuturist | {.pragma: ogl, dynlib: glGetProc(oglHandle, "0").} |
22:15:05 | transfuturist | where glGetProc boils down to symAddr |
22:16:01 | Jehan_ | Speaking of which, with the open-sourcing of Microsoft's .NET implementation, that may become an interesting alternative backend for Nim. |
22:17:02 | Araq | transfuturist: the openGL package uses undocumented DLL loading features and is nothing you should do in your code :P |
22:17:07 | transfuturist | >> |
22:17:25 | OnO_ | Jehan_: honestly I think LLVM would be nicer, at least if you want then to run code on GPU or sthing using LLVM numerous backends |
22:17:59 | Araq | not that much is lost in the C interim step. Nim -> C -> LLVM (clang) |
22:18:07 | Araq | vs Nim -> LLVM |
22:18:28 | Araq | the benefits of Nim -> LLVM are overrated |
22:18:53 | transfuturist | but does that mean that since the dynlib pragma uses a library path, it loads the library each time the proc is called? |
22:19:14 | Araq | transfuturist: no, it's loaded once on program startup for you |
22:19:20 | OnO_ | yeah I know, the only one I can imagine is better native debugging, or maybe handling multiple return values |
22:19:25 | Araq | and even the proc calls are resolved at startup |
22:19:35 | transfuturist | but, uh... then i can't load it or unload it at runtime |
22:19:40 | Araq | calling works by calling a global function pointer |
22:19:41 | flaviu | Araq: Proper exceptions and devirtualization are lost. |
22:20:14 | Araq | flaviu: we do devirt on our own, proper exceptions work with the C++ backend |
22:20:24 | renesac | Araq: talking abou the GC/allocator, would something like this be useful for Nim: http://stackoverflow.com/questions/23044153/sized-deallocation-feature-in-memory-management-in-c1y |
22:20:25 | renesac | ? |
22:20:43 | flaviu | Araq: does Nim do speculative devirtualization? |
22:20:45 | renesac | the dealloc funciton don't seem to take a size currently |
22:21:03 | transfuturist | how could hot swapping be implemented, in that case? |
22:21:22 | OnO_ | Araq: but LLVM would definitely make easier to have interactive REPL |
22:21:28 | Araq | transfuturist: by a codegen patch. not hard. |
22:21:43 | renesac | OnO_: people are making do with TinyC |
22:22:00 | Araq | OnO_: how so? the problems largely remain the same |
22:22:19 | renesac | *TCC |
22:22:38 | flaviu | http://blogs.msdn.com/b/oldnewthing/archive/2011/09/21/10214405.aspx is interesting. |
22:22:42 | Araq | flaviu: no. but then speculative devirt can also be done for function pointers, c++ methods have no advantage afaict |
22:22:57 | Araq | renesac: no benefit. |
22:23:00 | renesac | and yeah, "nim i" was implemented with the nim VM, but couldn't handle imports |
22:23:14 | renesac | or FFI |
22:23:16 | flaviu | Araq: But instead of Nim having it's own VM, it can use the known-correct and fast LLVM VM. |
22:23:48 | Araq | flaviu: that's only possible when you have no idea how we use our VM :P |
22:25:20 | Araq | how does LLVM's VM builds Nim's ASTs for consumption of the Nim compiler? that's the primary feature of Nim's VM. and of course little details like that are always happily ignored when you propose yet again the "tried and proven solutions" |
22:25:47 | EXetoC | you and your details :p |
22:26:07 | transfuturist | Araq: could you give me a couple more keywords? where is dlsym used? |
22:26:27 | transfuturist | like, cgen? |
22:26:40 | flaviu | Araq: Bytes are bytes. The compiler could be run as a library in the VM. |
22:28:28 | flaviu | Of course, the LLVM VM does have other issues, like performance. |
22:28:45 | flaviu | IIRC Julia has it's own interpreter because LLVM is too slow. |
22:29:10 | transfuturist | >known-correct and fast LLVM |
22:29:10 | OnO_ | you mean LLVM codegen being to slow? |
22:29:14 | transfuturist | >too slow |
22:29:19 | Araq | transfuturist: compiler/cgen.nim |
22:29:28 | OnO_ | because LLVM has no VM ;) |
22:29:35 | EXetoC | transfuturist: yeah, some people will want to do selective loading and querying |
22:29:47 | gokr | I would also guess Julia doesn't use LLVM since (again a little guess) its dynamically typed and LLVM doesn't seem too targeted at that. |
22:29:57 | EXetoC | actually, you could just omit that call then I think |
22:30:00 | renesac | Araq: what was the paper that you based nim's allocator? |
22:30:09 | OnO_ | gokr: no it is not dynamically typed |
22:30:32 | renesac | I remember you linking it to me, but I can't find anymore |
22:30:34 | Araq | flaviu: ah I see, so *if* Julia implements its own interpreter that's because of valid reasons, but if Nim does it, it's all wrong because you happen to know Nim's creator. |
22:30:39 | OnO_ | it is just functions are templates by default that get concretized before generating call instruction |
22:30:56 | transfuturist | kek |
22:31:03 | gokr | OnO_: Care to elaborate? |
22:31:10 | flaviu | Araq: Perhaps Julia's decision is wrong, I don't know enough. |
22:31:24 | Araq | your double standards are so annoying that I'm about to /ignore you. |
22:31:59 | OnO_ | gokr: if you define method with no types it behaves like a template, it does not emit any code, until it encounters a call with solid type |
22:32:25 | OnO_ | gokr: but in the end you have several "versions" for a method based on given parameters type |
22:32:38 | OnO_ | gokr: so it works exactly like in Nim |
22:32:45 | Varriount | flaviu: On the subject of that oldnewthing article, Yeah, quite interesting. |
22:33:04 | Varriount | It's one of the few things windows has that linux didn't |
22:33:08 | gokr | OnO_: http://stackoverflow.com/questions/28078089/is-julia-dynamically-typed |
22:33:19 | gokr | I would argue its dynamically typed. |
22:35:03 | gokr | Or just read here: http://docs.julialang.org/en/release-0.3/manual/types/ |
22:35:59 | * | johnsoft quit (Ping timeout: 265 seconds) |
22:36:56 | Jehan_ | If there's genuine interest, I can ask my officemate tomorrow, he's pretty deeply invested in Julia. |
22:37:38 | flaviu | Varriount: Just wait for kpatch :) |
22:37:50 | gokr | Jehan_: Its not hard to read the page I pointed at. |
22:37:57 | gokr | Its dynamically typed, period. |
22:38:13 | Jehan_ | gokr: Yeah, but from what I recall, that's not really the story of the implementation. |
22:38:29 | Jehan_ | Which I think is what people were talking about. |
22:38:30 | OnO_ | gokr: well... okay, you are right Julia as language is dynamically types, but the execution model uses static typing |
22:38:34 | Varriount | flaviu: There's a reason I used the word "didn't" |
22:39:03 | OnO_ | gokr: I mean machine code gets concretized for particular arguements |
22:39:37 | * | johnsoft joined #nim |
22:39:44 | gokr | OnO_: But you know, that's what a JIT does. |
22:39:45 | OnO_ | gokr: so... in many places Julia tend to use static typing, to avoid dynamic paths |
22:40:35 | OnO_ | gokr: not only JIT, in many places and many Julia libraries you prefer naming types or your method arguments explicitly |
22:40:47 | transfuturist | was the entire point of the dynlib package to provide support to opengl and similar? |
22:41:34 | OnO_ | gokr: I think Methods section describe it better http://julia.readthedocs.org/en/latest/manual/methods/ |
22:43:11 | OnO_ | so Julia's function are dynamic, where Julia methods are statically typed materializations of these dynamic functions |
22:44:19 | OnO_ | what is most sexy about Julia is that you can actyally dump machine code of such methods |
22:45:43 | gokr | My guess was that the "type specific" methods was simply a way to help the JIT to be able to generate more efficient code. |
22:46:30 | gokr | Their manualy clearly states only values have types and there is no meaningful concept of a "compile-time type". |
22:47:08 | gmpreussner|work | Varriount: i will update the PR when i get home tonight. thanks for taking a look! |
22:47:18 | OnO_ | but "compile-time" refers to time of compiling script, not the time when final machine code is generated |
22:47:44 | gokr | But anyway, Eliot Miranda who implements the Cog VM for Smalltalk has looked at LLVM and also came to the conclusion that its not really fitting for making a JIT for dynamically typed languages. |
22:47:55 | OnO_ | http://www.evanmiller.org/why-im-betting-on-julia.html |
22:48:27 | Varriount | gmpreussner: What version of Sublime Text do you use? |
22:48:30 | OnO_ | quite similar to LuaJIT with its tracing compiler |
22:48:51 | OnO_ | erm... tracing JIT compiler |
22:48:55 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:49:46 | flaviu | Huh, julia might be quite nice for learning assembler. |
22:51:08 | gokr | OnO_: Humhum, Julia does use LLVM. I thought someone said it didn't? |
22:52:49 | OnO_ | gokr: I am bit sleepy, but I think someone said that it has it's own interpreter which at some points generates LLVM then machine code |
22:52:56 | gokr | flaviu: Ah, it was you. |
22:53:04 | OnO_ | but it still needs interpreter to handle dynamic types |
22:53:07 | renesac | flaviu: I think I might make a feature request for the nim repl |
22:53:09 | renesac | XD |
22:53:40 | onionhammer | Varriount what was it you mentioned the other day about syntax |
22:54:11 | gokr | OnO_: As I have said all along - its a JIT. That uses LLVM for the final assembly generation. |
22:54:23 | renesac | it shouldn't be too difficult to do an objdump on the generated executable for a new function |
22:54:59 | * | fowl quit (Quit: Leaving) |
22:55:04 | OnO_ | gokr: yup |
22:55:17 | * | vendethiel quit (Ping timeout: 248 seconds) |
22:56:25 | OnO_ | renesac: you can do it with most compilers with -c -S -o -, would be easier than translating back from binary |
22:56:43 | renesac | indeed |
22:58:29 | OnO_ | okay guys, I am going sleep, that was great discussion, still lot of new things to learn about Nim... see you tommorow |
22:58:46 | gokr | cya |
22:58:57 | * | OnO_ quit (Quit: Textual IRC Client: www.textualapp.com) |
22:59:05 | Varriount | onionhammer: ST3 is getting new syntax definition format |
22:59:48 | Varriount | onionhammer: http://www.sublimetext.com/docs/3/syntax.html |
23:00:10 | Jehan_ | Varriount: I saw that, too. Can't be worse than the TextMate format. :) |
23:00:22 | Jehan_ | And I'm saying this is as someone who really likes TextMate. |
23:00:54 | Varriount | Jehan_: Well, the context mechanism should really help cut down on repetitive regexes |
23:01:32 | Jehan_ | Varriount: I may have to give Sublime Text a closer look after all. |
23:02:45 | * | Mimbus joined #nim |
23:03:30 | Varriount | Though, a built-in parsing feature might be better. :/ |
23:09:42 | * | buMPnet quit (Read error: Connection reset by peer) |
23:10:41 | * | buMPnet joined #nim |
23:12:03 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:28:29 | gmpreussner|work | Jehan_: sublime with NimLime is awesome |
23:28:53 | gmpreussner|work | i use it on all platforms now |
23:29:32 | Jehan_ | gmpreussner|work: I believe you, but I'm still heavily invested in Vim. |
23:29:44 | BlaXpirit | I'm heavily invested in Kate. |
23:30:01 | Jehan_ | Oddly enough, one of the major reasons is that on OS X that's one of the ways I can have focus-follows-mouse. :) |
23:30:07 | Varriount | Araq: Have you tried Arak? (The drink) |
23:31:45 | Araq | hrm ... I don't think so |
23:34:01 | gmpreussner|work | BlaXpirit: i stopped using Kate, because their GDB plug-in does not work with Nim (because of the way it communicates with GDB - the author is aware) |
23:34:10 | gmpreussner|work | even then, sublime is a better editor than kate, imho |
23:34:20 | BlaXpirit | why does it have to be GDB o.o |
23:34:30 | BlaXpirit | i mean, why is Kate even supposed to support it |
23:34:53 | BlaXpirit | i'm probably missing out. |
23:35:32 | gmpreussner|work | i like to step through my programs within the editor :) |
23:35:49 | BlaXpirit | yup, i'm missing out |
23:36:08 | gmpreussner|work | to be fair, i haven't tried it with sublime yet either, but i looked at their code, and i think it will work |
23:36:33 | Jehan_ | Hmm, does NimLine work with ST2 or do you have to get ST3? |
23:36:44 | Jehan_ | NimLime* |
23:37:23 | BlaXpirit | Jehan_, it can't not work with 2 |
23:37:43 | gmpreussner|work | i'm using 2.0.2 |
23:37:49 | BlaXpirit | pretty sure it's much older than any alpha version of sublime 3 |
23:37:58 | Jehan_ | I'm honestly not at all familiar with the ST ecosystem, and I know some stuff requires ST3. |
23:51:06 | * | TEttinger joined #nim |
23:54:39 | * | fungos joined #nim |
23:55:42 | transfuturist | Araq: is there more documentation on the compiler source besides http://nim-lang.org/intern.html ? |