<< 17-05-2015 >>

00:13:38*boop is now known as boopisaway
00:30:16*fowl joined #nim
00:37:08*BitPuffin|osx joined #nim
00:41:34*notfowl joined #nim
00:42:35*fowl quit (Quit: Leaving)
00:43:02*notfowl is now known as fowl
00:58:55*Matthias247 quit (Read error: Connection reset by peer)
01:06:15*saml_ joined #nim
01:09:56*brson quit (Quit: leaving)
01:11:47*vikaton joined #nim
01:12:28vikatonis there a bot her eI cna test with?
01:23:36*vikaton quit ()
01:23:55*filwit quit (Quit: Leaving)
02:32:13*gsingh93 quit (Ping timeout: 265 seconds)
02:35:13*darkf joined #nim
02:56:32*akiradeveloper joined #nim
03:12:25*akiradeveloper quit (Remote host closed the connection)
03:15:25*akiradeveloper joined #nim
03:29:37*dtscode joined #nim
03:35:41*BitPuffin|osx quit (Ping timeout: 250 seconds)
03:43:25*pregressive quit (Remote host closed the connection)
03:44:23*akiradev_ joined #nim
03:44:54*akiradeveloper quit (Read error: No route to host)
03:51:41*ddl_smurf quit (Quit: ddl_smurf)
03:56:21*Kingsquee is now known as Takeisquee
03:56:28*Takeisquee is now known as Kingsquee
03:57:27*elbow_jason quit (Ping timeout: 276 seconds)
04:24:16*intra quit (Ping timeout: 255 seconds)
04:32:13*akiradev_ quit ()
04:34:31*Perelandric quit (Ping timeout: 246 seconds)
04:35:32*vbtt_ joined #nim
04:40:22*vbtt_ quit (Client Quit)
04:40:39*vbtt_ joined #nim
04:50:34*mrkishi joined #nim
04:51:41*mrkishi quit (Client Quit)
04:55:55*akiradeveloper joined #nim
05:19:33*saml_ quit (Ping timeout: 258 seconds)
05:37:28*Jesin joined #nim
05:49:22*vbtt_ quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
05:58:01*dtscode quit (Ping timeout: 252 seconds)
06:14:06*dtscode joined #nim
06:17:09*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
06:31:09dtscodeHow do you turn a float to a string? Like 10.0 -> "10.0"
06:35:43*d3m1gd joined #nim
06:47:11dtscodeOh duh... $
06:56:07*gamesbrainiac joined #nim
07:01:40*akiradeveloper quit ()
07:15:27*akiradeveloper joined #nim
07:22:29*jbomo quit (Ping timeout: 272 seconds)
07:38:10*boopisaway is now known as boop
07:48:16*Wicked joined #nim
07:49:45*akiradeveloper quit (Remote host closed the connection)
07:49:58*akiradeveloper joined #nim
07:53:36*zahary joined #nim
07:54:16*Demon_Fox joined #nim
08:02:06*gmpreussner|work quit (Read error: Connection reset by peer)
08:16:26WickedI've got a little problem. http://pastebin.com/WKePmuSX : "error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed [SslError]". I'm trying to connect to Google via HTTPS. The problem seems to come from my certificate. I generated it with this command found in the net.nim source code : https://github.com/Araq/Nim/blob/devel/lib/pure/net.nim#L205 . So, what should a client certificate look like ?
08:16:36Wicked(Thanks in advance)
08:48:44*iamd3vil joined #nim
08:54:14*yglukhov_____ joined #nim
08:58:34*yglukhov_____ quit (Ping timeout: 245 seconds)
08:59:10*akiradeveloper quit ()
09:23:30*BlaXpirit joined #nim
09:23:37*iamd3vil quit (Ping timeout: 246 seconds)
09:28:49*Kingsquee quit (Quit: Konversation terminated!)
09:41:32*Matthias247 joined #nim
09:42:51*yglukhov_____ joined #nim
09:48:14*iamd3vil joined #nim
09:59:05*OnO joined #nim
10:07:16OnOhi
10:11:18OnOAraq: glad to catch your attention
10:12:03OnOactually I found out that db_* modules could be optimized much better
10:12:15OnOthe problem is that they rewrite strings for each row
10:12:26OnOeven the program uses a fraction of the information
10:12:54OnOthat's the reason of this ((pure)) proposition to be able to perform lazy evaluation
10:16:57*akiradeveloper joined #nim
10:35:43*iamd3vil quit (Ping timeout: 246 seconds)
10:41:43BlaXpirithttp://habrahabr.ru/post/258119/
10:42:32BlaXpiritdef-'s article translated on a very popular russian website
10:43:13BlaXpiritwish i could comment there. you can't simply make an account there
10:54:03def-BlaXpirit: oh, great!
10:54:59*Wicked quit (Quit: Page closed)
10:55:32BlaXpiritbtw it's not "stolen", it is marked as a "translation" and there is a link "Dennis Felsing"
10:56:14def-Too bad they didn't embed my javascript to count the visitors
10:56:26BlaXpirityou can't do it there
10:56:36*vendethiel joined #nim
10:57:07BlaXpiritthey linked to the counting page though
10:57:26BlaXpirit"You're visitor number 195, unique visitor number 82 today"
10:57:39BlaXpiritcoincidence? i think not
11:05:30*banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:05:47*Trustable joined #nim
11:16:53BlaXpiritseriously a big pity that nobody with enough knowledge will be able to comment there
11:17:25BlaXpiritnow they're writing you can't write firmware and kernels
11:17:33*dddddd quit (Ping timeout: 244 seconds)
11:30:53BlaXpiritnow the russian guy inquires here https://github.com/Araq/Nim/issues/2746
11:36:25*Demon_Fox quit (Quit: Leaving)
11:39:35AraqOnO: cannot follow you at all
11:40:01OnOlet my try to explain again
11:41:46OnOnoSideEffect purpose it to optimize out unnecessary calls that only modify memory that is later anyway going to be discarded
11:42:26OnOif compiler can prove that value returned by noSideEffect is not necessary it can skip generating the call
11:43:13OnOif this is it, then it is inline with GCC pure attribute definition: Implications of pure and constant functions https://lwn.net/Articles/285332/
11:43:50OnOnow... going back to my subject, it to optimize db_* API calls and actually fetch the row data only when it is necessary
11:44:22OnOso in my opinion all "get_row_string_at_index" should be ((pure)) in terms of GCC
11:44:44OnOthen actually we can C gen these calls and let C compiler to remove them
11:45:30OnOthe problem with current implementation is however it does actually (1) copy ALL values of each rows into Nim's strings during iteration (2) there is NO way to skip copying values that are later not used
11:45:56OnOso if Nim is suppose to be next gen solution for Web or Db apps, then current implementation sucks very much at it
11:46:58OnOthat's it, let me know if this is somehow more clear to you
11:47:05Araqyou still haven't explained much
11:47:29Araqif I request a select a, b, c from foo why do you think I don't need a, b, c?
11:48:03Araqhow is .noSideEffect helping with anything here? and if it is, why not let Nim optimize it away
11:48:25Araqwe don't have to rely on GCC for this
11:48:47OnOrequiring explicitly state what fields needs to be fetched just suck.. it is compiler that should trace which fields are actually used in the code
11:49:48def-OnO: how can a database call even have no sideeffects? What if someone else changes the database between 2 calls?
11:50:24*milosn quit (Quit: leaving)
11:50:34OnOdef-: you are confusing const with no side effect
11:50:54OnOget_row_string_at_index is not going to change any global state
11:51:02OnOthat's why it has no side effects
11:51:09BlaXpirittechnically it probably is going to change a lot
11:51:22def-but it depends on the global state of your database?
11:51:56OnOso if you have let user_name = get_row_string_at_index(row, 1) and later not use user_name variable, then Nim or C compiler can safely remove get_row_string_at_index call
11:52:52def-but GCC might also see that you called get_row_string_at_index() twice with the same arguments and remove the second call, no?
11:53:25OnOno!
11:53:29OnOconfusing const
11:53:35OnOconst is always returning same value
11:53:43OnObut pure just does not modify any global state
11:53:52BlaXpiritOnO, you're confused.
11:54:01def-when something has no side effects and gets called twice with the same arguments, it will always return the same value
11:54:15OnOnot true sorry
11:54:21*banister joined #nim
11:54:41OnOlet a = no_side_effect_call(); side_effect_call(); let b = no_side_effect_call()
11:54:45OnOis a == b, no
11:55:11Araqit's true for Nim though. you have to treat the database as a hidden global variable
11:55:35BlaXpirit"If a pure function is called with arguments that cause no side-effects, the result is constant with respect to that argument list (sometimes called referential transparency), i.e. if the pure function is again called with the same arguments, the same result will be returned (this can enable caching optimizations such as memoization)."
11:57:30OnOBlaXpirit: this is definition of "pure" taken from where?
11:57:35BlaXpiritwikipedia
11:57:41Araqand it's an optimization that modifies behaviour:
11:57:43OnOI am talking of GCC ((pure))
11:57:50OnOnot GCC ((const))
11:58:05Araq let unused = access("invalid_db_field")
11:58:18OnO"Many functions have no effects except the return value and their return value depends only on the parameters and/or global variables. Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be. These functions should be declared with the attribute pure."
11:58:31Araq--> db exception unless optimized away?
11:58:33OnOdepends only on the parameters >>and/or global variables<<
11:59:04OnOremoving global dependency makes you ((const)) or BlaXpirit's wikipedia "pure"
11:59:11Araqand your quote suggests common subexpression elimination is performed
12:01:23OnOyes, but also matches definition of read-only access to the global state which is what db API row value readers do
12:03:42*bjz joined #nim
12:04:33Araqso how do you generate 'select' statements? if you generate 'select * ' it's downright broken already.
12:04:53*ddl_smurf joined #nim
12:04:56Araqcause tables can grow new fields
12:07:23Araqand if you pick the field names from an object type, I cannot see how let x = select(..); # oh! x.bar unused later! is an easily available optimization
12:09:00OnObecause row iterator will will all fields of your object model, eg. user.name = rowval(r, 0); user.id = rowval(r, 1); user.pass = rowval(r, 2)
12:09:26OnOthen compiler can see you don't user user.pass anywhere so it can eliminate 3rd call to rowval
12:09:45OnOgiven that model can have many fields it will likely eliminate most of the calls
12:10:11OnOgiven that rowval (or their actual impl) actually fetch real data this is real optimization
12:11:32OnORuby's ActiveRecord tries to solve that with some higer abstraction using so called lazy accessors
12:11:59OnObut actually this can be done at C compiler level, no need for such abtractions
12:13:37*wan quit (Quit: WeeChat 1.1.1)
12:23:17*akiradeveloper quit ()
12:27:36*bluenote_ joined #nim
12:33:26Araqagain, where does the (name, id, pass) tuple come from?
12:33:37Araqwhy assume it's unnecessary?
12:34:29Araqif I pass tuple[name, id, pass] or its object equivalent to your ORM, why not do what I told the ORM to do?
12:36:00Araqand yes, it's easy enough to transform let unused = foo() to 'discard foo()' and then make a TR macro perform this optimization
12:36:33Araqbut I don't see the point to burden us what that minor detail for now
12:37:16Araqand note that 'let unused = foo()' is quite different from obj.unused = foo()
12:37:25Araqbbl
12:40:02OnOokie
12:43:33OnOAraq: I expect ORM to work other way around, I ask for model instance from db that matches some predicate, the model instance must be complete to the code that manipulates it, which means any field of the model should be materialized from db
12:44:29OnOORM does not see so much of surrounding code to be able to decide some of field loads can be skipped, this will require ORM "where" iterator to deeply analyze its block
12:45:17OnOI was considering that, but the block itself may call other procs, and such analysis would be even harder
12:47:13OnOas for detail burden, such details are reason to make Nim actually superior to existing solutions, otherwise Nim will be yet another solution that does things exactly the same as Ruby
12:47:42OnOmoreover optimization and compilers are fields of my interest that's why I dig this subject
12:49:07OnOalso analyzing existining solutions, reason that ActiveRecord in Ruby suck is the exactly that it loads unnecessary data from db to the model, that later is not used for anything
12:50:11OnOunfortunatelly Nim's db_* does exactly the same, copy all fields from row into seq[string] on each iteration
12:50:30bluenote_how can I assert a compilation error in a unit test?
12:50:51bluenote_"when compiles(badMacroCall): check false" does not seem to do the job
12:50:54OnOof course we can require developer to explicitly state which fields he will later use, but this is in contradiction of designing smart compiler that can infer this information from code iself
12:51:15OnObluenote_: {.error.} or {.fatal.} pragma
12:52:13bluenote_thanks!
12:58:44bluenote_hm, where am I supposed to place the pragma? neither "badMacroCall {.error.}" nor within the when block seem to be right
12:59:36bluenote_ok, got it :)
13:01:42*intra joined #nim
13:26:20*BitPuffin|osx joined #nim
13:29:24boophrm.
13:29:31boopwhat were the bugs fixed in 0.11.2?
13:30:17*filcuc joined #nim
13:36:14def-boop: https://github.com/Araq/Nim/commit/e23857a98bc1f682896910c545eb9eae7ff5225f
13:36:17def-https://github.com/Araq/Nim/compare/v0.11.0...v0.11.2
13:36:46boopi've realised that the arch package was lagging behind a bit so my GC crash might have been a 0.11 issue
13:37:00def-I don't think GC issues were fixed in 0.11.2
13:37:03boophmm
13:37:52def-but there currently is a PR pending for a GC fix https://github.com/Araq/Nim/pull/2671
13:38:03def-no idea if it's related to the problem you see
13:39:12ZZZZZZZZZOnO: i havent read all of what you said, but a function with a DB call to a bd cannot be pure
13:39:17ZZZZZZZZZever
13:39:26ZZZZZZZZZits the definition of unpure
13:39:54boopahh cool
13:40:12OnOI am talking about GCC ((pure)) attribute not other languages definition of "pure"
13:40:18boopI've updated to 0.11.2 anyway, we'll see what happens
13:40:35OnOGCC ((const)) matches what many define as "pure"
13:41:55ZZZZZZZZZi have no idea about GCC, all im sayin is, if you remove ANY db call
13:42:04BlaXpiritok, if you stress this enough times, people may start understanding you
13:42:05ZZZZZZZZZyou can alter the program significantly
13:42:05OnOnot any
13:42:16ZZZZZZZZZa database can have TRIGGERS
13:42:18ZZZZZZZZZon READ
13:42:22ZZZZZZZZZend of story
13:42:33ZZZZZZZZZso it cannot be pure
13:42:37OnOnot any calls just calls that read row value into memory
13:42:40ZZZZZZZZZwhatever gcc tells you
13:43:07OnOI said it explicitly I am talking about loading row value for cursor's row
13:43:32OnOif you are not going to use this value later, it is safe to remove call to "getrowval"
13:43:41OnOit can't break anything
13:44:47OnOfor sqlite example I am talking about removing sqlite_column_text if this value is not later used in the code
13:48:41OnOor safely removing pqgetvalue call for postgress
14:05:57ZZZZZZZZZim not familiar to the internals on those functions (sqlite_column_text), but it just returns a pointer to the value, im pretty sure its already in memory, since you did select x,y,z
14:06:13ZZZZZZZZZyou wouldnt save anything but the call
14:07:51ZZZZZZZZZand the pointer is valid until the next sqlite3_step(stmt);
14:08:16ZZZZZZZZZso yeh, you probably only save a simple function call, not much of an optimization
14:08:32ZZZZZZZZZfor all the headache it can cause
14:09:05ZZZZZZZZZjust optimize your request better, select less stuff
14:12:54OnObut I am pretty sure that result of sqlite3_column_text isn't in the memory :)
14:13:16OnOit actually creates some new buffer and does copy
14:14:22ZZZZZZZZZso it talks to the DB?
14:16:02ZZZZZZZZZisnt sqlite opensource? where the code
14:16:41boopsqlite or nim's wrapper?
14:16:59OnOZZZZZZZZZ: both are opensource
14:17:20ZZZZZZZZZnim wrapper does nothing on this, im talking sqlite
14:17:21boopsqlite is one of those magical projects that manages to be public domain
14:17:24boophttps://www.sqlite.org/src/tree?ci=trunk
14:17:42boopyou can probably find a mirror on github if you prefer that interface
14:17:43ZZZZZZZZZthx
14:17:59OnOhttps://www.sqlite.org/c3ref/column_blob.html
14:20:19OnOvdbeapi.c vdbemem.c
14:20:51OnOthere are lot of things happening in sqlite_column_text -> allocation, memory copy and encoding conversion
14:21:21OnOnow on other side take a look at Nim's db_sqlite.nim
14:21:47OnOrows iterator calls setRows for each iteration
14:22:13OnOsetRows calls sqlite_column_text for each column and converts it into string
14:24:17def-When I use the {.compile.} pragma I can't tell what language to compile with? I have some objective-c code and also want to compile and statically link C code when doing "nim cpp"
14:24:18OnOeverything works great if you use low level SQL based way of getting things out of the DB... if you write: select * then it is your fault that code will load column that are not necessary
14:26:00*Joe-T quit (Ping timeout: 276 seconds)
14:26:52OnOZZZZZZZZZ: but some high level abstraction such as ORM should infer information what columns are necessary from the code itself
14:27:43ZZZZZZZZZoptimize it inside the orm itself
14:28:06ZZZZZZZZZnot on the low level database api
14:28:07*mrkishi joined #nim
14:28:11OnOfor user in User.where(@pass == "123"): echo user.name rather than for user in User.loadOnly("name").where(@pass == "123"): echo name
14:28:41ZZZZZZZZZthats the orm job to optimize it
14:28:56boopdef-: i'd assume you can only use c++ in that case..
14:29:02*Joe-T joined #nim
14:29:12def-boop: meh, why not use 3 languages at the same time?
14:29:21boopbecause it's compiled to a certain language
14:29:32boopand i doubt c and obj-c will play nice
14:29:34def-linking c++ with c object files doesn't work?
14:29:44boopc/c++ should work fine
14:29:48boopobj-c no so much
14:29:49def-c and obj-c play nice, that works already
14:29:52boophmm
14:29:54boophuh.
14:29:55OnOZZZZZZZZZ: I'd aggree, but it would require some very complex analysis of stmt block passed to ORM call
14:30:07def-boop: I'm investigating because of statically linking nim-glfw
14:30:16ZZZZZZZZZsure but, marking sql_get_text or watever as pure
14:30:19ZZZZZZZZZwould affect everybody
14:30:25ZZZZZZZZZand screw everyone
14:30:25OnOZZZZZZZZZ: but actually C compiler does it already :)
14:30:36def-it works, but only because clang++ is nice enough to recognize that it's an objc file and compiles it as such
14:30:41OnOZZZZZZZZZ: how would it screw anyone?
14:30:49boopinteresting!
14:30:57boopi guess that's something that needs adding then
14:31:41ZZZZZZZZZanyway gtg
14:31:58OnOZZZZZZZZZ: how skipping call to sqlite3_get_text "char *unused_text_variable = sqlite3_get_text()" could affect your program
14:32:04boopin my mind cc, cpp, objc and js were all very separate and could only {.compile.} from their own language
14:32:09boop(well, not js, but you get what i mean)
14:35:26def-alternatively I could figure out why I can't link to glfw when I compile it with g++ (and why it doesn't even compile with clang++)
14:36:13*banister quit (Ping timeout: 256 seconds)
14:37:16*darkf quit (Quit: Leaving)
14:47:29*vbtt_ joined #nim
14:49:11boopproc setBlocking is mostly duplicated in sockets.nim (Socket) and rawsockets.nim (SocketHandle), and now i need to do it with FileHandle..
14:49:38boopis there a better way to structure this?
14:49:47boopor does it matter.
14:50:38boop...ah, sockets.nim is deprecated...
14:51:00*vbtt_ quit (Client Quit)
14:54:46boopis it better to use when false: or discard """ """ to disable blocks of code?
14:55:26dtscodeThe manual says discard
14:55:28boopmm
14:55:31boophttps://github.com/Araq/Nim/blob/devel/lib/pure/net.nim#L396 < looking at this
14:55:49boopconfused me until i read back
14:56:50dtscodeIsn't net.nim deprecated?
14:57:02boopsockets.nim is
14:58:57onionhammerdom96_ added benchmark code https://github.com/Araq/Nim/pull/2738
15:00:59dtscodeOh thats right
15:01:26boopbut, yes. i'll be duping the SocketHandle code for the FileHandle stuff which isn't ideal
15:01:35boopany ideas?
15:01:44dtscodeSo good news. Nimbus2 is eval()ing. I just have a million things to do Nimbus2 before its ready for shipping
15:02:04dtscodeBlaXpirit: Are you still on
15:02:08BlaXpirithello
15:02:36dtscodeWere you the one talking to me about Nimbus returning the result of the last expression?
15:02:51BlaXpirityes
15:03:03dtscodeAnd that is all you wanted it to do?
15:03:04BlaXpiritmy pull request turned out to be poorly thought out
15:03:19gamesbrainiacQuick question. Is nim ever getting go-like channels on a language level?
15:03:30gamesbrainiacI've been using them for quite some time now, and they're so so damn convenient :)
15:03:36BlaXpiritmaybe it already has them
15:03:44BlaXpiritand why hardcode them on language level
15:03:53dtscodeDon't worry. I can make it work. It turns out the debugger can do exactly this, and I was planning in running in a debugger anyways :D
15:03:55*milosn joined #nim
15:04:03BlaXpiritgood
15:06:10gamesbrainiacBlaXpirit Why do anytime on a language level? To make things convenient.
15:06:46BlaXpiritonly someone who doesn't know much about Nim would say this
15:06:47dtscodes/anytime/anything/
15:07:55gamesbrainiacBlaXpirit No argument there. I'm pretty happy with go, but I just wanted to explore nim as well. Hence the (noobish) query.
15:08:15gamesbrainiacdtscode thanks :)
15:08:24BlaXpirituhh this? http://nim-lang.org/docs/channels.html
15:09:16BlaXpiritthis idea has been around for ages. absolutely no idea why Go is praised. it has 0 originality
15:09:57gamesbrainiacBlaXpirit Some examples of usage would be helpful.
15:10:33gamesbrainiacLike, can you range over channels?
15:11:00*TEttinger quit (Ping timeout: 272 seconds)
15:11:17BlaXpiritI have never used this. https://www.google.com.ua/search?q=nim+site:nim-lang.org+tchannel
15:11:54gamesbrainiacBlaXpirit I think its more to do with ease of distribution than anything else.
15:11:59BlaXpiritthis looks like an OK example forum.nim-lang.org/t/959#5774
15:12:23BlaXpiritbut this is for threads
15:12:33BlaXpiritand maybe you're looking for asynchronous, i don't know
15:14:02gamesbrainiacWell basically any form of abstract concurrency.
15:14:16gamesbrainiacI want to use multiple cores without having to think too much about it :P
15:14:32boopIO or CPU bound?
15:14:42boopuse async for IO stuff
15:14:57gamesbrainiacCPU bound.
15:15:30boopmm. haven't messed with threads enough to help, sorry.
15:15:59BlaXpiriti don't know anything about them in nim, but the forum example i linked to should help
15:16:34gamesbrainiacforum post basically uses channel as a queue. Also says its not gc safe, which has me a little worried.
15:17:13BlaXpirithm yeah, that topic discusses problems with that code
15:18:00gamesbrainiachmm, I'll keep exploring things a bit more. but what have you been using nim for BlaXpirit ?
15:18:10BlaXpiritpretty much nothing
15:18:20BlaXpiritjust wrote a couple libraries
15:18:29BlaXpirittried to apply it for game dev, found it unsuitable
15:19:02gamesbrainiacBlaXpirit Rust seems to be the new favorite for developing game engines right now.
15:19:11BlaXpiritk
15:20:10def-gamesbrainiac: there's also one coming for Nim from what I've heard
15:20:31gamesbrainiac@def- the more the merrier :)
15:21:39*banister joined #nim
15:27:28*jbomo joined #nim
15:27:41*jbomo quit (Client Quit)
15:31:30*OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…)
15:32:52*bluenote_ quit (Ping timeout: 246 seconds)
15:34:18*Jehan_ joined #nim
15:37:58*dddddd joined #nim
15:39:20Jehan_boop: I looked through the IRC log and there is one known bug with the GC, but it only manifests on some architectures, and only with recent versions of gcc and optimization (especially --opt:size, but can also occur because of --opt:speed/-d:release). If it happens without optimization or with clang, it *should* be something else. Most commonly, GC problems occur because of incorrect usage of the FFI, or because of unintionally hiding a ref inside a
15:39:20Jehan_ heap-allocated ptr object without the proper precautions.
15:39:58boopi'm not 100% sure what c compiler this is using, let me check
15:40:08boopdoes nim use $CC?
15:40:54Jehan_It has a preset value for each architecture.
15:41:01*gamesbrainiac quit (Quit: Bye folks!)
15:41:07Jehan_Which is usually gcc on Linux, clang on OS X.
15:41:27*gamesbrainiac joined #nim
15:41:31booplikely gcc then, $CC is clang
15:42:02Jehan_Can be switched with (e.g.) --cc:clang.
15:42:44*boop nods
15:42:50boopwant me to try running with that?
15:43:07boopi've already updated to 0.11.2 and it hasn't crashed yet, but it takes a while to happen
15:44:07Jehan_boop: No idea if it'll fix it. It's a very obscure bug that only manifests under rare circumstances.
15:44:35*boop nods.
15:44:52Jehan_GC issues are most frequently due to a genuine bug.
15:45:48Jehan_I.e. using Nim's unsafe features (ptr types, addr, the FFI).
16:00:46*OnO joined #nim
16:00:47Jehan_gamesbrainiac: I presume that when you're talking about Go channels, you actually mean the full set of CSP (communicating sequential processes) features that Go has. This is very attractive, but is non-trivial to do: (1) It requires lightweight threads and to hardcode scheduler stuff into the compiler/code generation. (2) Go's threading model is not memory-safe, and it's a non-trivial effort to make it so (in particular, without losing thread-local variables).
16:00:48Jehan_(3) Blocking FFI calls can screw up the internal scheduler in a way that they can't with the OS scheduler.
16:01:57gamesbrainiacJehan_ Yea, Thats why go has its own scheduler in place to manage channels, so thats pretty useful.
16:02:28Jehan_gamesbrainiac: Yeah, but it does come with serious tradeoffs.
16:03:05gamesbrainiacJehan_ Possible overflows, but when you have stacks as small as 8kb for each coroutine, does it really matter all that much?
16:03:14Jehan_That said, at least coroutines would be very nice to have in Nim (obviously, you can't do that portably, but in principle it should be able to support them).
16:03:43Jehan_gamesbrainiac: No, I'm talking about memory safety because of multiple goroutines unsafely accessing the same data.
16:04:08gamesbrainiacJehan_ Thats why you use a channel of channels to co-ordinate any data changes.
16:04:33Jehan_gamesbrainiac: Yeah, I know. It's still not safe.
16:04:38*pregressive joined #nim
16:04:44Jehan_As I said, you lose the benefits of thread-local variables in particular.
16:04:47gamesbrainiacJehan_ How so? This is really interesting :)
16:05:13Jehan_gamesbrainiac: To clarify, you can write safe code, but the compiler can't protect you against writing code that isn't memory-safe.
16:05:44gamesbrainiacJehan_ Well, thats a fair thing I suppose. I mean go isn't exactly rust :P
16:05:47Jehan_Thread-local variables essentially have to be locked, too, because multiple goroutines can run in the same thread.
16:06:17Jehan_gamesbrainiac: Yeah, but Nim aims to provide you with memory safety (at least as far as I understand it). So it's a concern.
16:06:41gamesbrainiacJehan_ Hmm. Thats a pretty laudable aim.
16:06:59gamesbrainiacAt the end of the day, I guess I want something thats easy to use, and won't blow my foot off on a mistake.
16:07:11Jehan_gamesbrainiac: Well, yeah, that's the point.
16:07:40gamesbrainiacI will admit to facing quite a few deadlocks when I was starting out with golang
16:07:41Jehan_Go does let you blow your foot off by mistake (Nim requires you to be explicit about your desire to aim at your foot).
16:07:49Jehan_Deadlocks are a different issue.
16:08:18gamesbrainiaclol, "dear nim, my foot isn't talking to me, blow it off"
16:08:20Jehan_Outside of a full-blown theorem prover, there's no way to prevent all deadlocks without seriously impacting expressiveness.
16:08:43gamesbrainiacyikes!
16:09:26gamesbrainiacSo far, go's concurrency works for me and i guess that makes me "comfortable" with it.
16:10:02Jehan_gamesbrainiac: Understood.
16:10:06gamesbrainiacI like actors too, but having channels just makes thinking about multiple processes easier.
16:10:31gamesbrainiacJehan_ What do you use nim for, if you don't mind me asking?
16:10:35Jehan_That said, I think one could design a CSP-like language without these issues, but it'd look differently.
16:10:44Jehan_gamesbrainiac: Mostly tooling for my actual work.
16:11:18Jehan_Which, alas, still requires me to write C/C++. :)
16:11:54gamesbrainiacJehan_ Well, cpp ain't as bad as it used to be. Remember the really long errors when you used to use templates?
16:12:34Jehan_gamesbrainiac: It isn't, but the codebase I'm working on is decades old and doesn't (can't, really, through no fault of its own) use the new stuff.
16:12:50Jehan_And yes, I used an error message postprocessor to make them readable.
16:13:16Jehan_Luckily, that's one problem the code doesn't have; it uses templates pretty sparingly.
16:13:25gamesbrainiacoh, thats good then.
16:13:53gamesbrainiacI was taught to use template right off the bat.
16:14:17gamesbrainiacAnd we didn't have all the nice error messages back then.
16:14:38gamesbrainiac(you gotta make your functions generic kids!)
16:15:08Jehan_Well, the biggest problems were with the STL.
16:15:20Jehan_Which has a ton of generic parameters just about everywhere.
16:16:25gamesbrainiacWell its the STL, what else do you expect? Its gotta use a lot of generics.
16:22:23Jehan_To bring this back to Nim, C++ does have a lot of advantages as a backend for Nim nowadays. Aside from providing cheaper exception handling than setjmp(), the new standard gives you access to some architecture-specific stuff (especially with respect to concurrency) that can be pretty annoying to tease out through a configuration script.
16:23:30Jehan_And the compilation process is still pretty fast, since the generated C++ code generally avoids the stuff that makes the C++ compiler work hard.
16:24:36*vbtt_ joined #nim
16:27:14boopwould it be absolute heresy to make SocketHandle inherit from FileHandle? not seriously proposing this- just trying to get a feel for the differences
16:28:55Jehan_boop: Are you talking about the stdlib SocketHandle in posix.nim/winlean.nim?
16:29:13*dom96_ quit (Ping timeout: 246 seconds)
16:29:37Jehan_That one's dependent on the external representation, so you can't really add Nim's RTTI to it.
16:30:37boophmm, hmm
16:30:38*vbtt_ quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:30:52boopI'm grumpy at duplicated code for them, is all
16:31:23boopif I want to make a filehandle nonblocking it's the exact same code as for sockethandle, just with s/filehandle/sockethandle/
16:32:05Jehan_Can you use a type FileHandle|SocketHandle?
16:32:29Jehan_That should work as long as the code uses operations available on both.
16:32:40boopand which file does it go in?
16:32:47boopi guess it might be best to keep them separate.
16:33:12Jehan_It's a type, not a variable.
16:34:01Jehan_E.g. proc foo(handle: FileHandle|SocketHandle) = write(handle, "foo")
16:34:13boopand where do i toss the proc?
16:34:40boopif i put it in net.nim, file stuff can't use it. if i put it in system, it'd need to import net
16:36:26Jehan_It'd go in something like common.nim that imports both file and socket modules and provides operations that work for both.
16:36:38Jehan_You'd have the same issue with inheritance, I think.
16:37:28boophm.
16:53:12*mrkishi quit ()
16:55:14*dom96_ joined #nim
16:55:43dom96_boop: You should probably put it in the os module.
16:56:05*boop nods.
16:58:17Jehan_Oh, are we talking about changes to the stdlib? I misunderstood that, then.
16:58:52boopvery hypothetical, still getting a feel for how this all works
17:15:58*Perelandric joined #nim
17:19:07federico3Is there an epub of the docs?
17:19:47*jbomo joined #nim
17:22:29boopimporting another windows func into winlean: ReOpenFile
17:22:35boopshould it be reOpenFile or reopenFile?
17:22:38boopi think reopenFile looks neater
17:23:52cryzedboop, reopen is a real verb
17:23:55cryzedso I'd go with reopenFile
17:23:59*boop nods
17:24:14boopme too, just making sure it's not strictly meant to be PascalCase -> camelCase
17:28:23*Jesin quit (Quit: Leaving)
17:29:07BlaXpiritin my opinion, "re" should never be followed by uppercase
17:29:14BlaXpiritexcept when it's about regular expressions :|
17:31:31*dom96_ quit (Ping timeout: 246 seconds)
17:34:49dv-reGex
17:36:51*Jehan_ quit (Quit: Leaving)
17:40:19*Jesin joined #nim
17:44:36boopdom96: never trust file endings!
17:44:47boopthere's far too many for c++
17:46:17*OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…)
17:48:01*OnO joined #nim
18:07:03ekarlsodom96: have you looked at the nimble stuff at late for the registry stuff ?
18:12:35*banister is now known as banisterfiend
18:17:22*landgraf joined #nim
18:23:48*OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…)
18:30:25*filcuc quit (Quit: Konversation terminated!)
18:31:15dom96ekarlso: please create a PR if you want me to review it.
18:31:29dom96boop: you can always change it
18:31:52dom96federico3: There is a pdf... somewhere.
18:32:01dom96federico3: You can definitely generate it at least.
18:32:40boopyes, i suppose
18:32:58boopand if you're not touching .h files the shouldn't be a c/cpp conflict.. hmm
18:36:58*dddddd quit (Ping timeout: 272 seconds)
18:38:16*gmpreussner|work joined #nim
18:38:20*gokr joined #nim
18:49:20*xcombelle joined #nim
18:54:21*Demon_Fox joined #nim
19:11:18*TEttinger joined #nim
19:14:34*dddddd joined #nim
19:35:16ZZZZZZZZZquick question, proc f(x: SomeBigObjecttype), x will probably be optimized to be passed by reference while garanteeing immutability , right?
19:35:34ZZZZZZZZZno need to manually optimize to ref x
19:35:37ZZZZZZZZZref T*
19:40:45boopdom96: the pipes used for osproc are anonymous pipes, but only named pipes can support async
19:41:10boopusing named pipes just.. i'm not sure about it.
19:41:38dom96why?
19:42:10boopwhat should they be named? :)
19:42:25boophonestly i've never used named pipes- they just seem a bit scary
19:42:34*gamesbrainiac quit (Quit: Bye folks!)
19:43:30dom96outputPipe?
19:43:57dom96boop: Once you learn about it it won't be as scary :)
19:44:24boopmaybe. how should i generate the pipe names?
19:44:39booppid + incrementing id?
19:44:50*Jesin quit (Quit: Leaving)
19:47:42*Jesin joined #nim
19:48:30*strcmp1 quit (Ping timeout: 252 seconds)
19:49:56*renesac left #nim (#nim)
19:52:24boopor.. would an OID be suitable here?
19:55:59*thotypous quit (Quit: WeeChat 1.1.1)
20:00:49*Fernandos joined #nim
20:01:04Fernandoshi
20:01:30FernandosI have three questions about nim.
20:02:01Fernandos1. Did you renmae it, because I remember it being called Nimrod, so it's Nim now?
20:02:36*thotypous joined #nim
20:02:45Fernandos2. If it's runtimeless, why does ldd show dependencies to libc etc.?
20:02:54boop1: yes
20:03:01boop2: it doesn't have its own extra runtime libs
20:03:26Fernandosboop: I thought that means it does not depend on libc
20:03:26*onionhammer quit (Read error: Connection reset by peer)
20:03:36boopthat would be quite a feat.
20:03:39Fernandosand can run without a kernel on the bare-metal machine
20:04:07*onionhammer joined #nim
20:04:18Fernandos"Nim produces small executables without dependencies for easy redistribution."
20:04:19def-Fernandos: Well, every system has a C stdlib already, so why not depend on it?
20:04:57def-Fernandos: aand you can statically link to musl-libc for example. this might interest you: http://hookrace.net/blog/nim-binary-size/
20:05:17Fernandosdef-: if your app doesn't need a system, it would be excellent to be able to run your "app" without the os-overhead just like http://zerg.erlangonxen.org/
20:05:34def-Fernandos: sure, --os:standalone
20:05:44Fernandoswow
20:06:06def-Fernandos: and you can run a 100 Byte binary, but since you're left without an OS, you'll have to implement your own manual memory management etc
20:06:10BlaXpiritall in all, i think the introduction on habrahabr didn't go too well
20:06:31Fernandosthat's an absolutely okay con
20:07:09Fernandos3. Why did you choose to make the language imperative and not functional or functional/relational?
20:07:30def-BlaXpirit: well, nim has some things people always find negative
20:07:51BlaXpiriti think most people missed the part about var -> const
20:09:22Fernandosso far I'm almost hooked and would like to use nim if it makes click for me
20:09:47def-Fernandos: I've done a lot of Haskell before coming to Nim and I started to appreciate imperative programming again. But you can also do some OOP and functional programming in Nim
20:10:24Fernandosdef-: holy shit.. I have the feel that you've just read my mind!
20:10:56*OnO joined #nim
20:11:14FernandosI was going to write: would like to use nim or haskell and asked myself which one I'm going to like more
20:11:45def-If you haven't done functional programming before, Haskell is fun
20:11:56Fernandosdef-: have you dealt with sql in haskell?
20:11:59def-I loved learning it, a new paradigm
20:12:06FernandosI've heard that that's a neckbreaker
20:12:22def-but real world programming with haskell wasn't so much fun for me
20:12:48Fernandoswhy?
20:13:10def-no, but I mainly did basic stuff and some gtk + graphviz: http://felsin9.de/nnis/ghc-vis/
20:13:48def-I spent an eternity thinking about how to do something best in a functional way, while it would've been much easier and cleaner imperatively
20:14:36Fernandosif you had something similar to "linq" in haskell. would that solve it?
20:15:53def-never heard of LINQ, sounds like another level of abstraction/complication, not sure I like the sound of it
20:16:09*Demon_Fox quit (Quit: Leaving)
20:17:34Fernandosit's a relational DSL that's most often used as a kind of sql substitute for data-structures and as a template-engine
20:18:17FernandosI mainly write algorithms atm. with matlab and various other languages, here's a minimal knapsack algorithm, how would I implement that in nim? http://hastebin.com/abatelesik.py
20:20:27Fernandosinteresting, the generated C code is unlike anything I expected..
20:20:35def-Fernandos: the C code is nicer with -d:release
20:22:22Fernandosyup that's what I tried^ it's readable, but a lot of stuff seems to be going on in that code
20:22:55def-sure, it's not just a simple translator to C
20:23:05def-Nim is it's own language, C is just portable assembler for us
20:28:04*Jehan_ joined #nim
20:28:20def-Fernandos: https://gist.github.com/def-/3f83380443e630f6d74d
20:28:28def-pretty direct port of the python version
20:30:18Fernandosthat's crazy cool, so you can say that nim is really similar to python, right?
20:30:22def-no
20:30:50def-The Syntax is similar in some regards
20:32:33FernandosOk, python except cython isn't compiled, but duck-typed and not strongly typed, but except that and the synthax are there features nim has over python?
20:33:10def-Surely, look here for example: http://hookrace.net/blog/what-is-special-about-nim/
20:33:17Fernandosbecause I believe that adding python library compatibility would be a big win for nim.
20:33:29Fernandosthank you def-!
20:33:43Fernandosyour implementation is beautiful too :)
20:33:50def-You mean using Python libraries? https://github.com/micklat/NimBorg/
20:34:09def-Nim's standard library is pretty extensive, but needs some work to be better
20:35:54*xcombelle quit (Quit: Leaving)
20:36:18ldleworkI'd rather call nim from python than the other way around
20:36:22ldleworkI think
20:36:39ldleworkUse Nim to performantly extend Python
20:36:52def-ldlework: they use C for that already
20:37:04Fernandoshahah aweseome name for a project of that kind
20:38:00ldleworkdef-: and C is not nim
20:38:15FernandosWhat do you think about the low/high/meta split as in http://www.red-lang.org/p/about.html ?
20:38:46Fernandosit's a possible rebol successor
20:40:36def-Sounds like Nim's slogan: Expressive (high), Efficient (low), Elegant (meta)
20:42:06*vbtt_ joined #nim
20:46:59*vbtt_ quit (Client Quit)
20:47:13*vbtt_ joined #nim
20:50:45*Trustable quit (Remote host closed the connection)
20:57:35*johnsoft quit (Ping timeout: 256 seconds)
20:58:03*johnsoft joined #nim
20:58:19*filcuc joined #nim
21:16:26ZZZZZZZZZFernandos: linq is heavily influenced by haskell
21:17:13FernandosZZZZZZZZZ: hah! .. that's interesting.. didn't know that.. how do you come to that conclusion?
21:18:45*Varriount joined #nim
21:19:00VarriountHi guys
21:20:47ZZZZZZZZZFernandos: http://cacm.acm.org/magazines/2011/10/131398-the-world-according-to-linq/fulltext
21:20:57ZZZZZZZZZwritten by the creator or LINQ himself
21:21:03ZZZZZZZZZjust read the conclusion
21:26:15*yglukhov_____ quit (Quit: Be back later ...)
21:27:05*TEttinger quit (Ping timeout: 258 seconds)
21:28:06*vbtt_ quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
21:28:21Varriountonionhammer: I need your opinion on something.
21:28:47onionhammerwhats that
21:30:51Varriountonionhammer: So, at the moment, modified NimLime so that every plugin module loads the 'NimLime' module, then the 'NimLime' module modifies sys.path so that stuff in the utils folder.
21:31:00Varriount*I modified
21:31:59Varriountonionhammer: You can see what I did here: https://github.com/Varriount/NimLime/commit/9c5702bb77a3f3190261d4e2c89220598ef392bd
21:33:33VarriountHowever, I found out that the package loader just happens to load modules in alphabetical order. I /could/ do away with all those imports, and simply move the code to the new __init__.py, since files with an underscore are loaded before files starting with 'a'
21:33:55onionhammermm
21:34:03VarriountDo you think I should make that change, even though it relied on undocumented behavior?
21:34:13Varriount*relies
21:34:33VarriountThe undocumented behavior is part of ST2 by the way.
21:34:45onionhammerdo you happen to know if many other packages rely on it?
21:35:35VarriountNo, I don't. I haven't looked.
21:35:46onionhammerif there's a good reason for loading modules in alphabetical order.. then maybe we can rely on it, if it's somewhat arbitrary/liable to change or wouldnt break any other packages then its hard to rely on it
21:41:37*dom96_ joined #nim
21:46:34*Demon_Fox joined #nim
21:47:47*Kingsquee joined #nim
21:51:33FernandosI would find it great if one wouldn't need to load imports manually, but get that sorted out by during the pre-compile phase. But have no idea how that could be made to work.
21:51:45*pregressive quit (Remote host closed the connection)
21:51:58FernandosZZZZZZZZZ: Just made myself a tea, I'm readin it now :)
21:52:00*pregressive joined #nim
21:52:30*pregressive quit (Remote host closed the connection)
21:52:38VarriountFernandos: Were you talking to me/onionhammer?
21:53:23FernandosZ*9 sent me the link to http://cacm.acm.org/magazines/2011/10/131398-the-world-according-to-linq/fulltext
21:53:56FernandosVarriount: I asked earlier why nim hasn't chosen to be functional+relational (that would be LINQ)
21:55:33Fernandostl;dr is "C# adopted monads in the form of LINQ (Language-integrated Query) as a way to bridge the gap between the worlds of objects and data."
22:04:28*boop is now known as boopisaway
22:07:19Jehan_Fernandos: There is really no way to make that work automagically.
22:07:46*filwit joined #nim
22:07:52Jehan_However, there are ways to mass-import a bunch of modules, such as "include prelude"
22:07:57Jehan_And you can define your own, of course.
22:08:03FernandosI've heard the exact same thing in #jquery a few years ago, when I asked for the same feature and it's there now.
22:08:30Jehan_Fernandos: About functional programming: Nim is a system programming language and its design reflects that.
22:08:40FernandosAh!
22:08:43Jehan_It's really hard to do a functional system programming language.
22:08:53Jehan_BitC was the only attempt I can think of.
22:08:54FernandosI thought it's a general purpose language, now that makes sense.
22:09:08Jehan_Basically, functional data structures are lists and trees, but the hardware wants arrays.
22:09:24Jehan_It is actually fairly expressive for a system programming language.
22:09:46Jehan_But it has finer control over memory layout and other low-level aspects than you'd expect from a general purpose language.
22:10:00Fernandos"Asynchronous Module Definition (AMD)" solved autoloading libraries
22:10:02Jehan_Frankly, I hardly use it for system programming purposes myself.
22:10:23*NimBot joined #nim
22:12:35Jehan_As far as I know, AMD doesn't figure out the modules you need to import itself.
22:12:46Jehan_You still have to specify them, it handles the loading part.
22:13:11Jehan_If two modules both define a procedure foo(), which one do you import?
22:13:17*BlaXpirit quit (Quit: Quit Konversation)
22:13:18Jehan_That's simply not decidable.
22:13:26Fernandosafaik, named scopes work as triggers for loading specific libraries automatically
22:13:54*strcmp1 joined #nim
22:15:04Fernandosgoogle.chart.api ie. is self-explanatory and could serve as load mechanism too. There are two way imho. the one way is to embed autoloading imports into the editor as a deep-introspection feature (auto-imports).
22:15:19Jehan_You still need to tell the system somehow which module you wish to import. Or you can be in for a lot of pain.
22:16:21FernandosThe other way is to give clues to the compiler, so that using math.Draw2DMatrix(…) will tell the compiler to look for that function in the math module
22:16:56Fernandoslooking in the system modules automatically and into 3rd party modules manually would eliminate the decision problem I think
22:17:45landgrafHi all. Today is my first day with nim! I'm trying to port my small utility which use httpclient and get weird "406 Unacceptable" error every time. Curl works fine with the same server. Checked headers few times and they look identicals... Is it right place to ask?
22:18:06FernandosJehan_: ie. nim.require({ module: 'math' }); would be the alternative
22:18:17Fernandosbut that's already there
22:18:28Jehan_Fernandos: Well, that's really not different from using "import math"
22:18:44Fernandosyep, the last example could be useful for build-tools
22:18:45Jehan_In the end, import statements make up a tiny fraction of the code.
22:19:03Fernandosbut the order of those can drive people mad *wink*
22:19:23Jehan_landgraf: It is, but unfortunately I am not familiar with the http stuff.
22:19:24Fernandoshehe, well at least in C, that was my experience
22:19:43Jehan_Order shouldn't matter.
22:20:06Jehan_When more than one module defines the same function, you're required to explicitly disambiguate between them.
22:20:36FernandosJehan_: oh, you say that import oder doesn't matter in nim? That's actually fantastic!
22:21:27Jehan_Well, that's not entirely true. (1) It can affect the order in which modules are initialized, and (2) you can create problems if you have mutally recursive imports.
22:21:41Jehan_But well-written code shouldn't have a problem with (1) and shouldn't do (2).
22:25:32*transfuturist joined #nim
22:26:01transfuturistis nim particularly attached to exceptions?
22:27:08Jehan_transfuturist: What do you mean?
22:27:25transfuturistexceptions seem like a bad method of error handling for multiple reasons
22:27:47transfuturisthidden control-flow, incompatibility with parallelism, speed, etc.
22:28:03Jehan_Personally, I agree, but they are sometimes unavoidable.
22:28:20Jehan_Failed preconditions, for example.
22:28:46transfuturistreturn early
22:29:02transfuturistanyway, why should the standard library use them?
22:29:04Jehan_What would you do with sqrt(-1)?
22:29:23Jehan_Sometimes NaN is the answer, but not always.
22:29:25*vbtt_ joined #nim
22:29:25transfuturistreturn an error
22:29:33transfuturistlog it
22:29:47Jehan_Which is an utter pain if you have math-heavy code.
22:29:50Matthias247return i ;)
22:29:51transfuturistcertainly not interrupt the whole control flow
22:31:26transfuturistand how are you going to do math-heavy parallelism, then?
22:32:04Jehan_Exceptions basically make sense if (1) you would otherwise enter an undefined state that you could not anticipate or (2) if not using them would gum up the API/code.
22:32:22Jehan_transfuturist: I'll abort on an exception, because at this point, the algorithm is broken.
22:32:29transfuturist'an unhandled exception in one thread terminates the whole process'
22:32:37transfuturistempty catch clauses
22:32:46transfuturist:l
22:32:52Jehan_That's why you write a top-level handler that either gracefully aborts, restarts, or whatever.
22:33:07Jehan_Mind you, I'm not a huge fan of C++-style exceptions.
22:33:29Jehan_I'm just saying that purity at any cost doesn't really work.
22:34:28*vbtt_ quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
22:34:48transfuturistbut why is it in the standard library?
22:35:42Jehan_The problem with C++-style exceptions (that everybody seems to have borrowed, including Python, Java, etc.) is that they are essentially interprocedural computed gotos without much thought about an accompanying programming discipline to harness them.
22:35:47Jehan_transfuturist: You'll have to ask Araq.
22:35:54transfuturistand speaking of, shouldn't there be a version of the standard library that works with nogc?
22:36:42Jehan_transfuturist: Well, if you're volunteering to write it ... :)
22:36:58Jehan_But it'd have to have a different API, so it wouldn't be a drop-in replacement.
22:37:24transfuturistwhy a different API?
22:37:54Jehan_Because you have to be explicit about who's responsible for freeing memory when that part isn't automated.
22:38:00*filcuc quit (Quit: Konversation terminated!)
22:39:14Jehan_A major argument in favor of GC is that it aids modularity, in fact (see Jones and Lins for the details).
22:39:39ZZZZZZZZZthere will be a Maybe[T] soon in nim
22:39:50ZZZZZZZZZthat way you can replace the exception if you want
22:39:56transfuturisti'm not arguing against GC, just that it should be as easy as possible to use nim without it
22:40:11Jehan_ZZZZZZZZZ: Well, you can already return (bool, T)
22:40:17ZZZZZZZZZyeh
22:40:23Jehan_transfuturist: In an ideal world, yes, but that's a ton of work.
22:40:25ZZZZZZZZZjust sayin, something more standard
22:40:31ZZZZZZZZZand simpler to use
22:40:36ZZZZZZZZZwith map etc
22:40:42ZZZZZZZZZapplicative
22:41:48ZZZZZZZZZthat way you can just x.f.map(g).map(h)
22:41:49transfuturistZZZZZZZZZ: Would optional types be able to hold different kinds of errors, as in Either, or is it just Maybe?
22:42:17ZZZZZZZZZhttps://github.com/Araq/Nim/pull/2515
22:42:57ZZZZZZZZZlooks just like a maybe,
22:43:29transfuturistthere should be an either type in order to replace exceptions
22:43:53ZZZZZZZZZpull request it
22:43:56Jehan_transfuturist: Or a Try type, per Scala's approach.
22:44:17ZZZZZZZZZand see what happens
22:44:40transfuturistwell, Either could be called Try.
22:45:49Jehan_transfuturist: Either is a different type.
22:46:03Quorait's really a union tbh
22:46:26transfuturistJehan_: in Scala maybe.
22:46:57ZZZZZZZZZi wish there was native pattern matching
22:46:57Jehan_transfuturist: Yes, and there's a reason why it's a different type.
22:47:17ZZZZZZZZZespecially if Maybe and Either and more complex types get introduced
22:47:22ZZZZZZZZZinto the standard library
22:47:38transfuturistit just seems to be Try[T] = Either[Throwable, T]
22:48:13Jehan_transfuturist: And has constructors for success and failure, while Either is a generic thing.
22:48:21transfuturistokay
22:49:33*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:55:43*Fernandos quit (Remote host closed the connection)
23:00:18*OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…)
23:00:30*vikaton joined #nim
23:05:24vikatonNice Job Nim
23:05:49def-Hello vikaton
23:05:57vikatonHey def-
23:10:33dom96_hey vikaton
23:10:43vikatonhey dom96_
23:10:46vikatonhow goes
23:10:54dom96_it goes well :)
23:10:59dom96_welcome to #nim :)
23:13:45vikatonThanks :)
23:14:17vikatonI was just looking on how to parse JSON data in Rust and had a bit of trouble
23:14:36vikatonthen went to see how its done in Nim and it was much easier!
23:15:10*Fernandos joined #nim
23:16:22*Matthias247 quit (Read error: Connection reset by peer)
23:19:39dom96_vikaton: cool
23:19:49dom96_vikaton: What are you developing?
23:20:11transfuturistcomefroms :P
23:21:15vikatondom96_: nothing specific, I wanted to parse some JSON so that I could maybe create something using JSOn data in the future
23:21:41vikatonKind of like what I did with crystal and how I create my Crystal Shards bot, it parses Github JSON data
23:22:20dom96_ahh
23:30:50*NimBot joined #nim
23:33:47transfuturistuhhh
23:33:55transfuturisttrying to implement either is making me miss haskell
23:34:05transfuturisthow good is nim with monad transformers? >>
23:37:16transfuturisti suppose i could go for Try without Either
23:40:01*dtscode quit (Ping timeout: 264 seconds)
23:41:07*pregressive joined #nim
23:44:50*dddddd quit (Ping timeout: 265 seconds)
23:45:53*pregressive quit (Ping timeout: 256 seconds)
23:56:01*johnsoft quit (Ping timeout: 244 seconds)
23:56:32*johnsoft joined #nim