<< 18-05-2015 >>

00:05:01*vikaton quit ()
00:05:42*pregressive joined #nim
00:14:20*wedowmaker joined #nim
00:21:25*johnsoft quit (Ping timeout: 264 seconds)
00:21:49*johnsoft joined #nim
00:40:13*dtscode joined #nim
00:44:26*vikaton joined #nim
00:45:05vikatonis the instllation process from github on linux add Nim to my path?
00:45:09vikatonwill the*
00:45:15dtscodeNo.
00:45:24dtscodeNot that hard to do manually though
00:50:45vikatondtscode, what would be added?
00:51:01dtscodeWhat do you mean what would be added?
00:51:52vikatonthe commands for the github installation
00:52:17*dtscode left #nim ("Leaving")
00:52:30*dtscode joined #nim
00:52:43dtscodeThe software you downloaded...
01:02:37vikatondtscode: If I have installed Nim from github, how can I add Nim to my path
01:03:28dtscodehttps://www.google.com/search?site=&source=hp&q=how+to+add+programs+to+path+linux&oq=how+to+add+programs+to+path+linux&gs_l=hp.3..0i22i30l4.1502.20598.0.20798.52.37.8.3.3.0.730.5392.2j23j2j2j6-1.30.0.msedr...0...1c.1.64.hp..16.36.4332.0.tjdkrNWdp88
01:06:13*Kingsquee quit (Quit: Konversation terminated!)
01:10:41dom96_vikaton: export PATH=$PATH:/path/to/nim/bin/
01:10:47dom96_vikaton: inside your .bash_rc
01:10:57dom96_or something like that
01:11:22vikatonthanks for the ping
01:12:12*Kingsquee joined #nim
01:17:09*Jehan_ quit (Quit: Leaving)
01:20:31*dom96_ quit (Ping timeout: 246 seconds)
01:20:46vikatongcc -c -w -O3 -fno-strict-aliasing -I/root/Nim/lib -o compiler/nimcache/compiler_nim.o compiler/nimcache/compiler_nim.c
01:20:46vikatonError: execution of an external program failed
01:20:46vikatonFAILURE
01:20:59vikatoner, any help why I have this?
01:21:46dtscodePost the command/entire output plz
01:22:14vikatonIm doing ./koch boot -d:release
01:22:23vikatonso the output is too large
01:22:30dtscodeNo its not
01:23:26vikatonhttps://www.irccloud.com/pastebin/XpscegbD
01:23:29vikatondtscode: ^
01:23:50dtscodeWhat gcc do you have also?
01:24:22vikatondtscode: gcc (Debian 4.7.2-5) 4.7.2
01:31:07ZZZZZZZZZuse --parallelBuild:1
01:31:15ZZZZZZZZZto be able to get the errors
01:31:40ZZZZZZZZZ./koch boot --parallelBuild:1 -d:release
01:31:57ZZZZZZZZZi think it might give you more precise error?
01:34:51vikatonhttps://www.irccloud.com/pastebin/GcgExcks
01:34:59vikatonZZZZZZZZZ: dtscode ^
01:36:16ZZZZZZZZZvikaton: no idea, but what happens if you run manuall gcc -c -w -O3 -fno-strict-aliasing -I/root/Nim/lib -o compiler/nimcache/stdlib_system.o compiler/nimcache/stdlib_system.c
01:36:41ZZZZZZZZZ(the line that seem to fail)
01:36:49vikatonnothing happened
01:37:08vikatonZZZZZZZZZ: does that mean it worked or?
01:37:26ZZZZZZZZZprobably lol
01:37:34ZZZZZZZZZi mean
01:37:37ZZZZZZZZZnot the complete build
01:37:58ZZZZZZZZZbut if you look at compiler/nimcache/stdlib_system.o it should be there
01:38:05ZZZZZZZZZand before it probably wasnt there
01:39:01ZZZZZZZZZtry running it again i guess? i dont know if it will try to rebuild it from scratch or what
01:39:29ZZZZZZZZZprobably will keep it cached and it will work..
01:39:38federico3dom96: thanks, I found a pdf, albeit outdated
01:41:00vikatonlemme see
01:41:21vikatonstill fails :(
01:41:27ZZZZZZZZZwith the same line?
01:41:41ZZZZZZZZZon nimcache stdlib_system
01:45:45*darkf joined #nim
01:56:49vikatonyeah ZZZZZZZZZ
01:57:08ZZZZZZZZZi give up!
01:57:12ZZZZZZZZZlol
02:00:59VarriountZZZZZZZZZ: What's going on?
02:01:22vikatonIll try tomrrow I gues
02:01:27ZZZZZZZZZo i meant i give up on helping vikaton
02:01:34ZZZZZZZZZVarriout: ^
02:01:35Varriountvikaton: What's wrong?
02:02:01vikaton'Varriount My Nim installation from github wouldt work
02:02:06vikatonhttps://www.irccloud.com/pastebin/GcgExcks
02:02:13Varriountvikaton: Are you booting using a csource binary?
02:02:43vikatonim not sure
02:03:22Varriountvikaton: Try downloading and compiling this: https://github.com/nim-lang/csources
02:03:54VarriountThen use that to boot a Nim comprised of code from the *devel* branch.
02:04:07vikatonhmm
02:05:03VarriountIf you're trying to boot master, use the 'master' branch from the csources repo
02:05:25Varriount(and the 'master' branch from the Nim repo)
02:15:56federico3I suggest asciidoc as a format for documentation
02:19:06Varriountfederico3: Your suggestion is a bit late, unless you want to write an asciidoc backend for nimdoc.
02:19:43federico3Nimdoc or koch?
02:20:15Varriountkoch invokes nimdoc
02:28:31federico3Tnx, I'm looking at its docs. Implementing asciidoc input and also output might be doable
02:30:12Varriountvikaton: Ping
02:30:34vikatonVarriount: pong
02:31:04Varriountvikaton: Were you able to resolve your problem?
02:31:16vikatonNot yet, I will tomorrow :P
02:45:12vikatonis Nim planning on compiling directly to LLVM >
02:45:13vikaton?
02:48:25*BitPuffin|osx quit (Ping timeout: 255 seconds)
02:50:43Varriountvikaton: Not likely.
02:51:13*fowl quit (Excess Flood)
02:51:20VarriountOr rather, there's nothing stopping others from working on a backend, but there's no plan for one either.
02:51:44*notfowl joined #nim
02:51:44*notfowl quit (Excess Flood)
02:52:12vikatonI see
02:52:44*notfowl joined #nim
02:53:27Varriountnotfowl: Stop not being here :<
02:55:44notfowldo you need me
02:57:02vikatonso let me get this straight
02:57:08vikatonNim outputs C
02:57:14vikatonbut does not compile to it?
02:59:00notfowlvikaton: those are the sam
02:59:16vikatonmh
02:59:25notfowlNim is not a c compiler
02:59:56vikatonYes I know that
03:01:51notfowlI don't understand your question
03:04:38vikatonI think I recall someone saying
03:05:06vikaton"Nim doesn't compile down to C, it outputs it which is then compiled by gcc"
03:13:21notfowlWell it also invokes the c compiler. I would call it a series of data transformations starting at Nim syntax and ending with an executable
03:14:54*superfunc joined #nim
03:32:07*superfunc quit (Ping timeout: 246 seconds)
03:33:31*Perelandric quit (Ping timeout: 246 seconds)
03:37:55*dtscode quit (Ping timeout: 255 seconds)
03:44:13*dhasenan quit (Remote host closed the connection)
04:12:16*johnsoft quit (Ping timeout: 258 seconds)
04:13:08*johnsoft joined #nim
04:19:58*gamesbrainiac joined #nim
04:24:25*Sornaensis quit (Ping timeout: 264 seconds)
04:25:49*intra quit (Ping timeout: 256 seconds)
04:26:29*Sornaensis joined #nim
04:40:49reactormonkvikaton, it's a transcompiler. I would say nim compiles to C.
04:47:00*transfuturist quit (Quit: Lost terminal)
05:03:53*dhasenan joined #nim
05:07:59*pregressive quit (Remote host closed the connection)
05:08:31*pregressive joined #nim
05:13:13*pregressive quit (Ping timeout: 258 seconds)
05:21:53*jbomo quit ()
05:33:40*gamesbrainiac left #nim ("Bye folks!")
05:38:55*endragor joined #nim
05:40:47*intra joined #nim
05:48:52*elbow_jason joined #nim
06:13:54*NimBot joined #nim
06:43:11*yglukhov_____ joined #nim
06:43:13*yglukhov_____ quit (Remote host closed the connection)
06:43:48*yglukhov_____ joined #nim
06:59:20*BlaXpirit joined #nim
07:04:13*dddddd joined #nim
07:05:38*endragor_ joined #nim
07:09:35*endragor quit (Ping timeout: 256 seconds)
07:11:17*intra quit (Ping timeout: 258 seconds)
07:17:32*Ven joined #nim
07:19:34*endragor_ quit (Remote host closed the connection)
07:19:55*Ven quit (Client Quit)
07:23:18*Ven joined #nim
07:24:33*bjz joined #nim
07:28:53*pregressive joined #nim
07:29:20*bjz quit (Client Quit)
07:32:01*ingsoc joined #nim
07:33:23*pregressive quit (Ping timeout: 256 seconds)
07:38:58*borisv joined #nim
07:39:28*d3m1gd quit (Ping timeout: 244 seconds)
07:40:15borisvHello again... on the topic of declaring arrays: if I understand correctly, there is currently no way to declare an array and initialize every element with a value _different_ from the default value for the type, is that so?
07:40:46BlaXpiritborisv, u can definitely do that with seq
07:44:52borisvBlaXpirit: are we talking about arrays, as in `var a = array[0..5, int]`? How would I write this?
07:48:03borisvI don't know if it is bad form to give examples from the standard libraries of other languages, but how could I say the equivalent of `std::vector<int> a(6, 3);` (C++: an array of 6 integers with initial value 3)
07:51:07borisvMy question is a follow-up of a closed issue on github (#2462). It was closed after merging pull request #2701, but this pull request only provided an implementation for a `fill`, which fills an array after declaring it. Obviously, one would often want to be able to fill the array as it is declared, hence my question.
07:51:54*d3m1gd joined #nim
07:53:54BlaXpiritwelp, i don't see anything
08:11:13*endragor joined #nim
08:12:24*Trustable joined #nim
08:14:48*OnO joined #nim
08:14:51notfowlWe have a newseq like that
08:15:06BlaXpiritthat's what i thought
08:15:07notfowlVector is closer to seq that array
08:15:41BlaXpiritexcept i can't find it
08:15:46*coffeepot joined #nim
08:15:54borisvBlaXpirit: http://nim-lang.org/docs/sequtils.html
08:16:28borisvand http://nim-lang.org/docs/system.html#newSeq,seq[T],Natural
08:16:38notfowlCalled newseqwith
08:16:53BlaXpiritand where is it?
08:17:11BlaXpiritah template :|
08:18:41borisvnotfowl: so, what I am looking for is simply `var a = newSeqWith(6, 3.int)`?
08:19:50notfowlIf you want something like an std::vector instead of an array yes
08:20:40borisvand now `a` is a _sequence_, ie it is dynamic and lives on the heap etc
08:21:27notfowlborisv: see on the doc the link it says view source or something. Check it out. Its not black magic
08:21:54notfowlSeq is on the heap yes
08:22:00notfowlResizable
08:23:22borisvnotfowl: no, not black magic. just trying to figure out what is the "idiomatic" way to do things in nim. It is never easy to get started with a new language, particularly because of the weird ways that names are used in subtly different ways
08:24:29borisvthe `vector` in STL should have been called an `array`, and now it seems that nim's `sequence` is the C++ `vector` is the `array` which is not just a chunk of memory....
08:27:38*filwit quit (Ping timeout: 256 seconds)
08:29:37BlaXpiritborisv, note that there is an `array` in C++ standard library
08:30:01BlaXpiritand indeed seq is like C++ vector
08:32:35borisvBlaXpirit: it took me a while to digest this, but now I get it
08:32:56notfowlIt has similar semantics
08:33:23notfowlUnless its marked shallow, assignment does a copy
08:33:41*OnO quit (Quit: Textual IRC Client: www.textualapp.com)
08:34:55*pipeep quit (Ping timeout: 248 seconds)
08:34:57*elbow_jason quit (Ping timeout: 240 seconds)
08:37:25borisvnotfowl: yes, I did try it. For both `array` and `sequence` assignment makes a copy.
08:38:03*pipeep joined #nim
08:39:56*n1ftyn8 quit (Ping timeout: 276 seconds)
08:41:18*n1ftyn8 joined #nim
08:42:32*CARAM__ quit (Ping timeout: 276 seconds)
08:44:29*mikolalysenko quit (Ping timeout: 276 seconds)
08:45:19*CARAM__ joined #nim
08:46:16*mikolalysenko joined #nim
08:47:45*TylerE quit (Ping timeout: 276 seconds)
08:48:06*TylerE joined #nim
08:48:14*borisv quit (Quit: Leaving)
08:50:55*Demon_Fox quit (Quit: Leaving)
08:57:38*endragor quit (Read error: Connection reset by peer)
08:58:08*endragor joined #nim
09:01:27*yglukhov______ joined #nim
09:03:37*yglukhov_______ joined #nim
09:03:37*yglukhov______ quit (Read error: Connection reset by peer)
09:05:14*yglukhov_____ quit (Ping timeout: 264 seconds)
09:20:53*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:35:14*Kingsquee quit (Quit: Konversation terminated!)
09:37:08*yglukhov________ joined #nim
09:37:08*yglukhov_______ quit (Read error: Connection reset by peer)
09:37:23*yglukhov________ quit (Remote host closed the connection)
09:37:56*yglukhov________ joined #nim
09:44:31*Kingsquee joined #nim
09:57:18*BlaXpirit quit (Quit: Quit Konversation)
10:05:41Araqreactormonk: ffs there is no such thing as a "transcompiler" or "transpiler". It's called a "compiler".
10:08:15Araqyou can say that a source-to-source-translator is not a compiler as the output is meant for human consumption then, but that's not what Nim aims for. It is a compiler.
10:14:07*OnO joined #nim
10:14:36AraqOnO: noSideEffect is not designed to map onto GCC's pure
10:14:47OnOhi
10:15:15OnOsure, that's why I wonder if you should bring some extra pragma for that
10:15:28OnOlike cPure or sthing
10:15:29Araqand the point of the effect system is safety/security, not efficiency. these things are rather easy compute in an optimizer anyway
10:16:35OnObut I hope you understand my concerns, that we need to have a means to issue GCC ((pure)), otherwise optimizer will not be able to remove calls to foreign API
10:16:44Araqthough it's true that common compilers are stupid in this respect, looked at visual c++ recently, it's really bad at it
10:17:56OnOyeah, GCC is not good either, if you bring any pointer then ((pure)) is no longer effective, eg. if using non-inline Nim iterator
10:18:11AraqOnO: Nim should remove these calls, not GCC
10:19:04OnOhonestly I don't see how, because it would need to trace inline calls too
10:19:35Araqthis should be done with a TR macro
10:20:23Araqbut again, how do you gather the fields?
10:20:46OnOwell... imagine this: for user in User.where(...): if logged(user): echo user.name & " is logged"
10:20:51OnOlogged is user defined proc
10:21:19OnOwhere is my macro, but the stmt containst logged() call, I cannot trace what happens there
10:21:22OnOnot at this point
10:21:32OnOAraq: I gather fields just reading object record
10:21:37OnOright now
10:22:10Araqso somewhere I have to do type User = object id, name, pass: string ?
10:22:35OnOno.. that's the whole point you don't need to
10:22:56Araqhrm? so how does it work?
10:23:00OnOI just want to bring "old well known" ORM into Nim, as in ActiveRecord for example
10:23:10OnOcurrently it gets ALL fields of the model
10:23:14AraqI never used ActiveRecord
10:23:51OnObut I want to infer that from the user's code, so only fields that are used should be loaded
10:24:10OnOas long user calls only other inline procs it is possible in theory
10:24:19OnOhttps://github.com/nanoant/nim-orm/blob/master/orm.nim
10:24:21Araqso how does it get ALL fields?
10:24:46OnOrecList = T.typeNode[1].getType[1]; for node in children(recList): result.add("`" & node.repr & "`")
10:27:24Araqok, so via getType, that does mean I need to have 'type User = ...' somewhere in my code
10:28:59Araqand I also need to inherit from 'Model' for this, yikes
10:31:18Araqin LinqToSQL I tell the IDE where to find the database and then I can drag and drop what to import into C#, so these classes are all generated. Now that sucks for different reasons, but I still think we should generate these types from the DB at compile-time
10:31:19OnOyes, your model type has to inherit from model
10:31:39OnOyou don't need to declare anything because "user" if passed from iterator: for user in User.where(...):
10:32:18Araqwhere does User with capital U come from though?
10:32:25OnOAraq: it is supposed to work other way around, you define your DB model only in Nim code, there is absolutely no SQL in your code
10:32:49OnOORM should set up you tables and everything using your model class definition
10:32:56*TEttinger joined #nim
10:32:58Araqaha, ok, so you avoid the problem of having 2 definitions by generating the SQL
10:32:59*Ven joined #nim
10:33:05OnOof course
10:33:09Araqmeh ;-)
10:33:19OnOone code to rule them all ;)
10:33:36Araqthat's why people say ActiveRecord is not good when you already have existing DBs
10:33:49OnOsure, I don't care about that
10:34:02Araqbut I do :-)
10:34:08OnOI want to make Nim high level general purpose solution
10:34:32OnOAsync HTTP, HTTP builder + ORM will be killer to Ruby Rails ;)
10:34:55Araqbut we don't need to kill Rails. It's already dead :P
10:35:24strcmp1you could dig its grave
10:35:25OnObelieve me its not, I am working with some new project and they still use Rails to make new webapps
10:35:42OnOwhat are the alternatives anyway
10:35:42OnO?
10:35:57AraqNode.js, dunno
10:36:21strcmp1there's a lot of alternatives, even inside ruby itself
10:36:25OnOwell, it serves bit different purpose, node.js tries to bring similar webframeworks, but I think Rails is still most used one
10:36:48OnOstrcmp1: indeed, but all of them follow the same ORM paradigm
10:37:17OnOI don't think Rails was the first to ORM, but it did indeed make it kind of standard
10:37:28Araqwell linqToSql works differently and is used too
10:37:33OnObefore you were coding all this shitty SQL resulting in spaghetti code
10:37:37vikatonRails isnt dead :P
10:37:39vikatonyet
10:37:52vikatonstill #1 Framework
10:38:23strcmp1rails puts too much focus on productivity/convenience, and not enough on performance, that's where it will fall down imo
10:38:26OnOAraq: honestly lingToSql isn't conceptually different from ORM solutions
10:38:36Araqbut it is.
10:38:39vikatonUse Lotusrb
10:38:46vikatonIts like Rails but MUCH faster
10:38:47Araqwe just figured out how it's different
10:38:51vikatonhttp://lotusrb.org
10:39:10strcmp1yeah, im familiar with it, it feels a little wrong to discuss such things in #nim :p
10:39:55vikatonAraq, have you ever told github to rename Nim?
10:40:43OnOAraq: anyways, going back to the subject :P any ideas how to optimize DB to model loads ? I was also thinkging about something like: Field<Type> to do lazy load, but I think it is mess
10:40:58OnOand it is nothing better than in other languages
10:41:04OnOthe trick is to do it at compile time
10:41:12OnOnot at runtime
10:41:21AraqOnO: well I told you how to do it better than in other languages, but you disagree
10:41:25coffeepotcan we annotate object fields to tag them as db fields?
10:41:34Araqthe thing is:
10:41:59OnOAraq: if you tell me how I can trace dot access in statement passed to macro :)
10:42:15OnOincluding dot access in called inline procs ..
10:42:21Araqtype Foo = object id {.primaryKey.}: int etc. is nice but ultimately toyish
10:42:31Araqcoffeepot: yes we can but read on
10:42:35coffeepot:)
10:42:56Araqyou end up reinventing LOTs of annoations in Nim that SQL already provides
10:43:08Araqlike indexes etc
10:43:16Araqor even character set settings
10:43:36Araqand at the end of the day most companies *already* have a database model
10:43:51Araqso it should be generated from the existing model
10:44:16coffeepot"reinventing SQL" i've been there :( completely agree. ORM is a tricky beast to design more than code
10:45:37OnOAraq: I don't care, I want a tool for new projects, not for adapting existing databases
10:46:04Araqyes but then you use the database as some dumb datastore
10:46:25Araqmany prefer to use the database as a database
10:46:37coffeepotI prefer ORM from a DB to code direction myself, purely because a) when I end up using ORM I already have a DB. This makes it more complex though because sometimes DBs are a mess and b) whilst it makes it simpler and removes some edge cases you're constraining the DB by the ORM. Sorry not providing a soluting, just thoughts :D
10:46:46OnOnope, I just want to replace SQL with the native language
10:46:53OnOthis is proven to work in many projects
10:47:05OnOthat was the reason of Rails success
10:47:23OnOwith Nim I believe we can do it better, at least more performance-wise
10:47:39Araqdon't give me these meta-reasons please.
10:48:16coffeepotwhy can't we have both?
10:48:30OnOwhy to refuse them? this isn't a hype, ORM has proven to be just effective
10:48:41coffeepotcreate DB from object template, and maybe access db via dictionaries of field metadata or something
10:49:03AraqOnO: and yet here you are and want to improve upon them.
10:49:46OnOAraq: I've already worked in Rails camp couple years ago, also using other solutions like Sinatra, etc. etc.
10:50:10OnOthere's nothing to improve there because they already work great
10:50:35OnOyet the rely on the languages that are not so much optimizable as Nim is
10:50:54Araqthey don't work well for lots of use cases. Like when you already have a database and data.
10:50:58OnOwith Nim you can reach bare metal, with Python or Ruby hardly
10:51:18Araqit's not about ORM vs no-ORM here
10:51:30Araqit's about whether to read in an existing model
10:51:46Araqor to generate the model from Nim code
10:51:59OnOI don't refuse to see that there are existing solutions and existing databases, and some devs that will prefer to work with SQL
10:52:39Araqwell back to the point: I want to read the model from the database, you don't. ok, too bad, but it's you who's doing the work.
10:52:42OnOif they will migrate from other ORM solutions then they definitely will NOT generate model out of SQL that was generated out of their other-language-model
10:54:00OnOAraq: this is somehow side-subject, if you want to do it your way - model out of existing DB, then you will still need to know which fields to read, which to skip
10:54:03coffeepotis it not possible to be able to build a model in code to create/access the DB, but also be able to read in metadata to build the model too?
10:54:35OnOmy interest is to limit data read from DB only to this actually referenced in the code itself
10:54:52OnOit doesn't matter where the model came from
10:55:43OnOeven it does not matter if we use objects or just dictionaries
10:56:42Araqcoffeepot: sure that would be the ultimate solution, but that seems rather unrealistic at this point
10:57:38OnOI don't see any problem to create a tool that will migrate existing SQL database to ORM solution
10:58:44Araq"migration" is the keyword here. you don't want that. DB migration is a pain in the ass and not always possible.
10:58:55coffeepotAraq yes, fair enough. OnO What would actually need to change to 'migrate to an orm solution'?
10:59:03Araqbut ok, back to the original problem
10:59:47Araqso ... I have a User object but that's complete (because the model is generated from it ;-) ) and so lots of redundant stuff is read from the DB
10:59:47OnOcoffeepot: reason is to keep all to application logic and model in same place and same language
11:00:01OnOAraq: yes
11:01:38Araqso one easy way is to make people use another UserTemp object with just the fields that are required
11:02:35Araqbut that's not convenient of course
11:05:50*notfowl quit (Excess Flood)
11:06:44*notfowl joined #nim
11:07:28AraqOnO: in general, if you need more overview, you need to do
11:07:31Araqorm:
11:07:40Araq for u in User.select(...):
11:07:50Araq if u.name == "abc": ...
11:09:12Araqthis way you can also transform the 'if' into a 'where' clause and merge it with the select
11:09:32Araqbut it's harder to implement, of course
11:10:33OnOnice idea
11:11:19OnOfor u in User: if u ....: ...work.. instead of for u in User.where(...): ...work..
11:30:56Araqalternatively you can leave it as it is and make the 'orm' block perform the optimization on a typed AST
11:31:32Araqand warn or error if you pass the full 'u' around: Warning 'u' escapes analysis, leading to inefficient code.
11:32:23AraqI think that's how I'd do it.
11:32:47OnOI understand, I'll try to do it this way then
11:33:20OnOalso I will add some API to specify fields to be fetched explicitly
11:33:43OnOAraq: but I've question, any way to force inlining some procs at Nim level, not C level?
11:34:03Araqtemplate does that
11:34:08OnOyeah.. ok
11:34:10OnOgood point
11:34:16Araqbut with slightly different semantics ofc
11:34:30OnOa warning: u escaped analysis, consider using templates
11:34:33OnOgood
11:34:56OnO"u escaped analysis, consider using templates or manually specify fetched fields"
11:35:16Araqyeah that's cool
11:37:03*dddddd quit (Ping timeout: 256 seconds)
11:38:27*OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…)
11:38:35Araqthere is another builtin planned, 'getImpl' to inspect the AST of passed procs/iterators/consts etc
11:38:59Araqyou could use that to inspect the AST of inline procs
11:39:11Araqbut it doesn't exist yet ;-)
11:57:09*pregressive joined #nim
11:57:30*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:00:58*Ven joined #nim
12:14:05*boopisaway is now known as boop
12:14:46*bluenote_ joined #nim
12:23:49*Kingsquee quit (Quit: Konversation terminated!)
12:34:40boopi'm not convinced that TSECURITY_ATTRIBUTES works on createPipe()
12:35:15boopwindows.h has the signature as a ptr LPSECURITY_ATTRIBUTES but winlean doesn't
12:36:50boopor er, LPSECURITY_ATTRIBUTES is a ptr SECURITY_ATTRIBUTES, which is what winlean's TSECURITY_ATTRIBUTES is
12:39:14*d3m1gd left #nim ("WeeChat 1.1.1")
12:46:05ingsocare there plans for a multicore aware concurrency feature like Go's goroutines ?
12:47:03Araqwhy plans? 'spawn' already exists
12:48:02emilspingsoc, doesn't the beauty of Go's concurrency stem from the 'channels' ? goroutines are basically static functions, right ?
12:48:16ingsocok yess
12:48:18ingsocchannels
12:49:14ingsocok, a mechanism for lightweight independently running synchronous threads of execution that can automatically utilise multiple cores
12:49:38emilspthat requires a runtime, though
12:49:59*darkf quit (Read error: Connection reset by peer)
12:50:13ingsocthere has been a library for scala/java called akka
12:50:19ingsocthat kind of does soem,thing similar
12:50:22ingsocsomething
12:50:35*darkf joined #nim
12:58:51*NimBot joined #nim
13:01:08ingsoc emilsp: btw goroutines are the fundamental unit of concurrency. channels are a mechanism for communication between them.
13:05:01emilspingsoc, okay.
13:05:08*wilinando joined #nim
13:05:20*wilinando quit (Client Quit)
13:05:30emilspingsoc, I hate living in interesting times, I don't have nearly enough time to get my head around half of what I want to look into
13:05:53ingsocemilsp: I totally sympathise there
13:06:06ingsocclient side web dev is even worse
13:06:10ingsocatm
13:07:50*yglukhov________ quit (Ping timeout: 272 seconds)
13:08:22*Aszarsha joined #nim
13:08:25Araqingsoc: so how many cores does your CPU have?
13:08:40ingsoc8 hw threads
13:09:02ingsocthats a 3 years old laptop
13:10:17ingsocin my opinion looks more interesting and immediately useful than go or rust etc.
13:10:23Araqand how many does your GPU have?
13:10:25ingsocNim looks*
13:10:54ingsocthere are a case of problems like network servers where the goroutine abstraction or erlang process can prove to be very useful
13:11:41ingsocespecially with the ability to utilise all cores pretty easily without major code changes or introducing possible major bugs
13:11:59ingsocthat is the only point i am making and was just curious that was all
13:12:07ingsoci have no idea what all you guys are using nim for
13:12:28ingsocbut to be able to write something like nginx in nim with comparable performance
13:13:07ingsocwith much more concise code etc. seems interesting
13:13:31*yglukhov________ joined #nim
13:14:03Araqyeah ofc but IMHO it's much more interesting to look at how we can harness the power of GPUs
13:14:06emilspingsoc, you have to make sure that every thread is 'safe', which is easy to achieve in erlang, but nim gives you freedom
13:15:05emilspAraq, for serverside web 'applications' the gpu sits too far away from sockets to be useful, most of the time would be spent on moving data back and forth to/from the gpu
13:15:25ingsocAraq: are GPU's suitable for general purpose parallelism of or is it suited to only certain computational code ?, i have never coded for GPU's
13:15:25Araqemilsp: there are setups to avoid this
13:15:43coffeepotAraq. are you thinking of some kind of CUDA library for Nim, or just generally utilities to harness the parallelisation of GPUs for general work behind the scenes?
13:15:53coffeepoteither way, damn awesome
13:16:55emilspAraq, yes, but even then, it's a SIMD arch, where the paralelism is 'synchronous' to an extent, whilst most web backends are very asynchronous in nature.
13:17:29emilspand still, most web applications are bottlenecked by IO, not compute perf
13:17:58Araqwhich means it's rather pointless to have them run on more than 1 core ... ;-)
13:18:08coffeepotI'm doing a physics module atm for my own projects, but i was considering down the line of using OpenCL for this internally. It'd be amazing if there were a generalised way in Nim of accessing the GPU
13:18:35ingsocAraq: Not true
13:18:59Araqingsoc: why not?
13:19:55*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:20:05emilspAraq, no, the idea is that multiple threads do multiple things, one for accepting connections, one for dealing with the database, and then some small computation and returing data to the socket
13:20:23emilspso, with go, you get thread pools for each operation
13:20:48ingsocAraq: I will give erlang as the example as it gets concurrency correct but is not compiled to machine code and so is an order of magnitude slower in exectuion (at least) to native c, althoguh apparently there is a JIT in the works which could improve this situation somewhat. Anyway, regarding concurrency
13:20:59def-coffeepot: I guess that's the plan: https://github.com/Araq/Nim/wiki/GSoC-2015-Ideas#add-a-code-generator-for-opencl
13:21:00emilspso you don't block where you don't need to block
13:21:20ingsocwhen erlang VM starts it queries the system for the number of cores/hw threads in the machine
13:21:21boop...
13:21:23boopit wooorks
13:21:23emilspdef-, opencl is so old school, vulkan/spirv is where it's at
13:21:26Araqemilsp: I don't need explanations of how Go works. Thanks.
13:21:27ingsocit then starts a OS thread for each core
13:22:02emilspAraq, sorry for showing disrespect, no offence was intended
13:22:28Araqthe question was: When you're IO bound, why pretend you're CPU bound?
13:22:28ingsocAraq: should i refrain from an erlang one too >?
13:22:32ingsoc:D
13:22:43ingsocui haven't finished yet
13:23:31*vikaton quit (Quit: Connection closed for inactivity)
13:24:02coffeepotdef- wow... that would be absolutely incredible. So we could write shaders directly in Nim, too! Kind of a game changer from both gamedev and scientific computing. Wish I was knowledgable enough to help with that.
13:24:25LoneTechAraq: the main reason I can think of is to use the same code techniques to deal with concurrency and asynchronous behaviour
13:24:32ingsocthere are benefits of the process/goroutine abstraction for non CPU bound problems (e.g. IO) as well
13:24:39Araqemilsp: def- optimized our HTTP server by getting rid of some 'await'. In other words, introducing *more* blocking.
13:24:41ingsocthings like nodejs use callbacks everywhere
13:24:52ingsoci see has the await (borroed from c#)
13:24:59ingsocwhich is an improvement
13:25:06emilspAraq, have you load tested it ?
13:25:16ingsoci see Nim has await i meant
13:27:19def-emilsp: the tests were documented here: https://github.com/def-/nim-http-speedup
13:28:26dom96Araq: Surely if it was just IO bound then throwing extra threads at it would not increase the requests per second.
13:29:04ekarlsodef-: is ^ async or ?
13:29:24def-ekarlso: i don't understand the question
13:29:35ekarlsothe perf tests, async http server or ?
13:29:37Araqdom96: the benchmarks are not IO bound afaict. The requests come from the same machine.
13:29:46def-ekarlso: mostly yes, also includes some other stuff
13:30:13emilspdom96, the idea is to seperate requests, so blocking requests never hinder nonblocking requests, which is already implemented, afaik
13:30:14dom96Araq: does that mean that the benchmark is incorrect?
13:30:40Araqno, it's not. it has nothing to do with reality though.
13:31:32Araqthe test shows that with > 100K req/s it's getting CPU bound. perhaps. I dunno really.
13:31:41*banisterfiend quit (Read error: Connection reset by peer)
13:33:26dom96Well, i'm confused, because benchmarking it on my laptop puts it above Golang.
13:33:47Araqlol I don't care about the results
13:34:19dom96Perhaps I should create a Digital Ocean VPS to benchmark things properly.
13:35:02*BitPuffin|osx joined #nim
13:35:52AraqIME nobody has problems that are reflected by these benchmarks.
13:36:36Araqyou might as well benchmark your CPU by making it run 1 million add opcodes with no other instructions in between
13:39:09coffeepotI'm surprised the web framework benchmarks aren't built around serving a standardised test blog tbh, was quite surprised at the fuss of people ranking how many empty requests a framework can do, though I guess it shows how fast it can do the minimum work
13:43:47Araq"Removed from OpenCL C++ are features like allocation and releasing of memory, virtual functions, abstract virtual classes, function pointers, goto, and other changes that don't work too well in a parallel computing environment".
13:45:35boopdom96: poke? have async piping working on windows for osproc, but it needs to be specified before the process is started
13:45:47boopany preferences for how it should be structured?
13:51:03ingsoca parallel version of asyncnet (one using http://nim-lang.org/docs/asyncdispatch.html) would be interesting if this is possible to see what overhead there is to using that module as it gets rid of the majority of boilderplate code dealing with socket polling and callback management, also why is it stated that it is "(broken anyway)" in the results
13:51:32ingsocdef-: ^
13:51:41ingsocbut yea it isn;t really a real world test
13:52:17ingsocif you then call a DB driver to query a DB during a call and that API is synchronous (blocking) then you have stalled the server no ?
13:52:41ingsocuntil DB responds and no other web requests will be responded to until that time
13:52:53Araqright, that's why you need to spawn the DB call
13:53:03ingsocso a db server thread pool
13:53:18ingsocand then pass them and match them up to the calling socket client on response from db
13:53:41ingsocok
13:54:19emilspingsoc, this problem is usually solved by a framework, not a standard library
13:54:21ingsoci think there is a non-blocking option as well in the postgresql db driver
13:54:29ingsocpossibly, i dunno
13:54:38dom96boop: hrm, dunno. Just do it whatever you think is best and let us review it.
13:54:38ingsocyeah true
13:55:37ingsocso what the hell is jester doing ? is this not even using async io ?
13:56:17ingsocjust req/resp, serving each connection sequentially ?
13:56:45boopdom96: how many idioms does passing an "async" bool to startProcess break? :)
13:57:34def-ingsoc: well, the general order should be right.
13:58:43*yglukhov________ quit (Remote host closed the connection)
13:59:16*yglukhov________ joined #nim
13:59:33*intra joined #nim
14:00:02*BlaXpirit joined #nim
14:03:14dom96boop: I would prefer an async type.
14:03:26boopsubtype? yeah.
14:03:28*boop nods.
14:03:35boopstill getting used to nim idioms
14:04:34*saml joined #nim
14:11:29*darkf quit (Quit: Leaving)
14:22:25*bjz joined #nim
14:27:53*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
14:28:10*bjz joined #nim
14:28:23*bjz quit (Client Quit)
14:29:23*gokr quit (Quit: Leaving.)
14:30:10*bjz joined #nim
14:36:29*vikaton joined #nim
14:38:46*OnO joined #nim
14:45:04*Aszarsha quit (Remote host closed the connection)
14:48:07*yglukhov________ quit (Quit: Be back later ...)
14:57:06*Perelandric joined #nim
14:59:49*OnO quit (Ping timeout: 264 seconds)
15:18:08*gyeates joined #nim
15:21:33*boop is now known as boopisaway
15:24:12*renesac joined #nim
15:24:40*banister joined #nim
15:34:22vikatondoes Nim have non-blocking I/O
15:35:55samlyes
15:36:12samlhttp://nim-lang.org/docs/asyncio.html
15:36:23samllooks like depreacated
15:36:27samluse asyncdispatch
15:37:17*dddddd joined #nim
15:37:29vikatonhmm
15:38:22*bluenote_ quit (Ping timeout: 246 seconds)
15:57:42*Arrrrr joined #nim
15:58:58ArrrrrHI
15:59:54*gyeates quit (Ping timeout: 258 seconds)
16:01:11landgrafError: implementation of 'id' expected
16:01:17landgrafwhat does it mean?
16:01:32landgrafwhich kind of implementation?
16:02:47Araqproc id: int = 3
16:02:59Araqwould be an implementation of 'id'
16:03:25landgrafAraq: missed spaces :(
16:03:38Araqhrm?
16:03:48landgrafAraq: id*: int -> id* : int
16:03:54landgrafAraq: this fixed the issue
16:04:01Araqer ... what?
16:04:12landgrafah no
16:04:14landgrafnvm
16:04:18Araqlol
16:04:36reactormonkAraq, you asked me a while back for being here, then just gtfo'd...
16:05:08Araqreactormonk: I asked because you need to be able to fix all the regressions that your PRs caused
16:06:48reactormonkAraq, haven't seen any show up
16:06:54Araqindeed
16:07:01reactormonkat elast as issues.
16:07:23Araqcan you fix nimsuggest please?
16:07:56landgrafAraq: Well. It was indentation. (I'm playing with nim second time).
16:07:59reactormonkAraq, https://github.com/Araq/Nim/issues/2694 ?
16:13:22*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:15:50*gyeates joined #nim
16:29:10*gokr joined #nim
16:47:41vikatonI was just asking, since I heard rumors of Nim being very unsafe
16:50:00*Jesin quit (Quit: Leaving)
16:50:24ldleworkvikaton: very unsafe pre-rust or post-rust
16:50:30reactormonkvikaton, yeah, we had a debian guy asking if he could bootstrap nim
16:50:59ldleworkIt seems many people's thresholds of what 'very safe' has changed pretty substantially as of late
16:51:15vikatonldlework: not sure what you mean
16:51:16*endragor quit (Ping timeout: 272 seconds)
16:51:49ldleworkdunno how else to say it
16:52:07vikatonthe post-rust thing
16:52:26vikatonThey just say its unsafe because of compilation to C and C's undefined behaviour
16:52:29*Jesin joined #nim
16:52:49vikatonalso heard rumor that Nim may compile straight to LLVM in the future
16:54:03reactormonkunlikely
17:02:51gokrvikaton: The "unsafe" bit... sure, Nim doesn't have the same memory safety as Rust, but ... it sure seems MUCH easier to work with. And the C bit? Araq may know more, and sure, you can probably cook up some corner case code - but generally things work fine. And if you find an issue, file a bug report.
17:03:15gokrWhen I say "seems" that's because I haven't coded in Rust.
17:03:45*endragor joined #nim
17:04:33Araqreactormonk: exactly that bug
17:05:36Araqvikaton: I'm very busy these days but soonish I will address these foolish points against Nim in its faq
17:06:32vikatonAraq: Sounds good
17:07:56Araqhere is a hint: x86 has an "illegal opcode" error/runtime trap. does that mean C has that error too cause it compiles to x86?
17:08:59vikatonIm guessing no
17:12:54gokrBtw, there are lots of languages that compile via C, including duh... C itself. Which you know, Linux etc is written in :) Its all about compiling "correct" C.
17:20:26ArrrrrDoes unicode module have any proc to test whether a rune is a digit or not?
17:26:04*BitPuffin|osx quit (Ping timeout: 245 seconds)
17:32:29*brson joined #nim
17:32:40*boopisaway is now known as boop
17:33:18AraqArrrrr: there are PRs for that but I consider the unicode notion of what "digit" means completely broken. Just check for x in {'0'..'9'} instead
17:33:48ArrrrrYep, i thought that. Thanks.
17:42:43*Jehan_ joined #nim
17:48:33Jehan_Glasgow Haskell used to have C as a compilation target; Eiffel studio still does. This really has nothing whatsoever to do with safety.
17:49:00Jehan_Leaving aside the fact that "safety" is way too vague a term to be meaningful.
17:53:53ArrrrrWhy is not '\n' allowed as a literal char?
17:53:56*Matthias247 joined #nim
17:54:00*banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:54:09dom96Arrrrr: because it's two chars on some OS'
17:54:18Jehan_Use '\l' instead.
17:54:22Araqit's actually quite easy to design a language where every function has to be total
17:54:52ArrrrrI see, thanks Jehan_ and dom96
17:55:07*gokr quit (Quit: Leaving.)
18:04:39*zahary quit (Ping timeout: 256 seconds)
18:07:37vikatonmhm
18:09:38*BitPuffin|osx joined #nim
18:12:29*iamd3vil joined #nim
18:23:12*flaviu joined #nim
18:24:42flaviuJust having a bit of fun with synthmeat's concept from last week: http://a.pomf.se/vxxywb.svg
18:29:52*iamd3vil quit (Ping timeout: 246 seconds)
18:30:51AraqJehan_: what do you think about this idea: make 'func' mean the same as 'proc' but every ptr/ref parameter is *deeply* immutable and also a "lent" pointer, meaning that x.field = param is not allowed
18:31:25Jehan_Araq: Hmm. Will there be an escape mechanism if you need it?
18:31:25*redwyn_ joined #nim
18:31:51Araqno. why?
18:32:34Jehan_Araq: Because you may need to change the internal representation even if something "seems" immutable.
18:32:56Araqwell the point of this is to allow:
18:33:02Jehan_We have this in a computer algebra systems as a core feature.
18:33:10Jehan_Where most types can accumulate and cache properties.
18:33:10Araqfunc depth(n: ref Node): int = ...
18:33:19Jehan_Such as whether a group is abelian.
18:33:33Araqspawn depth(someTree) # no deepcopies for someTree here
18:34:14Araqso if it's mutable under the hood, that's too unsafe for the thread local GC etc
18:34:19Jehan_Hmm. First of all, I'm not sure if that works.
18:34:43Jehan_Once spawn returns, someTree can be mutated again while the task is still running.
18:34:44Araqit works in 'parallel' due to the barrier it implies
18:34:57Araq(I hope)
18:35:34Jehan_Even in parallel, I don't see it.
18:35:42Jehan_var foo = ...
18:35:50Jehan_spawn task(foo)
18:35:54Jehan_foo.x = 0
18:36:42Araqwell that's part of the nasty "disjoint check" then, which might be intractable for 'refs'
18:37:14Jehan_Yeah, I'm not sure if that's decidable.
18:38:26Jehan_Second, even if it worked, the use case is so limited that I'm not sure if one should set a keyword aside for it.
18:38:47Araqwell it's "obviously" wrong as the lent/immutable attributes belongs to the parameter, not to the routine
18:39:16*gyeates quit (Quit: Leaving)
18:39:22Araqbut maybe in practice it works out
18:39:42Araqdue to aliasing it's hard to do it on a parameter basis
18:40:10Araqplus of course, it looks sexy ;-)
18:40:19Jehan_You still have the aliasing issues with multiple threads.
18:40:41Jehan_Eh ... I wouldn't see myself using it if it came with such restrictions.
18:40:58Jehan_I'm assuming that manipulating global variables would also be strictly forbidden?
18:41:40Araqit'd better do that yeah, func not implying 'noSideEffect' would be pretty weird
18:41:59Araqbut strictly speaking we don't have to do that
18:42:07Jehan_The problem is, of course, that then you can't even temporarily insert debugging code.
18:42:22Araqthere is always debugEcho
18:42:27Jehan_Well, if you can manipulate globals, then you have aliasing problems again.
18:42:40Jehan_Too limited for a lot of stuff I sometimes need to do.
18:42:56Jehan_Debugging may involve gathering data over a period of time to analyze it.
18:44:24Araqyeah but then you can always aggregate data into an sqlite table :P
18:44:37Jehan_People would probably just start building their own escape mechanisms, via importc, emit, or addr.
18:45:11Jehan_Has happened with just about every language ever that tried to control too much what programmers could do. :)
18:45:57Araqnah, ... because of ... Haskell ... argh
18:46:10*Araq cannot disagree with this argument
18:46:41Jehan_I was actually just hacking around Haskell's laziness the other day with deepseq. :)
18:47:02Jehan_benchmarking lazy code can be ... tricky.
18:48:08Jehan_I think that Nim may need a separate language mechanism to deal with shared data, whether mutable or immutable.
18:48:32Jehan_Because that's what this seems to be aiming at.
18:48:47Araqwell we have that with '=' and '=destroy' following C++'s path allowing atomic RC
18:49:55Jehan_So, you want a global shared heap for that?
18:49:59AraqI have SharedString and SharedTable, but they don't work yet due to a nice bug. Either =destroy works or '=' but not both. :-)
18:50:04*redwyn_ quit (Quit: leaving)
18:50:31Araqbut that's actually just a manifestation of an old destructor bug
18:50:34Jehan_What is =destroy?
18:50:39*OnO joined #nim
18:50:49Araqthe syntax for a destructor
18:50:57Jehan_Ah.
18:51:25Jehan_Hmm, sort of like a shorthand for `= nil` with immediate effect?
18:51:58Araqand yeah, these use a global shared heap. No, it's wrapped in an implicit 'try' at scope exit, really much like C++
18:52:14Jehan_Umm, is the idea then that any data type that you want to share needs a duplicate implementation with explicit atomic RC?
18:52:32Jehan_I'm not sure I like that ...
18:52:54Araqyes. That's the idea.
18:53:12Jehan_That sounds like a major violation of DRY.
18:53:23*flaviu quit (Remote host closed the connection)
18:53:28*ldlework hands Araq a towel.
18:54:00Jehan_Not to mention that if you really do it like C++, the shared pointer updates are damn expensive.
18:54:02Araqldlework: not sure what that means
18:54:13Jehan_Pun about DRY. :)
18:54:25Araqah got it
18:55:01Jehan_I still maintain that the easiest solution would be to have lockable shared heaps.
18:55:21boophmm
18:55:26Jehan_Make them read-lockable and you can pass immutable data structures around as much as you want.
18:55:31boopi can't find docs on "object of", but i'm sure i saw them before
18:55:35Jehan_Write locks and you can exchange data between threads.
18:55:36boopany hints?
18:56:20Arrrrrboop: http://nim-lang.org/docs/tut2.html#object-oriented-programming-objects
18:56:27onionhammerAraq where did we land with module-private constructors?
18:56:42boopah! that's the one
18:56:44boopthanks
18:56:45Araqonionhammer: nowhere.
18:57:28Araqonionhammer: a pragma to disable T(x: 1) construction is consensus
18:57:45Araqbut all the other proposals don't appeal to me
18:57:51onionhammeryeah
18:58:02onionhammerpragma is better than nothing
18:58:09Jehan_{.opaque.}?
18:58:21ArrrrrAgree
18:59:06Araqnot sure. I guess .opaque is the best we can come up
18:59:21onionhammerit's not really opaque though
18:59:49onionhammer{.internal.}? :P
18:59:58Araq.abstract ?
19:00:15Araq.privateconstructible
19:00:20Jehan_I'd say {.sealed.}, but that is commonly used for other things.
19:00:22onionhammerit's a mouthful
19:00:32Araq.privateCons
19:00:34onionhammersealed is good...
19:00:46Arrrrr{.noCon.}
19:00:49Araqno, sealed is already used for 'final' in C#
19:00:58Jehan_onionhammer: Yeah, but it's commonly used for other purposes, so that would confuse people.
19:01:01onionhammeryeah
19:01:12Jehan_And for "no inheritance outside this package" in Scala.
19:01:17onionhammerthere's still a constructor arrrr, just cant be used outside of the module
19:01:42Araqah so Scala shamelessly uses C#'s keyword to mean something else.
19:02:01Araqbetter join #scala to tell them it's "confusing me"
19:02:01Jehan_Dunno, it may have preceded C# or be simultaneous?
19:02:08Jehan_Both have been around for a long time.
19:02:25AraqI'm not serious
19:02:48Araqit's just that in #nim there is this idea that everybody is always confused about everything, never reading anything.
19:02:52onionhammer.internalconstructor. :P
19:03:15onionhammer.internalctor.
19:03:39Arrrrrsounds good, why not privatector
19:03:45*yglukhov________ joined #nim
19:03:46AraqJava's volatile also doesn't match C++'s volatile
19:03:48onionhammer.opaque. it is..
19:03:50onionhammerlol
19:04:03Araqbut for some reason java got away with it
19:04:41Arrrrrbecause none that programmed in c++ took java seriously
19:04:41*dtscode joined #nim
19:05:17Jehan_Java is shorthand for "reinventing the wheel, poorly".
19:05:21*pregressive quit (Remote host closed the connection)
19:05:41Jehan_Okay, that was a bit mean ... but they revisited so many errors that they could have avoided by looking at the state of the art.
19:07:16Jehan_I still like Per Brinch Hansen's article about Java's concurrency. It's not often that a peer-reviewed paper publishes a rant by a famous scientist that basically says, "what on earth were you thinking?"
19:07:42def-onionhammer: {.private.} makes more sense to me
19:07:58ArrrrrWhat is wrong with java's concurrency?
19:08:40*pregressive joined #nim
19:08:59Jehan_Arrrrr: http://brinch-hansen.net/papers/1999b.pdf
19:09:23AraqJehan_: yeah well ... lockable heaps. Make them happen please. ;-)
19:09:45Jehan_Araq: I can make lockable heaps easy enough.
19:09:51Jehan_The tricky part is the language integration.
19:11:03Jehan_There are a number of ways of going about that, and I don't want to put in the work without knowing it won't have to be thrown away in the end.
19:11:32*UberLambda joined #nim
19:12:25dom96Do you guys have any idea how we could bring language support for Nim in travis CI?
19:13:02Jehan_Araq: The easiest solution would be copying Eiffel's model, but that is more limited than I like.
19:13:21Jehan_Plus, it's really centered around OOP and would have to partly redesigned.
19:13:35AraqJehan_: well you can start with a NEP
19:13:56Jehan_That sounds doable.
19:15:08Araqdom96: no.
19:15:54def-dom96: Similar to this? https://github.com/def-/nimes/blob/master/circle.yml
19:16:04*dom96 is setting up Travis CI for the packages repo
19:16:13def-I haven't tried Travis CI, but Circle worked easily
19:16:30def-Compiles all my builds: https://circleci.com/gh/def-/nimes
19:16:51dom96how many of these continuous integration services is there now? lol
19:17:11Jehan_More importantly, how do they make money?
19:17:14def-Too many. I just chose Circle because someone had a script for it already
19:17:26dom96Jehan_: They ask for money when testing private repos.
19:17:39Jehan_dom96: Hmm, I see.
19:17:44def-and you have to pay if you want to run tests with many cores / many tests at the same time
19:17:47dom96def-: ahh. Somebody created a script for travis for me, so I may as well use it.
19:18:12synthmeatwhere exactly can implicit declarations happen?
19:18:29dom96I wonder if we could move the Nim repo to one of these services and get nightly builds for free.
19:18:45Arrrrr"The 1980s will probably be remembered as the decade in which programmers took a gigantic step backwards by switching from secure Pascal-like languages to insecure C-like languages. I have no rational explanation for this trend. But it seems to me that if computer programmers cannot even agree that security is an essential requirement of any programming language, then we have not yet established a discipline of computing based on common
19:19:22ArrrrrFunny
19:19:40dtscodesynthmeat: The only one that comes to mind is a proc's implicit result variable
19:19:55synthmeatArrrrr: you didn't send the entire quote though. it stops at "common"
19:19:56dtscodeSince Nim (afaik) doesn't have a this or a self
19:20:02Jehan_Arrrrr: It was performance, really, combined with the arrival of personal computers.
19:20:13Arrrrr" commonly accepted principles."
19:20:18Jehan_I wrote stuff in assembly language back then because anything else was too slow.
19:20:22synthmeatdtscode: it works for "for i in 0..2"?
19:20:33dtscodesynthmeat: What works?
19:20:40synthmeatimplicit declaration
19:20:55dtscodeNothing is implicitly declared there
19:20:57Jehan_But yeah, that was sort of depressing still. He has a point there.
19:21:13dtscodeBecause pascal was so secure?
19:21:16dtscodeand fortran?
19:21:20synthmeatdtscode: it says so in the manual?
19:21:32Jehan_dtscode: Concurrent Pascal, which he wrote, *was* memory-safe.
19:21:39synthmeatquote, "The variable i is implicitly declared by the for loop and has the type int, because that is what countup returns."
19:22:05dtscodeWell you are still explicitly writing the I. I would say its explicitly defined.
19:22:09synthmeatwithout const, let or var, that sure looks like implicit declaration
19:22:33dtscodeNo, the i is the declaration
19:22:49dtscodeproc(foo: string) doesn't have const, let, var
19:22:55dtscodeJehan_: Eh...
19:23:44ldleworkThat's more like type inference
19:24:01synthmeatdtscode: ok. let's agree that what happens there in the for loop is not implicit declaration, in spite of it saying so in the manual, and whatever you want to call it....
19:24:08synthmeatwhere can something like that occur, besides for?
19:25:15ldleworksynthmeat: do you care about manuals using language for illustrative purposes, or cases where really, you cannot statically analyze some behavior?
19:25:16dtscodeIs it python that can do if i in [1,2,3] or can you do that in nim as well?
19:25:27ldleworkthat python
19:25:40Jehan_Both.
19:25:44ldleworkwoot
19:25:46synthmeatldlework: i'm interested in places where i can introduce a variable without saying "var"
19:26:06ldleworksynthmeat: that's a poor standard for implicit declaration
19:26:12dtscodesynthmeat: if i in @["woooooo", "docker", "nimbus"
19:26:22ldleworkBecause its other mechanisms that explicitly stand in for var, in the cases such as for
19:26:27ldleworkNot "no mechanism at all"
19:27:13synthmeatwell, if you can present me a mental model of thinking about it more elegantly, i'm wide open :)
19:27:22ldleworkI just did
19:27:37ldleworkwith the case of 'for', alternative syntax is a standin for var.
19:27:50synthmeatit's the "special case"
19:27:52synthmeat?
19:27:56ldleworkThere are no cases, or any kind of variant behavior, where the effect changes. You'll get an interation variable.
19:27:56*flaviu joined #nim
19:28:06ldleworkiteration*
19:28:13ldleworkIE, for is just var spelled differently.
19:28:30ldleworkIts still an explicit site where a variable is declared. Its type is simply inferred.
19:28:31synthmeatis "if" that too?
19:28:32flaviuMy vim keeps complaining about "lib/system.nim|666 col 6 error| implementation of 'system.+(x: int64)' expected"
19:28:40flaviudoes anyone have any idea what's going on?
19:28:46ldleworksynthmeat: can if introduce names?
19:28:55synthmeatyeah
19:29:10ldleworkIt can?
19:29:41synthmeatno, it cannot
19:29:51ldleworkAlright then :)
19:30:57synthmeatit's just then some syntactic sugar for for loops only?
19:31:37ldleworkWell that's the only case discussed. I can't think of any other places but I am just disagreeing that what happens in a for loop is a useful instance of what you'd call "implicit declaration"
19:32:08synthmeatare there then cases of implicit declarations anywhere at all?
19:34:52*banister joined #nim
19:35:16dtscodesynthmeat: I already told you that
19:35:49dtscode<dtscode> synthmeat: The only one that comes to mind is a proc's implicit result variable
19:36:08*gokr joined #nim
19:36:19synthmeatok, yeah, i understand now
19:36:24synthmeatthanks, that makes sense
19:37:02synthmeati'm trying to figure out a use case where this "not really implicit" declaration would make sense besides for loop, and can't think of one that would be unambigous in whether it is a const, var or let
19:37:09synthmeatcool, thanks both!
19:41:52AraqJehan_: smartEiffel never got multi-threading/scoop and the commercial Eiffel has a shared memory GC, last time I checked. So it's not clear at all to me that I can simply copy Eiffel.
19:42:09Jehan_Araq: I'll write up why it works.
19:42:26Jehan_It works not only for shared memory, but (in principle) even for distributed systems.
19:42:42Araqin fact the commercial Eiffel has some documentation about thread local GCs but more recent versions of the documentation don't have that.
19:43:18Jehan_The basic idea is that `separate` is a new reference type that denotes a reference to a foreign data space.
19:43:28Araqand indeed Scoop is about locking and "guarding", not about memory management
19:43:47Jehan_Those are the language features that tie it together.
19:44:30Jehan_But there's an underlying requirement that objects are partitioned into separate data spaces.
19:44:54Jehan_You can still use a shared GC, and it makes a lot of stuff easier.
19:45:13Jehan_The "require" as a wait condition is a pain to implement otherwise, but also overkill.
19:45:39Araqyeah that part makes no sense to me anyway.
19:45:51Jehan_I'll try and do a NEP write-up later this week.
19:45:59Araqa precondition is not a "wait for" condition
19:46:11Araqthis part always really bugged me
19:46:15Jehan_Yeah, that has been one of the criticisms of the model.
19:46:36Araqit's not "simple" if you only add 1 keyword but rewrite the underlying semantics
19:46:37Jehan_When I wrote my own stuff, I designed synchronization contracts that were separate from preconditions.
19:46:38onionhammerdef- its not really a private type though
19:46:50Jehan_Yeah, that's also something that I never good.
19:46:52Jehan_got*
19:47:03Jehan_Keyword minimalism is not a design goal in and of itself.
19:47:12Araqexactly
19:47:31flaviuDoes anyone have a self-balancing search tree implementation in Nim?
19:47:39Jehan_The key idea, though, is that separate introduces a new reference type and the rest of the stuff is how to make access to such references safe.
19:47:53Jehan_flaviu: As it so happens, I wrote one the other day. Let me upload it.
19:47:55Araqflaviu: the memory manager uses a variant of AVL trees
19:48:21Araqropes.nim used to have a splay tree implementation
19:48:34Araqgit history might show it
19:48:37flaviuJehan_: Lucky timing. Thanks!
19:49:03flaviuAraq: It's probably going to be easier to use Jehan_'s than to tear out all the unrelated machinery from those two.
19:49:16Jehan_flaviu: It's a red-black tree, you may have to adapt it, it's very simple. It's a proof of concept for how to do pattern matching without actually having pattern matching.
19:49:22Araqflaviu: yeah but you'll learn more :P
19:49:58flaviuJehan_: Sure, that's no problem.
19:49:58flaviuAraq: In that case, I might as well as write my own RB tree and actually learn how it works.
19:50:18ldleworkdoesn't E and Erlang have a lot to say about this stuff?
19:50:42ldleworkI know that in Monte that they have a reference type called a "farref" which refers to memory in a remote VAT
19:51:18Jehan_flaviu: https://bitbucket.org/behrends/rbtree
19:51:54Jehan_The only tricky stuff is that that I define a macro to get the `&` operator for tuples.
19:52:05Jehan_E.g. (1, 2) & (3, 4) -> (1, 2, 3, 4)
19:52:48Jehan_OCaml is still faster because of their crazy good GC, but it blows Haskell and F# out of the water. :)
19:53:22flaviuhttp://www.vision.caltech.edu/~mmcgill/tuples/index.html might have been another option
19:54:04Jehan_flaviu: Huh, I didn't know of that.
19:54:31Araqat one point in Nim's history I need to apologize for stuff like result[1][0][0] :D
19:54:44Jehan_Not sure how he makes it a proc, though, at least not without performance overhead. :)
19:55:22Jehan_Araq: Meh, it's not ideal, but it does work for now. :)
19:55:27Araqbut hey, I was young and needed the money
19:55:59Araqbtw that's one major reason why Nim lacks pattern matching.
19:56:01reactormonkAraq, what would be the alternative?¨
19:56:04flaviuJehan_: Looks like he uses macros: https://github.com/MasonMcGill/tuples/blob/master/source/tuples.nim#L303-L319
19:56:09Arrrrrmoney driven development
19:56:28AraqI like trees with a variable number of children
19:56:38Jehan_flaviu: Ah, yes.
19:56:40Araqand I don't see how to pattern match these
19:56:52Jehan_Still, I didn't want to have external dependencies.
19:57:04*yglukhov________ quit (Quit: Be back later ...)
19:57:18Araqreactormonk: I don't have a good alternative.
19:57:30flaviuJehan_: Makes sense, especially for the context you described.
19:57:41Jehan_Araq: There are ways using tree grammars, but probably overkill.
19:57:55Araqlots of accessors, firstStmt.firstTupleElem.firstTupleElem
19:58:03flaviuFoo(_, Bar(FooBar(v)))?
19:58:06Jehan_flaviu: I basically wanted to tackle http://rosettacode.org/wiki/Pattern_matching out of curiosity.
19:58:27Araqmy DrDobb's article also shows how to do pattern matching ...
19:58:33Araqbut apparently nobody read it
19:58:42Jehan_See PCCTS/Sorcerer.
19:59:02ldleworkpattern matching is one of the cooler pld features
19:59:12def-Jehan_: nice, planning to put it on rosetta code?
19:59:18Jehan_Araq: Well, I did read it but wasn't really applicable.
19:59:30Jehan_def-: It would be a lie, since it doesn't really do pattern matching.
19:59:47Jehan_I happen to think it's an elegant hack around it, but it's not the same.
20:00:10def-alright, i guess that's also why i didn't tackle that one
20:00:47Jehan_I have been thinking about writing a general pattern matching macro that would work, but ... not urgent enough.
20:01:18Arrrrr:O
20:01:20ldlework:0
20:01:34Jehan_It'd be something like: let Foo(x, y, Bar(z, v)) ~= someStructure.
20:02:13def-Jehan_: wouldn't that make more sense baked into the compiler?
20:02:34Jehan_Would be transformed into let (flag1, x, y, tmp) = Foo(someStructure); if flag1: let (flag 2, z, v) = Bar(tmp); flag1 and flag2
20:02:35Araqdef-: not really. read my article please.
20:02:51ldleworkAraq: which one?
20:02:53Jehan_Basically, Foo and Bar would work like unapply in Scala.
20:03:11def-Araq: i actually read it, but it's long ago
20:03:27Araqbut ok, let me do it for OSCON
20:03:36AraqI need more macro examples anyway
20:03:44*endragor quit (Remote host closed the connection)
20:03:50Arrrrrhttp://www.drdobbs.com/open-source/nimrod-a-new-systems-programming-languag/240165321
20:04:32Araqdef-: tl;dr you want a customized equality for matching against Foo(x, x)
20:05:31Araqnow you can say "but you can overload '==' for that" and then I say "ok, fair enough"
20:05:41Jehan_flaviu: Hmm, the macros module predates getType. The way he gets at the length is a brilliant hack, but ... dear god. :)
20:06:30Araqyeah getType is a real enabler.
20:06:56Jehan_Araq: Basically, he counts an index variable up, until t[i] fails. That's the length of the tuple.
20:07:06Jehan_Eh, until compiles(t[i]) fails.
20:07:11AraqXD
20:07:33ArrrrrIsnt that slow?
20:07:40Arrrrri mean, the exception
20:07:46AraqArrrrr: it's only done at compile-time
20:07:53flaviuJehan_: heh, that is clever.
20:08:20flaviuArrrrr: And there is no exception: it's a compiles() call.
20:08:26flaviuThat's slower than an exception :P
20:08:31Arrrrrlol
20:08:43Araqdunno about that
20:09:22dom96That is genius.
20:09:25Araqbut yeah, it uses a 'try'
20:09:31Araqin the compiler
20:11:37*OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…)
20:11:39Jehan_What impresses me about C compilers most these days is how well they can optimize struct assignments (both in whole and to their components).
20:11:58Jehan_This is really what makes using tuples as an abstraction and still getting good performance possible.
20:13:30Araqhey, it's what depresses me most about C compilers. you have all this powerful machinery but it doesn't apply to bignums since "not builtin"
20:13:41*UberLambda quit (Quit: Leaving)
20:15:05flaviuCan someone verify the output of `nim --dump.format:json --verbosity:0 foo` is bad?
20:15:53Araqflaviu: pretty sure it is. --verbosity:0 doesn't imply --hints:off etc
20:15:57Jehan_Araq: Well, optimizing bignum arithmetic is really a deeper problem.
20:16:17Jehan_My officemate happens to be one of the MPIR developers, so I know a bit about it.
20:16:46flaviuI don't think that's the problem. I get `{""version"":""0.11.2"", ...` as the output.
20:17:31AraqJehan_: register allocation for x86 and "avoid temporaries for bignums" is pretty much the same problem
20:17:52ArrrrrHave to go, good night.
20:17:56*Arrrrr quit (Quit: Page closed)
20:18:35Jehan_Araq: at a very high level, and it's not the only optimization problem you're dealing with.
20:19:22dom96yay. Jester is now at ~80% of the speed of asynchttpserver.
20:20:35AraqJehan_: yes but it's much better than no optimization at all, which is what you get.
20:20:43onionhammerdom96 cool, breaking changes?
20:20:47dom96onionhammer: nope
20:20:51onionhammercool
20:20:56onionhammeri'll give it a try
20:21:00Jehan_Araq: Yeah, but the compiler still needs to know about the library.
20:21:06onionhammeris it published to nimble?
20:21:07Araqdom96: used lexim? ;-)
20:21:17dom96Araq: nope
20:21:21Jehan_Incidentally, term rewriting macros may be nice for this. :)
20:21:27Jehan_Not perfect, but they could help a bit.
20:21:41dom96onionhammer: It's in Nimble's package list.
20:21:48Araqwell they better could. They have been designed for this.
20:22:23onionhammerdom96 nimble install jester?
20:22:31dom96onionhammer: yep
20:22:47onionhammeri'll bench it when i get home.
20:22:53onionhammerbefore/after on my blog site
20:24:13Quoradom96: jester is great :D
20:25:02dom96Quora: thanks :)
20:25:46Araqdom96: use lexim please
20:26:11Araqalso add support for custom states and rewrite it completely to not use async ... *cough*
20:26:41flaviuI'm pretty sure #2738 is broken. See https://github.com/Araq/Nim/pull/2738/files#diff-e00d77321d9bf30eaf8e4be863d9b565R976 and https://github.com/Araq/Nim/blob/30aed77d0419916b724205b519fe54a47be6284b/lib/pure/json.nim#L874
20:27:07Araqhrm now I wonder if that's actually possible
20:27:08QuoraDoes anyone have any suggestions for an XMLRPC library to use with nim?
20:27:26AraqQuora: use a JSON RPC library instead
20:27:41*OnO joined #nim
20:27:47QuoraAraq: let's say that is immutable for the scope of my question
20:27:49dom96^^ https://github.com/dom96/nim-jsonrpc
20:28:13Araqusing a format designed for semistructured text for RPCs is so stupid
20:28:21QuoraI agree
20:28:28Quoraactually
20:28:30Quorahmm
20:28:32dom96A certain someone still owes me $200 for that JSON RPC lib.
20:28:38Jehan_But sometimes you still get it forced upon you. :(
20:29:01Quoradom96: do you have example usage around?
20:29:10ldleworkdom96: you take bounties?
20:29:18dom96Quora: take a look at the tests.
20:29:48dom96ldlework: It wasn't really a bounty. But do I take them? Sure.
20:29:51ldleworkI wonder how much it would cost me to get forward declarations.
20:30:23dom96You would have to pay Araq or Zahary for that.
20:31:04flaviuldlework: I hope I've explained why a 100% solution would be too expensive?
20:31:16dom96ldlework: This seems to be what you are looking for: http://nim-lang.org/support.html
20:31:18ldlework'two passes during a step I literally don't care how long it takes'
20:31:30*Trustable_2 joined #nim
20:31:47Araqldlework: depends on what exactly you're after
20:32:03OnOany reason I cannot override dot accessor with a template `.` ?
20:32:03dom96Araq: not sure how lexim would help
20:32:14flaviuldlework: *at least two passes
20:32:22ldleworkflaviu: sure
20:32:56*Trustable quit (Ping timeout: 272 seconds)
20:33:09ldleworkAraq: basically be able to do what I can do with functions, but for types, allowing mutually referential modules
20:33:22ldleworkerr
20:33:28ldleworkallowing mutually referential types across modules
20:33:37Jehan_Araq: I just realized that you live across the town from where I am. Plus, same street where I used to live as a student.
20:34:10AraqJehan_: yeah I know :-)
20:34:47dom96Any of you guys going to be near or in Edinburgh on the 11th of June?
20:35:35Jehan_dom96: Unlikely, though I may be in St Andrews later this year.
20:37:18*ingsoc quit (Quit: Leaving.)
20:37:32*pregressive quit ()
20:37:46OnOnevermind, it works with macro `.`
20:37:55dom96Jehan_: Pity. I was actually considering attending a university there.
20:39:14dtscode:D The 12th of June is my birthday
20:39:25onionhammerhttp://h2o.github.io/
20:39:28onionhammeroo this looks promising
20:39:47onionhammerearly days though by the looks of it
20:42:01flaviudom96, onionhammer: please see https://github.com/Araq/Nim/pull/2755
20:42:24dom96onionhammer: ooh. Let's make that the backend of Jester :D
20:42:26onionhammerdid you submit a bug?
20:42:55dom96flaviu: What's the problem with that PR?
20:43:38flaviuLine 976 and line 970.
20:44:07flaviuThose lines + context should be fixed and tests added to prevent similar problems.
20:44:31def-dom96: nice work on optimizing jester
20:44:48flaviuThen #2738 can be remerged.
20:44:56dom96def-: Thanks. I'm sure there is more that can be done.
20:45:02reactormonkAraq, btw, there can't be more than one dirty file with nimsuggest... should I fix that?
20:45:21onionhammerflaviu what about those lines?
20:45:24dom96def-: For example I wonder if there is any way to optimise async procs because they add a seriously large amount of overhead.
20:45:41dom96def-: I'm not sure whether it is just the Futures, the first class iterator allocation or both.
20:45:46def-dom96: indeed, that should be the main optimization
20:45:52def-dom96: and multi-threading of course
20:45:52Araqreactormonk: hrm, the compiler certainly knows more than 1 dirtyfile
20:46:04flaviuonionhammer: Those lines lead to double-quoting, see the implementation of escapeJson.
20:46:22onionhammerahh
20:46:31reactormonkAraq, ok, later then maybe. I'll put it on github
20:46:32onionhammerescapeJson adds extra quotes?
20:46:47onionhammergrmble...
20:47:02onionhammerthats not intuitive
20:47:38onionhammerhow big of a breaking change would it be to not add quotes around input string with escape Json.. jeez..
20:47:55flaviuI'm not sure why escapeJson is exported, because that could be fixed without any problem if it wasn't.
20:48:19reactormonkonionhammer, it's used in a few places
20:48:42onionhammerit makes sense to export it imo... just not to add quotes
20:49:09Araqhrm? "foo" should become "\"foo\""
20:49:13Araqnot ""foo""
20:49:23onionhammerfoo should be foo, there's nothing to escape
20:49:32Araqfor JSON?
20:49:37onionhammerright
20:49:43dom96could we fix toUgly instead of reverting the PR?
20:49:45flaviuI agree, if people want the quotes, they can do `newJString("foo")`.
20:49:49dom96and... test it properly this time?
20:49:57Araqfoo is not valid JSON.
20:50:01flaviudom96: Revert the PR, and then merge it again when it's fixed.
20:50:11onionhammerfoo is a valid json STRING value
20:50:36dom96flaviu: there were already problems with the fork disappearing
20:50:40dom96don't think that's a good idea
20:50:44AraqescapeJson("foo") --> "\"foo\""
20:50:49reactormonkwhat's the return type of escapeJSON? Is it JString? If not, it should return "foo"
20:50:58Araqwhat else should escapeJson do?
20:50:59onionhammerescapeJson("foo") => "foo"
20:51:08Araqno way.
20:51:10flaviudom96: We don't want to have bad code in devel, especially since I compile my nim directly from devel.
20:51:31onionhammerescapeJson(value) != wrapInQuotes(value)
20:51:32dom96then let's fix it quickly.
20:51:52dom96Doc string for escapeJson: Converts a string `s` to its JSON representation.
20:51:54reactormonkanyone messed with the linux profiler yet?
20:52:03dom96The JSON representation of a string includes the quotes.
20:52:18Araqonionhammer: what should be "escaped" then?
20:52:40onionhammerAraq http://json.org/
20:52:51flaviuJust merge https://github.com/Araq/Nim/pull/2755 and then we can argue all we want over this.
20:52:53onionhammerunicode characters, quotation marks, newline characters, etc
20:53:01dom96flaviu: I will just fix it instead.
20:53:02*OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…)
20:53:20flaviuMake a new PR to replace #2738 if there are problems with the branch disappearing.
20:54:25Araqonionhammer: sorry this makes no sense. If \0 becomes \u0000 then certainly the quotes should be added as well
20:54:38onionhammerAraq of course, but only if quotes are in the original string
20:54:49onionhammerthis is *adding* quotes to the string
20:55:05Araqyes, and that's correct
20:55:12onionhammer*sigh*
20:55:23Araqmaybe we need to rename 'escape'
20:55:55onionhammernewJStringNode("somevalue") maybe
20:55:57onionhammerlol
20:56:09reactormonkdundundidun.... valgrind takes ages....
20:56:41flaviureactormonk: Try perf.
20:57:25reactormonkflaviu, got me a page on how to use that?
20:57:35reactormonk... and can I attach it to a process?
20:58:14onionhammeranyway, good find flaviu, sorry for that. I was working with my own escape implementation while testing it looks like
20:58:45onionhammer(I was trying to improve the performance of that too, but it didnt make an appreciable difference)
20:59:19dom96Fixed.
20:59:43onionhammerthanks
21:00:52flaviureactormonk: Turn on debug info in Nim, and then use perf record --call-graph dwarf -e instructions -c 500 myprogram
21:01:14flaviuChange the value of -c based on the runtime of your program.
21:01:23flaviurun perf report to see the results.
21:01:45reactormonkand -p to attach
21:02:25reactormonkturn on debug info via --passC:-g ?
21:03:01flaviuNo, --debuginfo --linedir:on
21:08:41reactormonkit's running the GC quite often...
21:09:17def-flaviu: I think --debugger:native does the same
21:12:31reactormonkflaviu, wanna help dig? I'm trying to find out why nimsuggest bugs on the second call.
21:12:47*TEttinger quit (Ping timeout: 256 seconds)
21:12:56reactormonkO.o 2G in perf data
21:14:12flaviuYep, it's big. Changing -c should fix that. I don't remember if it needs to be increased or decreased :P
21:15:27flaviudef-: Huh, that's not even that recent. Well, I can use that from now on.
21:16:05Araqreactormonk: compiler/modules.nim implements the logic you like to debug
21:16:22flaviureactormonk: sorry, I'm working on something else right now
21:16:45reactormonkAraq, yup, put my debug in there already
21:19:37reactormonkAraq, hm. at the first pass, it just compiles said module a few times. At the second, it compiles the whole compiler I'd say.
21:21:49reactormonkyup, it does.
21:21:57reactormonkah fuck, debugging global state. I hate that
21:24:44mahlon_Hello, new to nim, have what will probably be a quick one: I've written a deepcopy proc for a custom type, and I want to test/assert that the copied object is indeed different. Is there an easy way to get an object "unique" identifier for comparison? Address location as string or something?
21:25:54*mahlon_ is now known as mahlon
21:26:34Araqmahlon: cast the ref to int
21:27:01Araqor repr it
21:27:03reactormonkwouldn't addr <variable> work better?
21:27:21Araqreactormonk: that most likely would return a stack address
21:27:35reactormonkAraq, ah, the location of the pointer?
21:28:31reactormonkmahlon, btw, cast[int](ref_variable)
21:28:51reactormonkor was it (int)? I always get that mixed up with java syntax
21:29:26Araqreactormonk: use Nim's syntax for Nim code.
21:29:35Araqthat should be easy enough to remember :P
21:29:45Araq(yes, it's cast[int](ref_var)
21:29:57reactormonkI'm usually just tossing it at the compiler and see if it complains
21:30:31mahlonPerfect. Thanks all.
21:34:12flaviuWhat's the story wrt strong spaces? Is that getting dropped?
21:35:37Araqflaviu: I think so.
21:35:55*redwyn joined #nim
21:36:24flaviuok
21:36:46*Trustable_2 quit (Remote host closed the connection)
21:36:52Araqpeople are all vehemently against language dialects these days
21:37:17reactormonkuniformity \o/
21:37:31AraqI actually like the idea that you can do #! strongSpaces or !# curlies and have it your way
21:38:41Araqbut I'm alone.
21:39:15AraqIMHO Nim is still too far ahead of its time in these aspects
21:39:52Araqprogrammers instead agreed that fascism is the only way to develop large software systems
21:42:08*boydgreenfield joined #nim
21:45:04reactormonkAraq, I think the caching and file indexes are broked... do you mind if I tweak nimsuggest to compile the whole project at startup?
21:45:53renesacby they way, from what I tried of strongSpaces, I liked the distinction between no space and one space
21:46:18Araqreactormonk: doesn't it do that already?
21:46:21renesacbut I don't think that "one space" vs "two spaces" is as visible
21:46:50Araqrenesac: yeah fair enough
21:47:13AraqI only really cared about one vs none space
21:47:13renesacand the worst thing about it is that when quickly prototyping the compiler will keep nagging you about inconsistent spacing
21:47:31renesacreminds me of the ";" errors in C that I wanted to scape
21:47:32reactormonkAraq, nope.
21:47:39renesac^^"
21:47:39Araqoh really? now that's interesting, renesac
21:47:42reactormonkI'll take that as a "no"
21:47:58Araqcause the common wisdom said the worst feature is all the random bugs you get with this feature
21:48:04renesacAraq: well, they are my fault
21:48:24Araqreactormonk: fix it, fix it, fix it. I'll review anyway
21:48:43renesacbut it is good for slopyness be tolerated when you are just trying out things
21:49:05renesacyou want nicelly formated code when you are going to show to others
21:49:08reactormonkAraq, it's just something that might get very ugly if I have to change it afterwards... I might rely on all files being in the index already
21:49:25reactormonkso the suggest might bork if the file isn't in the index.
21:49:36Araqrenesac: all I take from it is that I'm right. :P
21:49:38reactormonkon the other hand, it might get a bit more robust
21:49:51Araqreactormonk: yeah go for it
21:50:23reactormonkalso, I might have a bug or two in my code ^^
21:50:58reactormonkah nope, just wrong message sent
21:51:01renesacbut yeah, maybe I would learn to (almost) always use consistent spaces between my operators, like I can remember to put ";" after every line in C (after some time swiching to it)
21:51:22renesacI usually correct those things latter when re-reading the code
21:51:46reactormonkthe whole ";" story just came from fortran overcompensation because people really didn't like whitespace-sensitivity
21:51:53renesacand yeah, your take for it might be right ^^"
21:52:59reactormonkoh, SIGSEGV, old friend, so we meet again
21:54:42vikatonSigSegV is seg fault?
21:56:24reactormonkyup
21:56:47*pregressive joined #nim
21:57:03onionhammerdom96 ok maybe i'll make a wrapper for h2o :P
21:57:13dom96onionhammer: do it
21:57:13reactormonkvikaton, if you try to dereference a pointer in the kernel space (like null, because null is 0, which is the start of kernel space), you get a segmentation fault. So the kernel stops execution and send your process a SIGSEGV.
21:57:36onionhammerdom96 only if you agree to make jester compatible w/ it ;P
21:57:39reactormonk... correct me if I'm wrong. But someone's gonna do that anyway :-)
21:58:04dom96onionhammer: me? Why not you? :P
21:58:46onionhammerpsh
21:59:08onionhammerdecouple jester from the std lib and make the http server pluggable maybe
21:59:10onionhammerthen I will
21:59:17dom96onionhammer: I might do it, it sounds fun.
21:59:26dom96onionhammer: Just write the wrapper and we'll see ;)
21:59:27vikatonreactormonk: deref null pointers is the term right?
21:59:37boydgreenfieldAraq: Is https://github.com/Araq/Nim/issues/2724 and https://github.com/Araq/Nim/issues/88 something that someone who hasn’t spent time with the compiler codebase (me) can help out with? Or just a “wait for it to land”-style feature?
21:59:46Araqah hi boydgreenfield
22:00:04reactormonkvikaton, yup
22:00:10boydgreenfieldAraq: Hi :). And sorry that this one’s a pain.
22:00:38reactormonkvikaton, derefing a null pointer gives you a segfault.
22:00:47Araqboydgreenfield: when I looked it the problem it looked hard, but I dunno. Usually these things don't stay hard.
22:00:52Araq*at the
22:00:57vikatonYeah I figured, thanks reactormonk
22:01:37Araqboydgreenfield: either way, it's only compiler/sigmatch.nim that needs to learn about it, I think
22:02:41*vbtt_ joined #nim
22:03:18renesacreactormonk: in C deref a null pointer is undefined behaviour
22:03:43vikatonso is that what the Rust people always complain about?
22:03:44renesacthat is one of the points people saying nim is unsafe by compiling to C tout
22:03:46vikatonsegfaults?
22:03:58renesacnot segfault, undefined behaviour
22:04:07renesacwell, segfaults is another topic
22:04:09reactormonkvikaton, so it doesn't need to segfault, it may
22:04:35vikatonso its kind of a luck sort of thing?
22:04:46renesacthe problem with undefined behaviour is when the compiler optimizers becomes too clever and starts using it
22:04:53*boop is now known as boopisaway
22:04:55*redwyn quit (Ping timeout: 256 seconds)
22:05:04renesacI don't know if it is the case for dereferencing null pointers
22:05:38renesacI never saw it being something else than a segfault on modern systems
22:05:52reactormonkbut it might be
22:06:14flaviurenesac: related: http://blog.regehr.org/archives/1234
22:06:41boydgreenfieldAraq: Ok, I’ll take a look. Turns out that the alternative is passing the T type parameter up into every object that uses the generic, which becomes… inelegant very quickly.
22:07:04boydgreenfield(or lots of case statements and checking)
22:08:20*redwyn joined #nim
22:08:43Jehan_renesac: It sometimes can not segfault if you're accessing a very large data structure.
22:09:21renesacJehan_: why?
22:10:10Jehan_Because then you may end up in actual process memory.
22:10:36renesac?
22:10:38reactormonkAraq, how does nimsugget collect the symbols exactly?
22:11:09Araqreactormonk: depends on what you request. 'sug' is different from 'def'.
22:11:20Araqbut it's all done in compiler/suggest.nim
22:11:30Jehan_renesac: Assume that process memory starts at address 65536. Then any null pointer access for an element in a data structure with an offset >= 65536 may succeed.
22:11:57AraqJehan_: yeah I've never seen this in practice in my entire life.
22:12:04Jehan_e.g. var a: ref char[100000]; echo a[90000]
22:12:04renesachum
22:12:12Jehan_Araq: Yeah, it's mostly a theoretical concern.
22:12:36Araqit seems to be the most important reason to diss Nim these days
22:12:37renesacwell, the major concern would be the compiler optimizer doing something funny with it
22:12:46Jehan_Plus, a language cannot protect against all bad behavior.
22:13:20renesacwell, what Jehan_ said is somewhat the compiler doing something funny
22:13:21Jehan_Try calculating fib(100) with a recursive fibonacci implementation and your program will essentially become unusable, too.
22:13:24renesacfor performance
22:13:37Jehan_renesac: Huh?
22:13:47Jehan_No, this was just about memory layout.
22:13:50renesacor not
22:14:07renesacbecause [] is just a pointer arithimetic operator in c,...
22:14:17renesacsyntax sugar
22:14:19reactormonkAraq, from what I can read you basically run the compiler with a few if gCmd == cmdIdeTools: suggestStmt(c, a)
22:14:20Jehan_That said, one could add explicit null checks to be on the safe side if it were a pressing need.
22:14:41Araqyup and we have to do it for marketing reasons
22:14:46*gsingh93 joined #nim
22:14:59Jehan_The reality is that even in Rust the following program crashes: fn main() { if true { main(); } }
22:15:07Araqbut it's very telling how far from reality these discussions really are
22:15:17renesacand yes, languages like rust overemphasizes the importance of the types of safety it gives, IMHO
22:15:27Jehan_There's so much stuff that a compiler can't really protect against.
22:15:38reactormonkwhich would kinda explain the whole problem... I ran compileProject before the first suggest, and now it doesn't suggest anything anymore because the compiler isn't compiling anything because it's all cached
22:15:55reactormonkat least I now know the cache is working as intended
22:16:25Jehan_reactormonk: And that's actually a good example. You're about a 100x more likely to have a bug because of faulty cache logic.
22:16:35*boopisaway is now known as boop
22:16:52reactormonkJehan_, it's not faulty in general, it just not doing as expected
22:16:57AraqJehan_: iirc Microsoft's compiler can emit stack overflow checks and null pointer deref checks when the offset is too large
22:17:11Araqin fact, that's what the JVM does
22:17:12Jehan_The thing is, as someone who at some time actually did write formal specifications (in Z), I have no clue why everybody seems to think that type systems protect them against all flaws.
22:17:13*BlaXpirit quit (Remote host closed the connection)
22:17:32Araqemit a check when the offset is too big, rely on some segfault handler otherwise
22:17:33Jehan_reactormonk: I wasn't picking on you, I was just pointing out that getting cache logic right is a difficult issue.
22:18:26Jehan_Araq: Yeah, you can. But even so, there are so many bugs that occur even though they are "safe" (the quotes are intentional).
22:18:49Jehan_The last line effect, for example: http://www.viva64.com/en/b/0260/
22:18:54reactormonkAraq, there's two options. a) disable caching for nimsuggest. will make it SLOOOOW and probably unusable b) cache all suggest* calls and replay them c) cache all suggest* calls and figure out how a better way than replaying them
22:19:03reactormonkactually, three.
22:19:59Jehan_Program correctness requires a multi-faceted approach and static typing does not sprinkle fairy dust on your code that makes bugs magically go away.
22:20:37flaviuHow would I do [1.. ^1] on a user-defined type?
22:20:39renesacreactormonk: you could hash some way the calls to decide if an identical call was already made or not
22:20:48renesacwith high probability
22:21:01reactormonkrenesac, high probability? hello, bloom filter
22:21:05renesac:P
22:21:06flaviuHow does the special-casing work?
22:21:18reactormonkflaviu, special-casing?
22:21:28flaviufor [1 .. ^1].
22:21:48*Kingsquee joined #nim
22:21:49vikatonJehan_, in all fairness, They try to eliminate segfaults, data races etc etc
22:21:53vikatonand they have done a good job
22:21:57reactormonkprobably converted to len(seq) - 1 - x
22:22:13vikatonRust isnt perfect, but it sure does help with mem saftey
22:22:30Jehan_flaviu: You need to define len(x) for the type.
22:22:43Jehan_vikaton: I know what they are trying to do, and it's worthwhile.
22:23:00vikatonHowever it does provide extra headaches
22:23:14Jehan_But it also has left a large footprint on the language and the code you write.
22:23:35vikatonwhats a footprint in this case?
22:24:01renesacreactormonk: well, you can make a hash table where the final step compares the whole contents of the call
22:24:01Jehan_vikaton: Making the language and programs bigger and noisier to carry the additional information required.
22:24:15Jehan_Programming language design is the art of tradeoffs.
22:24:16vikatonTrue
22:24:23*dtscode quit (Ping timeout: 258 seconds)
22:24:30vikatonEhh Idk about that :)
22:24:33Jehan_There are definitely areas where the Rust approach has just the right tradeoffs.
22:24:42Jehan_TANSTAAFL, in other words. :)
22:25:02vikatonCrystal seems to be my best trade
22:25:04reactormonkrenesac, I'll wait for Araq, I can run some counts meanwhile
22:25:23*boop is now known as boopisaway
22:25:45Jehan_vikaton: For what it's worth, none of the languages I know of has perfect tradeoffs for the use cases I need. So I stick with the ones that come closest.
22:25:48Jehan_E.g. Scala and Nim.
22:26:11reactormonkrenesac, actually, might be a bit ugly. pretty sure PContext is changed
22:26:26Jehan_Ruby if I need to script something fast. And a few others.
22:26:37Jehan_It's always good to be proficient in more than one language. :)
22:26:47vikatonI want to ask a question
22:26:51reactormonkJehan_, ruby for scripting, nim for speed, scala for money here ;-)
22:26:56renesacreactormonk: well, this should be solvable if the cache is to work at all, right?
22:27:01Jehan_reactormonk: Heh. :)
22:27:01vikatonLets take Nim v C++
22:27:20vikatonWhy does Nim have much more elegant syntax + speed
22:27:21Jehan_I have a small Nim project where I use ruby to generate Nim code.
22:27:27Jehan_vikaton: Does it?
22:27:41vikatonwhile C++ can get verbose or the most part
22:27:42Jehan_It's entirely subjective. Some people hate whitespace-based syntax.
22:27:52vbtt_They're wrong, of course.
22:28:04vbtt_;)
22:28:42Jehan_Personally, I like Pascal-style (well, Eiffel-style, to be precise) syntax, but nobody makes languages with that anymore.
22:28:44vikatonhmm
22:29:06vikatonDont you see a huge paradigm of syntax between C++ and Ruby?
22:29:09Jehan_In the end, as long as the syntax doesn't make me hit my head against a wall, I'm fine with pretty much anything.
22:29:21Jehan_Paradigm of syntax?
22:29:22vikatonsyntax difference*
22:29:45Jehan_Well, yeah, there are plenty of differences. Why?
22:29:48reactormonkrenesac, we're talking 300k calls here.
22:30:59vikatonJehan_, It takes half the time to create something in Ruby then it is C++, let's imagine Ruby was as fast for a second, why would people continue C++ ?
22:31:17renesacreactormonk: is it somewhat recursive, so you can cache closer to the base cases that won't change as much?
22:31:20reactormonkvikaton, I like types
22:31:21Jehan_vikaton: Because they've got resources invested in C++.
22:31:24reactormonkrenesac, unlikely
22:31:38reactormonkrenesac, I just counted proc suggestExpr*(c: PContext, node: PNode) =
22:31:42Jehan_Plus, it's about more than time to create something; it also has to be maintainable.
22:32:04reactormonkwhich is basically where all the suggest calls go through once
22:32:13Jehan_There's some research that one of the major benefits of static typing is that they serve as self-verified documentation, making maintenance easier.
22:32:16vikatonreactormonk: imagine that added into Ruby
22:32:33reactormonkvikaton, no method_missing magic anymore
22:32:58vikatonwait wut
22:33:55Jehan_For what it's worth, I wrote an Eiffel compiler in Ruby for my Ph.D. thesis (before Ruby was popular).
22:34:15AraqXD
22:34:34Jehan_That worked pretty well for getting it implemented fast (two months), but ... it was difficult to maintain without having type annotations.
22:34:42AraqI ignored Ruby before it was popular... :P
22:34:47vikatonJehan_, port it to Crystal !
22:34:52Araqand I'm still ignoring it
22:35:01vikatonI love Ruby :((
22:35:09notfowlA reason to use c++ over ruby? Ruby has broken backwards compatibility several times since version 1.8.
22:35:17Jehan_vikaton: I'll have yet to see where crystal is going.
22:35:24renesacreactormonk: I was just wondering that if the PContext changes inviabilizes caching at that level, then one should cache in a lower level
22:35:29renesacbut I don't know the code
22:36:04Jehan_It looks really nice for small programs, but how well will a JIT approach from source work for programs hundreds of KLOCs in length?
22:37:13Araqvikaton: I don't like the attitude behind Crystal. it starts with the premise that "Ruby is perfect, but too slow". That's not why you should start a new language. ymmv
22:37:14Jehan_Mercurial had to work pretty hard to keep Python start up time in check, and that's with just an interpreter.
22:38:07*filwit joined #nim
22:38:31Jehan_I have some tools that get called literally dozens of times during a build process.
22:38:48vikatonAraq, they want to make it as close to Ruby as possible, but like the blog about "Crystal, a different language" they are changing things that will make it better
22:38:52Jehan_Nim happens to be perfect for that, because it has next to no startup overhead and is still reasonably expressive.
22:39:10Jehan_While, much as I love Scala, the JVM startup time is prohibitive for that.
22:39:29flaviuIsn't Crystal AOT?
22:39:54Jehan_flaviu: Is it? Whenever I tried it, I ran it on a .cr file and didn't see any object code produced.
22:40:56vikatonyeah @ flaviu
22:40:59Jehan_flaviu: Mind you, I may be totally wrong there, it's been a while.
22:41:28Jehan_Hmm, it looks like it caches compilation results.
22:41:36vikatoncrystal text.cr - runs it like its interpreted, but its really compiles
22:41:47vikatoncrystal build text.cr makes the executable file
22:41:54vikatonbut does not run
22:41:58Jehan_I see.
22:42:15Jehan_Nevermind then. :)
22:42:25*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:42:37Araqvikaton: Nim is as close to Python as possible except for all its improvements then ;-)
22:43:27vbtt_Python is better than Ruby so it's a win :)
22:43:33Jehan_vikaton: In any event, Crystal is one of the languages I'm watching. I'll wait until it approaches stability, though.
22:44:07vbtt_nim is more mature than crystal, imo
22:44:34vikatonvbtt, Idk about that tbh
22:44:59vikatonIt would seem like it should be, since Nim is not as new and is 0.11
22:45:11*vendethiel quit (Ping timeout: 244 seconds)
22:45:16vikatonbut since Crystal is basically like Ruby, you can seach for the methods in ruby docs
22:46:27dom96Jehan_: What do you think of Rust?
22:46:48Jehan_dom96: As a research project, thoroughly fascinating.
22:47:13Jehan_But it offers me nothing for the application domains I require.
22:48:01filwitRust's compiler probably helps you catch a few nasty concurrency related memory errors, which is nice. Gotta give em that.
22:48:19Jehan_Most of the stuff I do is about algorithmic correctness (non-trivial one at that), not the type system.
22:48:48dom96I see.
22:48:54vikatonNim's Type system and Rust's are very much alike
22:49:09Araqwhat? o.O
22:49:18Jehan_filwit: I'm not a big fan of their approach to concurrency. Again, there's nothing wrong with it, it just doesn't help me.
22:49:59vbtt_what's similar about rust and nim's type systems?
22:50:09reactormonkAraq, mind giving me an answer?
22:50:18Araqreactormonk: what's the question?
22:50:31reactormonkAraq, there's three options. a) disable caching for nimsuggest. will make it SLOOOOW and probably unusable b) cache all suggest* calls and replay them c) cache all suggest* calls and figure out how a better way than replaying them
22:50:31vikatonor maybe I'm not using the right terms
22:50:34Araqvbtt_: it uses colons ;-)
22:50:54Jehan_filwit: I do work in computer algebra. I need tools that are flexible and are capable of operating at a high level of abstraction, but don't bog me down in details.
22:50:55vbtt_:)
22:51:02Araqreactormonk: the caching already exists, if it's wrong fix it
22:51:19reactormonkAraq, compiler caching or suggest caching?
22:51:19Araqdisabling it is not an option
22:51:22vikatonActually scratch that
22:51:33reactormonkfigured as much
22:51:46Araqreactormonk: there is only 1 caching
22:51:49filwitJehan_: Well IIRC Rust's ownership tracking will prevent you from writing to memory from one thread to another accidentally, while Nim currently doesn't (due to lack of deep immute or similar ownership tracking)
22:51:53Araqwhich is the module cache
22:52:25Jehan_filwit: I'm not saying that Nim is my perfect language for everything. I use it for a subset of the things I need.
22:52:26vbtt_btw, what's the status of nimsuggest? not-quite-ready/ alpha / beta quality?
22:52:38reactormonkvbtt_, doesn't work imo
22:52:44Jehan_Most actual computer algebra stuff happens in specialized languages.
22:52:44Araqfilwit: we do deep copying instead.
22:53:05Araqvbtt_: works well for me
22:53:06reactormonkAraq, yup, and as soon as a file hits the module cache there's no suggestions from that file anymore because the compiler never passes over it - that's my theory
22:53:13vbtt_thanks reactormonk - i couldn't compile it so was wondering if I should fight the fight
22:53:16Jehan_filwit: In general, Nim is also a bit low level for many of the things I need (but is great for the system level tooling that I have to do).
22:53:18*vikaton quit ()
22:53:25reactormonkvbtt_, ah, yup. just compile it in the compiler dir
22:53:43vbtt_hm ok i'll try that
22:53:59Araqvbtt_: 0.11.2 has some docs about it
22:54:02reactormonkvbtt_, nim c nimsuggest.nim && cp -f nimsuggest ../../bin/nimsuggest
22:54:27filwitAraq, yeah I agree that's a good solution to the problem, and when we have it that will be very cool. I'm just giving credit where it's due ATM (unless you've recently made deep immute or something and I'm just out of the loop).
22:54:59Araqhrm? it does deepCopy. since 0.10.x
22:55:04vbtt_i thought i followed the docs on the site. http://nim-lang.org/docs/nimsuggest.html#installation
22:55:06notfowlThere's a lot wrong with crystal. For ex you can't redefine a method after its been used. Well you can, it silently fails
22:55:09vbtt_didn't work for me :(
22:55:14vbtt_but will try again.
22:55:59Jehan_filwit: For what it's worth, there are plenty of existing alternative solutions.
22:56:12Jehan_They've just been studiously ignored by mainstream programming languages.
22:56:24reactormonkso nimsuggest actually works in aporia? ...
22:56:26filwitAraq: err... i a parrallel test of mine messing up due to lack of deep-immute parameters not that long ago.. but maybe I need to rerun those tests.. sorry not trying to spread bad info..
22:56:49Araqfilwit: that bug has been fixed and had nothing to do with 'parallel'
22:56:57Araqor 'spawn'
22:57:31filwitJehan_: Well i'm certainly no expert here (quite the novices actually)
22:57:51filwitAraq: ah, okay.. that was a huge misunderstanding on my part then.. :|
22:58:28Jehan_Safe concurrency has been around since the 1970s/1980s (Concurrent Pascal, CLU/Argus, Eiffel/SCOOP).
22:58:32vbtt_rust doesn't even allow two mut reference to the same object in the same thread.
22:58:52flaviuI need a temporary variable in a macro, how would I do that?
22:59:07Araqflaviu: macros.gensym
22:59:29flaviuthanks!
22:59:32Araqfilwit: also the major problem is that imho nobody has yet figured out how to do multi-threading in a game engine. afaict.
22:59:43filwitJehan_: well like Araq said, deep immute is something I thought Rust did that Nim did not, which apparently is wrong.. and that was the entire basis for my initial claim that Rust would catch nasty memory bugs.
22:59:53Jehan_Araq: Games have their own sets of interesting constraints.
22:59:56Araqfilwit: no no no, sorry
23:00:23Jehan_filwit: Rust doesn't really worry too much about immutability (they got that right, in my opinion), but about safe sharing.
23:00:27Araqfilwit: Rust has deep immutability. Nim has deep copying. you're right there is a big difference.
23:00:32*reactormonk quit (Quit: WeeChat 0.4.3)
23:00:56Jehan_My problem is that they try to solve that problem at compile time, which, in my experience, lacks expressiveness and saddles you with a lot of bookkeeping.
23:01:15filwitwell threading is used a ton in games.. just not to update certain steps of the pipeline like game-logic (so far as I'm aware.. so yeah, take that with salt)
23:01:43filwitAraq: ahhhh okay i get it
23:01:54Jehan_filwit: The last time I wrote a computer game was in school, that was on an eight-bit computer in Z80 assembler. :)
23:02:14filwitnice :)
23:02:29Jehan_Meaning that my practical experience in the area is rather limited. :)
23:02:31Araqfilwit: yes but it's *far* from a solved problem
23:02:53*vendethiel joined #nim
23:03:44Araqand the solutions I know all use a single shared heap aka C's malloc and then blame Nim for its GC instead of its thread local heap. ;-)
23:04:31filwitAraq: i have some interesting ideas here actually.. namely semantic scanning for GameObject references which is used to divide the objects into concurrently separate parts automatically (so you can at least thread some of it automatically where possible)
23:05:31Jehan_One thing about concurrency is that there's really no single "one size fits all" solution.
23:05:48filwitAraq: also, I am not afraid of unsafe memory, so Nim's unmanaged shared memory for something as tightly controlled as the game object management/event dispatch doesn't bother me :)
23:06:25*LoneTech quit (Ping timeout: 264 seconds)
23:06:33*LoneTech joined #nim
23:08:03AraqJehan_: yeah but multi-threading a game engine, solves a real problem. multi-threading an async http server... doesn't. :-)
23:08:21Jehan_Araq: Heh, yeah.
23:08:25filwitJehan_, Araq: If I could switch gears here for a sec, I want to let you know I've jotted down a 'pros/cons' list + reasoning about my constructor's side-project: https://gist.github.com/PhilipWitte/0ca58b9655a6f3fd8ff0#file-pros-cons-md
23:08:39filwitJehan_, Araq: I'm not looking for your feedback on that right now
23:09:06*boydgreenfield quit (Quit: boydgreenfield)
23:09:21filwitJehan_, Araq: I just wanted to let you know I fleshed out my reasoning a bit about what I'm going to be attempting to do soon.
23:09:42Jehan_filwit: Glancing at it, I believe my objections still stand.
23:09:53Jehan_Again, not that this matters. You'll have to convince Araq, not me. :)
23:11:00filwitJehan_: okay, noted, and we don't need to go over the points again.. we really need to sample a larger community, but the only way to do that is with a working system IMO.
23:11:06Jehan_In particular, it's still not backwards-compatible, as far as I can tell.
23:11:09*reactormonk joined #nim
23:11:19filwitJehan_: actually I realized it is fully
23:11:49filwitJehan_: in fact, the one that isn't backwards compatible is the "limit obj constructors to their modules" approach
23:12:14Jehan_filwit: I know that, this is why there's probably going to be based a pragma-based solution.
23:12:27Jehan_But it can still break existing uses of T() and T(x).
23:13:59filwitno, because it only invokes 'create' if one exists.. so you're right, it could actually break *some* code where a 'create' function existed and wasn't expected to be invoked as a constructor.. but those cases should be rarer
23:14:56filwitmost of the time all existing code would do exactly what it does now for T() and T(x).. things only change *after* you add in the 'create' procs
23:15:51*pondererer joined #nim
23:16:04ponderererhttps://www.quora.com/Is-Nim-really-that-unsafe
23:16:09*pondererer quit (Client Quit)
23:16:37*Matthias247 quit (Read error: Connection reset by peer)
23:17:09Jehan_So, if there's a create routine, you suddenly cannot do type conversions anymore or instantiate a new object based on its type?
23:17:39Jehan_I'm really not sure why this particular syntax is so important ...
23:19:31*milosn quit (Ping timeout: 250 seconds)
23:19:31filwitwell the point isn't about the syntax.. in fact your question is exactly what we want the possibility to do (limit the constructor of a type to a specific path unless you go outside of your way to do it)
23:20:14*milosn joined #nim
23:21:41notfowlHow is that even a question
23:21:52filwitI did look at your 'make' macro, and I like it (I use named constructors bond to types in my code).. but the problem is that the most obvious syntax for creating types is artificially limited as a instantiate method for most types
23:22:11notfowl"Is Nim really that unsafe?" What is the context
23:25:12*vendethiel quit (Ping timeout: 272 seconds)
23:25:23filwitJehan_: you do raise a good point about type conversion though.. I image sometimes you'd want a 'create(t:var T, u:U)` proc and still keep type-conversion to other types, while other times you would want to limited them entirely.. I think this could probably be addressed with a pragma though
23:26:02Jehan_notfowl: No explicit nil checks, apparently, but relying on segfaults.
23:27:50*gokr quit (Quit: Leaving.)
23:31:42*wb quit (Ping timeout: 252 seconds)
23:33:06*Jehan_ quit (Quit: Leaving)
23:34:14*saml_ joined #nim
23:37:48def-notfowl: I guess this is the context: https://news.ycombinator.com/item?id=9050999 I see this repeated whenever Nim is mentioned somewhere
23:38:26*Kingsquee quit (Quit: Konversation terminated!)
23:39:19reactormonkAraq, ok, if I reset gCompiledModules and gMemCacheData it keeps working, so I gotta dig in there and see what goes wrong
23:41:22*vikaton joined #nim
23:41:40vikatonHOw do I download http://nim-lang.org/download/nim-0.11.2.tar.xz from a VPS ._.
23:41:45vikatonI completely forgot
23:41:48def-vikaton: wget
23:42:06vikatono w000w
23:42:12*redwyn quit (Quit: leaving)
23:44:11*vbtt_ quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
23:51:44*dtscode joined #nim
23:53:32vikatondef-, after adding export PATH=$PATH:/root/nim-0.11.2/bin/ in my bashrc, do I reboot?
23:53:42*Kingsquee joined #nim
23:53:45vikatonor make changes go in affect?
23:53:51*gsingh93 quit (Ping timeout: 276 seconds)
23:53:57flaviuvikaton: Reboot linux? What sort of madness is this oO
23:54:00dom96vikaton: source .bashrc
23:54:16def-vikaton: you could log out and log in again, or source the file, or do the export in your shell
23:54:30vikatonNope, got it, thanks def- !
23:54:31def-or restart of course, if you really want to
23:54:42vikatonI reboot my linux all the time!
23:54:59dtscodeWhen in doubt turning it off and on is always the answer
23:55:30flaviudtscode: Nothing ever goes wrong ;)
23:55:42dtscodeNever :D
23:55:49Araqvikaton: you should only reboot linux for trying a different distro.
23:56:01Araqand you should try a different distro every day.
23:56:19dtscodeWhich is generally faster? A dispatch table, or if-chain calling functions?
23:56:24vikatonI see
23:56:34Araqif-chain
23:56:43dtscodeThanks Araq
23:56:54flaviuOr when your graphics card either got damaged by static or got messed up by factory and crashes whenever you don't run it at half clock speed
23:57:30vikatonHow good is Nim with functional programming aspects?
23:57:48dtscodeAs good as any other language
23:57:55AraqNim is better than you are at FP
23:58:02flaviuStdlib support is lacking, and lambdas are a little verbose.
23:58:03dtscodeThan me?
23:58:23flaviuexciting changes coming to lambdas though, and you can always write your own stdlib.
23:58:37Araqdtscode: no vikaton
23:58:58vikaton:(
23:59:02vikatonu dont know that :(
23:59:10dtscodeAraq: Ah. Well the statement still fits for me :D
23:59:11dom96flaviu: what exciting changes?
23:59:14dom96aww poor vikaton
23:59:33Araqvikaton: silly questions sometimes get you a silly answer
23:59:38dtscodedom96: I've been meaning to ask you a question
23:59:42flaviuAraq: Didn't you say that you like the `_` syntax at one point?
23:59:42Araqsorry!
23:59:53vikatonWell mainly