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:28 | vikaton | is 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:09 | dtscode | How do you turn a float to a string? Like 10.0 -> "10.0" |
06:35:43 | * | d3m1gd joined #nim |
06:47:11 | dtscode | Oh 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:26 | Wicked | I'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:36 | Wicked | (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:16 | OnO | hi |
10:11:18 | OnO | Araq: glad to catch your attention |
10:12:03 | OnO | actually I found out that db_* modules could be optimized much better |
10:12:15 | OnO | the problem is that they rewrite strings for each row |
10:12:26 | OnO | even the program uses a fraction of the information |
10:12:54 | OnO | that'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:43 | BlaXpirit | http://habrahabr.ru/post/258119/ |
10:42:32 | BlaXpirit | def-'s article translated on a very popular russian website |
10:43:13 | BlaXpirit | wish i could comment there. you can't simply make an account there |
10:54:03 | def- | BlaXpirit: oh, great! |
10:54:59 | * | Wicked quit (Quit: Page closed) |
10:55:32 | BlaXpirit | btw it's not "stolen", it is marked as a "translation" and there is a link "Dennis Felsing" |
10:56:14 | def- | Too bad they didn't embed my javascript to count the visitors |
10:56:26 | BlaXpirit | you can't do it there |
10:56:36 | * | vendethiel joined #nim |
10:57:07 | BlaXpirit | they linked to the counting page though |
10:57:26 | BlaXpirit | "You're visitor number 195, unique visitor number 82 today" |
10:57:39 | BlaXpirit | coincidence? i think not |
11:05:30 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
11:05:47 | * | Trustable joined #nim |
11:16:53 | BlaXpirit | seriously a big pity that nobody with enough knowledge will be able to comment there |
11:17:25 | BlaXpirit | now they're writing you can't write firmware and kernels |
11:17:33 | * | dddddd quit (Ping timeout: 244 seconds) |
11:30:53 | BlaXpirit | now the russian guy inquires here https://github.com/Araq/Nim/issues/2746 |
11:36:25 | * | Demon_Fox quit (Quit: Leaving) |
11:39:35 | Araq | OnO: cannot follow you at all |
11:40:01 | OnO | let my try to explain again |
11:41:46 | OnO | noSideEffect purpose it to optimize out unnecessary calls that only modify memory that is later anyway going to be discarded |
11:42:26 | OnO | if compiler can prove that value returned by noSideEffect is not necessary it can skip generating the call |
11:43:13 | OnO | if 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:50 | OnO | now... going back to my subject, it to optimize db_* API calls and actually fetch the row data only when it is necessary |
11:44:22 | OnO | so in my opinion all "get_row_string_at_index" should be ((pure)) in terms of GCC |
11:44:44 | OnO | then actually we can C gen these calls and let C compiler to remove them |
11:45:30 | OnO | the 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:56 | OnO | so if Nim is suppose to be next gen solution for Web or Db apps, then current implementation sucks very much at it |
11:46:58 | OnO | that's it, let me know if this is somehow more clear to you |
11:47:05 | Araq | you still haven't explained much |
11:47:29 | Araq | if I request a select a, b, c from foo why do you think I don't need a, b, c? |
11:48:03 | Araq | how is .noSideEffect helping with anything here? and if it is, why not let Nim optimize it away |
11:48:25 | Araq | we don't have to rely on GCC for this |
11:48:47 | OnO | requiring 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:48 | def- | 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:34 | OnO | def-: you are confusing const with no side effect |
11:50:54 | OnO | get_row_string_at_index is not going to change any global state |
11:51:02 | OnO | that's why it has no side effects |
11:51:09 | BlaXpirit | technically it probably is going to change a lot |
11:51:22 | def- | but it depends on the global state of your database? |
11:51:56 | OnO | so 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:52 | def- | 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:25 | OnO | no! |
11:53:29 | OnO | confusing const |
11:53:35 | OnO | const is always returning same value |
11:53:43 | OnO | but pure just does not modify any global state |
11:53:52 | BlaXpirit | OnO, you're confused. |
11:54:01 | def- | when something has no side effects and gets called twice with the same arguments, it will always return the same value |
11:54:15 | OnO | not true sorry |
11:54:21 | * | banister joined #nim |
11:54:41 | OnO | let a = no_side_effect_call(); side_effect_call(); let b = no_side_effect_call() |
11:54:45 | OnO | is a == b, no |
11:55:11 | Araq | it's true for Nim though. you have to treat the database as a hidden global variable |
11:55:35 | BlaXpirit | "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:30 | OnO | BlaXpirit: this is definition of "pure" taken from where? |
11:57:35 | BlaXpirit | wikipedia |
11:57:41 | Araq | and it's an optimization that modifies behaviour: |
11:57:43 | OnO | I am talking of GCC ((pure)) |
11:57:50 | OnO | not GCC ((const)) |
11:58:05 | Araq | let unused = access("invalid_db_field") |
11:58:18 | OnO | "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:31 | Araq | --> db exception unless optimized away? |
11:58:33 | OnO | depends only on the parameters >>and/or global variables<< |
11:59:04 | OnO | removing global dependency makes you ((const)) or BlaXpirit's wikipedia "pure" |
11:59:11 | Araq | and your quote suggests common subexpression elimination is performed |
12:01:23 | OnO | yes, 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:33 | Araq | so how do you generate 'select' statements? if you generate 'select * ' it's downright broken already. |
12:04:53 | * | ddl_smurf joined #nim |
12:04:56 | Araq | cause tables can grow new fields |
12:07:23 | Araq | and 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:00 | OnO | because 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:26 | OnO | then compiler can see you don't user user.pass anywhere so it can eliminate 3rd call to rowval |
12:09:45 | OnO | given that model can have many fields it will likely eliminate most of the calls |
12:10:11 | OnO | given that rowval (or their actual impl) actually fetch real data this is real optimization |
12:11:32 | OnO | Ruby's ActiveRecord tries to solve that with some higer abstraction using so called lazy accessors |
12:11:59 | OnO | but 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:26 | Araq | again, where does the (name, id, pass) tuple come from? |
12:33:37 | Araq | why assume it's unnecessary? |
12:34:29 | Araq | if 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:00 | Araq | and yes, it's easy enough to transform let unused = foo() to 'discard foo()' and then make a TR macro perform this optimization |
12:36:33 | Araq | but I don't see the point to burden us what that minor detail for now |
12:37:16 | Araq | and note that 'let unused = foo()' is quite different from obj.unused = foo() |
12:37:25 | Araq | bbl |
12:40:02 | OnO | okie |
12:43:33 | OnO | Araq: 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:29 | OnO | ORM 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:17 | OnO | I was considering that, but the block itself may call other procs, and such analysis would be even harder |
12:47:13 | OnO | as 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:42 | OnO | moreover optimization and compilers are fields of my interest that's why I dig this subject |
12:49:07 | OnO | also 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:11 | OnO | unfortunatelly Nim's db_* does exactly the same, copy all fields from row into seq[string] on each iteration |
12:50:30 | bluenote_ | how can I assert a compilation error in a unit test? |
12:50:51 | bluenote_ | "when compiles(badMacroCall): check false" does not seem to do the job |
12:50:54 | OnO | of 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:15 | OnO | bluenote_: {.error.} or {.fatal.} pragma |
12:52:13 | bluenote_ | thanks! |
12:58:44 | bluenote_ | hm, where am I supposed to place the pragma? neither "badMacroCall {.error.}" nor within the when block seem to be right |
12:59:36 | bluenote_ | ok, got it :) |
13:01:42 | * | intra joined #nim |
13:26:20 | * | BitPuffin|osx joined #nim |
13:29:24 | boop | hrm. |
13:29:31 | boop | what were the bugs fixed in 0.11.2? |
13:30:17 | * | filcuc joined #nim |
13:36:14 | def- | boop: https://github.com/Araq/Nim/commit/e23857a98bc1f682896910c545eb9eae7ff5225f |
13:36:17 | def- | https://github.com/Araq/Nim/compare/v0.11.0...v0.11.2 |
13:36:46 | boop | i've realised that the arch package was lagging behind a bit so my GC crash might have been a 0.11 issue |
13:37:00 | def- | I don't think GC issues were fixed in 0.11.2 |
13:37:03 | boop | hmm |
13:37:52 | def- | but there currently is a PR pending for a GC fix https://github.com/Araq/Nim/pull/2671 |
13:38:03 | def- | no idea if it's related to the problem you see |
13:39:12 | ZZZZZZZZZ | OnO: i havent read all of what you said, but a function with a DB call to a bd cannot be pure |
13:39:17 | ZZZZZZZZZ | ever |
13:39:26 | ZZZZZZZZZ | its the definition of unpure |
13:39:54 | boop | ahh cool |
13:40:12 | OnO | I am talking about GCC ((pure)) attribute not other languages definition of "pure" |
13:40:18 | boop | I've updated to 0.11.2 anyway, we'll see what happens |
13:40:35 | OnO | GCC ((const)) matches what many define as "pure" |
13:41:55 | ZZZZZZZZZ | i have no idea about GCC, all im sayin is, if you remove ANY db call |
13:42:04 | BlaXpirit | ok, if you stress this enough times, people may start understanding you |
13:42:05 | ZZZZZZZZZ | you can alter the program significantly |
13:42:05 | OnO | not any |
13:42:16 | ZZZZZZZZZ | a database can have TRIGGERS |
13:42:18 | ZZZZZZZZZ | on READ |
13:42:22 | ZZZZZZZZZ | end of story |
13:42:33 | ZZZZZZZZZ | so it cannot be pure |
13:42:37 | OnO | not any calls just calls that read row value into memory |
13:42:40 | ZZZZZZZZZ | whatever gcc tells you |
13:43:07 | OnO | I said it explicitly I am talking about loading row value for cursor's row |
13:43:32 | OnO | if you are not going to use this value later, it is safe to remove call to "getrowval" |
13:43:41 | OnO | it can't break anything |
13:44:47 | OnO | for sqlite example I am talking about removing sqlite_column_text if this value is not later used in the code |
13:48:41 | OnO | or safely removing pqgetvalue call for postgress |
14:05:57 | ZZZZZZZZZ | im 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:13 | ZZZZZZZZZ | you wouldnt save anything but the call |
14:07:51 | ZZZZZZZZZ | and the pointer is valid until the next sqlite3_step(stmt); |
14:08:16 | ZZZZZZZZZ | so yeh, you probably only save a simple function call, not much of an optimization |
14:08:32 | ZZZZZZZZZ | for all the headache it can cause |
14:09:05 | ZZZZZZZZZ | just optimize your request better, select less stuff |
14:12:54 | OnO | but I am pretty sure that result of sqlite3_column_text isn't in the memory :) |
14:13:16 | OnO | it actually creates some new buffer and does copy |
14:14:22 | ZZZZZZZZZ | so it talks to the DB? |
14:16:02 | ZZZZZZZZZ | isnt sqlite opensource? where the code |
14:16:41 | boop | sqlite or nim's wrapper? |
14:16:59 | OnO | ZZZZZZZZZ: both are opensource |
14:17:20 | ZZZZZZZZZ | nim wrapper does nothing on this, im talking sqlite |
14:17:21 | boop | sqlite is one of those magical projects that manages to be public domain |
14:17:24 | boop | https://www.sqlite.org/src/tree?ci=trunk |
14:17:42 | boop | you can probably find a mirror on github if you prefer that interface |
14:17:43 | ZZZZZZZZZ | thx |
14:17:59 | OnO | https://www.sqlite.org/c3ref/column_blob.html |
14:20:19 | OnO | vdbeapi.c vdbemem.c |
14:20:51 | OnO | there are lot of things happening in sqlite_column_text -> allocation, memory copy and encoding conversion |
14:21:21 | OnO | now on other side take a look at Nim's db_sqlite.nim |
14:21:47 | OnO | rows iterator calls setRows for each iteration |
14:22:13 | OnO | setRows calls sqlite_column_text for each column and converts it into string |
14:24:17 | def- | 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:18 | OnO | everything 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:52 | OnO | ZZZZZZZZZ: but some high level abstraction such as ORM should infer information what columns are necessary from the code itself |
14:27:43 | ZZZZZZZZZ | optimize it inside the orm itself |
14:28:06 | ZZZZZZZZZ | not on the low level database api |
14:28:07 | * | mrkishi joined #nim |
14:28:11 | OnO | for user in User.where(@pass == "123"): echo user.name rather than for user in User.loadOnly("name").where(@pass == "123"): echo name |
14:28:41 | ZZZZZZZZZ | thats the orm job to optimize it |
14:28:56 | boop | def-: i'd assume you can only use c++ in that case.. |
14:29:02 | * | Joe-T joined #nim |
14:29:12 | def- | boop: meh, why not use 3 languages at the same time? |
14:29:21 | boop | because it's compiled to a certain language |
14:29:32 | boop | and i doubt c and obj-c will play nice |
14:29:34 | def- | linking c++ with c object files doesn't work? |
14:29:44 | boop | c/c++ should work fine |
14:29:48 | boop | obj-c no so much |
14:29:49 | def- | c and obj-c play nice, that works already |
14:29:52 | boop | hmm |
14:29:54 | boop | huh. |
14:29:55 | OnO | ZZZZZZZZZ: I'd aggree, but it would require some very complex analysis of stmt block passed to ORM call |
14:30:07 | def- | boop: I'm investigating because of statically linking nim-glfw |
14:30:16 | ZZZZZZZZZ | sure but, marking sql_get_text or watever as pure |
14:30:19 | ZZZZZZZZZ | would affect everybody |
14:30:25 | ZZZZZZZZZ | and screw everyone |
14:30:25 | OnO | ZZZZZZZZZ: but actually C compiler does it already :) |
14:30:36 | def- | it works, but only because clang++ is nice enough to recognize that it's an objc file and compiles it as such |
14:30:41 | OnO | ZZZZZZZZZ: how would it screw anyone? |
14:30:49 | boop | interesting! |
14:30:57 | boop | i guess that's something that needs adding then |
14:31:41 | ZZZZZZZZZ | anyway gtg |
14:31:58 | OnO | ZZZZZZZZZ: how skipping call to sqlite3_get_text "char *unused_text_variable = sqlite3_get_text()" could affect your program |
14:32:04 | boop | in my mind cc, cpp, objc and js were all very separate and could only {.compile.} from their own language |
14:32:09 | boop | (well, not js, but you get what i mean) |
14:35:26 | def- | 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:11 | boop | proc setBlocking is mostly duplicated in sockets.nim (Socket) and rawsockets.nim (SocketHandle), and now i need to do it with FileHandle.. |
14:49:38 | boop | is there a better way to structure this? |
14:49:47 | boop | or does it matter. |
14:50:38 | boop | ...ah, sockets.nim is deprecated... |
14:51:00 | * | vbtt_ quit (Client Quit) |
14:54:46 | boop | is it better to use when false: or discard """ """ to disable blocks of code? |
14:55:26 | dtscode | The manual says discard |
14:55:28 | boop | mm |
14:55:31 | boop | https://github.com/Araq/Nim/blob/devel/lib/pure/net.nim#L396 < looking at this |
14:55:49 | boop | confused me until i read back |
14:56:50 | dtscode | Isn't net.nim deprecated? |
14:57:02 | boop | sockets.nim is |
14:58:57 | onionhammer | dom96_ added benchmark code https://github.com/Araq/Nim/pull/2738 |
15:00:59 | dtscode | Oh thats right |
15:01:26 | boop | but, yes. i'll be duping the SocketHandle code for the FileHandle stuff which isn't ideal |
15:01:35 | boop | any ideas? |
15:01:44 | dtscode | So good news. Nimbus2 is eval()ing. I just have a million things to do Nimbus2 before its ready for shipping |
15:02:04 | dtscode | BlaXpirit: Are you still on |
15:02:08 | BlaXpirit | hello |
15:02:36 | dtscode | Were you the one talking to me about Nimbus returning the result of the last expression? |
15:02:51 | BlaXpirit | yes |
15:03:03 | dtscode | And that is all you wanted it to do? |
15:03:04 | BlaXpirit | my pull request turned out to be poorly thought out |
15:03:19 | gamesbrainiac | Quick question. Is nim ever getting go-like channels on a language level? |
15:03:30 | gamesbrainiac | I've been using them for quite some time now, and they're so so damn convenient :) |
15:03:36 | BlaXpirit | maybe it already has them |
15:03:44 | BlaXpirit | and why hardcode them on language level |
15:03:53 | dtscode | Don'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:03 | BlaXpirit | good |
15:06:10 | gamesbrainiac | BlaXpirit Why do anytime on a language level? To make things convenient. |
15:06:46 | BlaXpirit | only someone who doesn't know much about Nim would say this |
15:06:47 | dtscode | s/anytime/anything/ |
15:07:55 | gamesbrainiac | BlaXpirit No argument there. I'm pretty happy with go, but I just wanted to explore nim as well. Hence the (noobish) query. |
15:08:15 | gamesbrainiac | dtscode thanks :) |
15:08:24 | BlaXpirit | uhh this? http://nim-lang.org/docs/channels.html |
15:09:16 | BlaXpirit | this idea has been around for ages. absolutely no idea why Go is praised. it has 0 originality |
15:09:57 | gamesbrainiac | BlaXpirit Some examples of usage would be helpful. |
15:10:33 | gamesbrainiac | Like, can you range over channels? |
15:11:00 | * | TEttinger quit (Ping timeout: 272 seconds) |
15:11:17 | BlaXpirit | I have never used this. https://www.google.com.ua/search?q=nim+site:nim-lang.org+tchannel |
15:11:54 | gamesbrainiac | BlaXpirit I think its more to do with ease of distribution than anything else. |
15:11:59 | BlaXpirit | this looks like an OK example forum.nim-lang.org/t/959#5774 |
15:12:23 | BlaXpirit | but this is for threads |
15:12:33 | BlaXpirit | and maybe you're looking for asynchronous, i don't know |
15:14:02 | gamesbrainiac | Well basically any form of abstract concurrency. |
15:14:16 | gamesbrainiac | I want to use multiple cores without having to think too much about it :P |
15:14:32 | boop | IO or CPU bound? |
15:14:42 | boop | use async for IO stuff |
15:14:57 | gamesbrainiac | CPU bound. |
15:15:30 | boop | mm. haven't messed with threads enough to help, sorry. |
15:15:59 | BlaXpirit | i don't know anything about them in nim, but the forum example i linked to should help |
15:16:34 | gamesbrainiac | forum post basically uses channel as a queue. Also says its not gc safe, which has me a little worried. |
15:17:13 | BlaXpirit | hm yeah, that topic discusses problems with that code |
15:18:00 | gamesbrainiac | hmm, I'll keep exploring things a bit more. but what have you been using nim for BlaXpirit ? |
15:18:10 | BlaXpirit | pretty much nothing |
15:18:20 | BlaXpirit | just wrote a couple libraries |
15:18:29 | BlaXpirit | tried to apply it for game dev, found it unsuitable |
15:19:02 | gamesbrainiac | BlaXpirit Rust seems to be the new favorite for developing game engines right now. |
15:19:11 | BlaXpirit | k |
15:20:10 | def- | gamesbrainiac: there's also one coming for Nim from what I've heard |
15:20:31 | gamesbrainiac | @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:20 | Jehan_ | 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:20 | Jehan_ | heap-allocated ptr object without the proper precautions. |
15:39:58 | boop | i'm not 100% sure what c compiler this is using, let me check |
15:40:08 | boop | does nim use $CC? |
15:40:54 | Jehan_ | It has a preset value for each architecture. |
15:41:01 | * | gamesbrainiac quit (Quit: Bye folks!) |
15:41:07 | Jehan_ | Which is usually gcc on Linux, clang on OS X. |
15:41:27 | * | gamesbrainiac joined #nim |
15:41:31 | boop | likely gcc then, $CC is clang |
15:42:02 | Jehan_ | Can be switched with (e.g.) --cc:clang. |
15:42:44 | * | boop nods |
15:42:50 | boop | want me to try running with that? |
15:43:07 | boop | i've already updated to 0.11.2 and it hasn't crashed yet, but it takes a while to happen |
15:44:07 | Jehan_ | 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:52 | Jehan_ | GC issues are most frequently due to a genuine bug. |
15:45:48 | Jehan_ | I.e. using Nim's unsafe features (ptr types, addr, the FFI). |
16:00:46 | * | OnO joined #nim |
16:00:47 | Jehan_ | 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:48 | Jehan_ | (3) Blocking FFI calls can screw up the internal scheduler in a way that they can't with the OS scheduler. |
16:01:57 | gamesbrainiac | Jehan_ Yea, Thats why go has its own scheduler in place to manage channels, so thats pretty useful. |
16:02:28 | Jehan_ | gamesbrainiac: Yeah, but it does come with serious tradeoffs. |
16:03:05 | gamesbrainiac | Jehan_ Possible overflows, but when you have stacks as small as 8kb for each coroutine, does it really matter all that much? |
16:03:14 | Jehan_ | 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:43 | Jehan_ | gamesbrainiac: No, I'm talking about memory safety because of multiple goroutines unsafely accessing the same data. |
16:04:08 | gamesbrainiac | Jehan_ Thats why you use a channel of channels to co-ordinate any data changes. |
16:04:33 | Jehan_ | gamesbrainiac: Yeah, I know. It's still not safe. |
16:04:38 | * | pregressive joined #nim |
16:04:44 | Jehan_ | As I said, you lose the benefits of thread-local variables in particular. |
16:04:47 | gamesbrainiac | Jehan_ How so? This is really interesting :) |
16:05:13 | Jehan_ | 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:44 | gamesbrainiac | Jehan_ Well, thats a fair thing I suppose. I mean go isn't exactly rust :P |
16:05:47 | Jehan_ | Thread-local variables essentially have to be locked, too, because multiple goroutines can run in the same thread. |
16:06:17 | Jehan_ | 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:41 | gamesbrainiac | Jehan_ Hmm. Thats a pretty laudable aim. |
16:06:59 | gamesbrainiac | At 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:11 | Jehan_ | gamesbrainiac: Well, yeah, that's the point. |
16:07:40 | gamesbrainiac | I will admit to facing quite a few deadlocks when I was starting out with golang |
16:07:41 | Jehan_ | 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:49 | Jehan_ | Deadlocks are a different issue. |
16:08:18 | gamesbrainiac | lol, "dear nim, my foot isn't talking to me, blow it off" |
16:08:20 | Jehan_ | Outside of a full-blown theorem prover, there's no way to prevent all deadlocks without seriously impacting expressiveness. |
16:08:43 | gamesbrainiac | yikes! |
16:09:26 | gamesbrainiac | So far, go's concurrency works for me and i guess that makes me "comfortable" with it. |
16:10:02 | Jehan_ | gamesbrainiac: Understood. |
16:10:06 | gamesbrainiac | I like actors too, but having channels just makes thinking about multiple processes easier. |
16:10:31 | gamesbrainiac | Jehan_ What do you use nim for, if you don't mind me asking? |
16:10:35 | Jehan_ | That said, I think one could design a CSP-like language without these issues, but it'd look differently. |
16:10:44 | Jehan_ | gamesbrainiac: Mostly tooling for my actual work. |
16:11:18 | Jehan_ | Which, alas, still requires me to write C/C++. :) |
16:11:54 | gamesbrainiac | Jehan_ Well, cpp ain't as bad as it used to be. Remember the really long errors when you used to use templates? |
16:12:34 | Jehan_ | 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:50 | Jehan_ | And yes, I used an error message postprocessor to make them readable. |
16:13:16 | Jehan_ | Luckily, that's one problem the code doesn't have; it uses templates pretty sparingly. |
16:13:25 | gamesbrainiac | oh, thats good then. |
16:13:53 | gamesbrainiac | I was taught to use template right off the bat. |
16:14:17 | gamesbrainiac | And we didn't have all the nice error messages back then. |
16:14:38 | gamesbrainiac | (you gotta make your functions generic kids!) |
16:15:08 | Jehan_ | Well, the biggest problems were with the STL. |
16:15:20 | Jehan_ | Which has a ton of generic parameters just about everywhere. |
16:16:25 | gamesbrainiac | Well its the STL, what else do you expect? Its gotta use a lot of generics. |
16:22:23 | Jehan_ | 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:30 | Jehan_ | 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:14 | boop | would 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:55 | Jehan_ | boop: Are you talking about the stdlib SocketHandle in posix.nim/winlean.nim? |
16:29:13 | * | dom96_ quit (Ping timeout: 246 seconds) |
16:29:37 | Jehan_ | That one's dependent on the external representation, so you can't really add Nim's RTTI to it. |
16:30:37 | boop | hmm, hmm |
16:30:38 | * | vbtt_ quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
16:30:52 | boop | I'm grumpy at duplicated code for them, is all |
16:31:23 | boop | if I want to make a filehandle nonblocking it's the exact same code as for sockethandle, just with s/filehandle/sockethandle/ |
16:32:05 | Jehan_ | Can you use a type FileHandle|SocketHandle? |
16:32:29 | Jehan_ | That should work as long as the code uses operations available on both. |
16:32:40 | boop | and which file does it go in? |
16:32:47 | boop | i guess it might be best to keep them separate. |
16:33:12 | Jehan_ | It's a type, not a variable. |
16:34:01 | Jehan_ | E.g. proc foo(handle: FileHandle|SocketHandle) = write(handle, "foo") |
16:34:13 | boop | and where do i toss the proc? |
16:34:40 | boop | if 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:26 | Jehan_ | It'd go in something like common.nim that imports both file and socket modules and provides operations that work for both. |
16:36:38 | Jehan_ | You'd have the same issue with inheritance, I think. |
16:37:28 | boop | hm. |
16:53:12 | * | mrkishi quit () |
16:55:14 | * | dom96_ joined #nim |
16:55:43 | dom96_ | boop: You should probably put it in the os module. |
16:56:05 | * | boop nods. |
16:58:17 | Jehan_ | Oh, are we talking about changes to the stdlib? I misunderstood that, then. |
16:58:52 | boop | very hypothetical, still getting a feel for how this all works |
17:15:58 | * | Perelandric joined #nim |
17:19:07 | federico3 | Is there an epub of the docs? |
17:19:47 | * | jbomo joined #nim |
17:22:29 | boop | importing another windows func into winlean: ReOpenFile |
17:22:35 | boop | should it be reOpenFile or reopenFile? |
17:22:38 | boop | i think reopenFile looks neater |
17:23:52 | cryzed | boop, reopen is a real verb |
17:23:55 | cryzed | so I'd go with reopenFile |
17:23:59 | * | boop nods |
17:24:14 | boop | me too, just making sure it's not strictly meant to be PascalCase -> camelCase |
17:28:23 | * | Jesin quit (Quit: Leaving) |
17:29:07 | BlaXpirit | in my opinion, "re" should never be followed by uppercase |
17:29:14 | BlaXpirit | except when it's about regular expressions :| |
17:31:31 | * | dom96_ quit (Ping timeout: 246 seconds) |
17:34:49 | dv- | reGex |
17:36:51 | * | Jehan_ quit (Quit: Leaving) |
17:40:19 | * | Jesin joined #nim |
17:44:36 | boop | dom96: never trust file endings! |
17:44:47 | boop | there'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:03 | ekarlso | dom96: 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:15 | dom96 | ekarlso: please create a PR if you want me to review it. |
18:31:29 | dom96 | boop: you can always change it |
18:31:52 | dom96 | federico3: There is a pdf... somewhere. |
18:32:01 | dom96 | federico3: You can definitely generate it at least. |
18:32:40 | boop | yes, i suppose |
18:32:58 | boop | and 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:16 | ZZZZZZZZZ | quick question, proc f(x: SomeBigObjecttype), x will probably be optimized to be passed by reference while garanteeing immutability , right? |
19:35:34 | ZZZZZZZZZ | no need to manually optimize to ref x |
19:35:37 | ZZZZZZZZZ | ref T* |
19:40:45 | boop | dom96: the pipes used for osproc are anonymous pipes, but only named pipes can support async |
19:41:10 | boop | using named pipes just.. i'm not sure about it. |
19:41:38 | dom96 | why? |
19:42:10 | boop | what should they be named? :) |
19:42:25 | boop | honestly i've never used named pipes- they just seem a bit scary |
19:42:34 | * | gamesbrainiac quit (Quit: Bye folks!) |
19:43:30 | dom96 | outputPipe? |
19:43:57 | dom96 | boop: Once you learn about it it won't be as scary :) |
19:44:24 | boop | maybe. how should i generate the pipe names? |
19:44:39 | boop | pid + 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:24 | boop | or.. would an OID be suitable here? |
19:55:59 | * | thotypous quit (Quit: WeeChat 1.1.1) |
20:00:49 | * | Fernandos joined #nim |
20:01:04 | Fernandos | hi |
20:01:30 | Fernandos | I have three questions about nim. |
20:02:01 | Fernandos | 1. Did you renmae it, because I remember it being called Nimrod, so it's Nim now? |
20:02:36 | * | thotypous joined #nim |
20:02:45 | Fernandos | 2. If it's runtimeless, why does ldd show dependencies to libc etc.? |
20:02:54 | boop | 1: yes |
20:03:01 | boop | 2: it doesn't have its own extra runtime libs |
20:03:26 | Fernandos | boop: I thought that means it does not depend on libc |
20:03:26 | * | onionhammer quit (Read error: Connection reset by peer) |
20:03:36 | boop | that would be quite a feat. |
20:03:39 | Fernandos | and can run without a kernel on the bare-metal machine |
20:04:07 | * | onionhammer joined #nim |
20:04:18 | Fernandos | "Nim produces small executables without dependencies for easy redistribution." |
20:04:19 | def- | Fernandos: Well, every system has a C stdlib already, so why not depend on it? |
20:04:57 | def- | Fernandos: aand you can statically link to musl-libc for example. this might interest you: http://hookrace.net/blog/nim-binary-size/ |
20:05:17 | Fernandos | def-: 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:34 | def- | Fernandos: sure, --os:standalone |
20:05:44 | Fernandos | wow |
20:06:06 | def- | 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:10 | BlaXpirit | all in all, i think the introduction on habrahabr didn't go too well |
20:06:31 | Fernandos | that's an absolutely okay con |
20:07:09 | Fernandos | 3. Why did you choose to make the language imperative and not functional or functional/relational? |
20:07:30 | def- | BlaXpirit: well, nim has some things people always find negative |
20:07:51 | BlaXpirit | i think most people missed the part about var -> const |
20:09:22 | Fernandos | so far I'm almost hooked and would like to use nim if it makes click for me |
20:09:47 | def- | 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:24 | Fernandos | def-: holy shit.. I have the feel that you've just read my mind! |
20:10:56 | * | OnO joined #nim |
20:11:14 | Fernandos | I was going to write: would like to use nim or haskell and asked myself which one I'm going to like more |
20:11:45 | def- | If you haven't done functional programming before, Haskell is fun |
20:11:56 | Fernandos | def-: have you dealt with sql in haskell? |
20:11:59 | def- | I loved learning it, a new paradigm |
20:12:06 | Fernandos | I've heard that that's a neckbreaker |
20:12:22 | def- | but real world programming with haskell wasn't so much fun for me |
20:12:48 | Fernandos | why? |
20:13:10 | def- | no, but I mainly did basic stuff and some gtk + graphviz: http://felsin9.de/nnis/ghc-vis/ |
20:13:48 | def- | 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:36 | Fernandos | if you had something similar to "linq" in haskell. would that solve it? |
20:15:53 | def- | 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:34 | Fernandos | it'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:17 | Fernandos | I 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:27 | Fernandos | interesting, the generated C code is unlike anything I expected.. |
20:20:35 | def- | Fernandos: the C code is nicer with -d:release |
20:22:22 | Fernandos | yup that's what I tried^ it's readable, but a lot of stuff seems to be going on in that code |
20:22:55 | def- | sure, it's not just a simple translator to C |
20:23:05 | def- | Nim is it's own language, C is just portable assembler for us |
20:28:04 | * | Jehan_ joined #nim |
20:28:20 | def- | Fernandos: https://gist.github.com/def-/3f83380443e630f6d74d |
20:28:28 | def- | pretty direct port of the python version |
20:30:18 | Fernandos | that's crazy cool, so you can say that nim is really similar to python, right? |
20:30:22 | def- | no |
20:30:50 | def- | The Syntax is similar in some regards |
20:32:33 | Fernandos | Ok, 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:10 | def- | Surely, look here for example: http://hookrace.net/blog/what-is-special-about-nim/ |
20:33:17 | Fernandos | because I believe that adding python library compatibility would be a big win for nim. |
20:33:29 | Fernandos | thank you def-! |
20:33:43 | Fernandos | your implementation is beautiful too :) |
20:33:50 | def- | You mean using Python libraries? https://github.com/micklat/NimBorg/ |
20:34:09 | def- | Nim's standard library is pretty extensive, but needs some work to be better |
20:35:54 | * | xcombelle quit (Quit: Leaving) |
20:36:18 | ldlework | I'd rather call nim from python than the other way around |
20:36:22 | ldlework | I think |
20:36:39 | ldlework | Use Nim to performantly extend Python |
20:36:52 | def- | ldlework: they use C for that already |
20:37:04 | Fernandos | hahah aweseome name for a project of that kind |
20:38:00 | ldlework | def-: and C is not nim |
20:38:15 | Fernandos | What do you think about the low/high/meta split as in http://www.red-lang.org/p/about.html ? |
20:38:46 | Fernandos | it's a possible rebol successor |
20:40:36 | def- | 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:26 | ZZZZZZZZZ | Fernandos: linq is heavily influenced by haskell |
21:17:13 | Fernandos | ZZZZZZZZZ: hah! .. that's interesting.. didn't know that.. how do you come to that conclusion? |
21:18:45 | * | Varriount joined #nim |
21:19:00 | Varriount | Hi guys |
21:20:47 | ZZZZZZZZZ | Fernandos: http://cacm.acm.org/magazines/2011/10/131398-the-world-according-to-linq/fulltext |
21:20:57 | ZZZZZZZZZ | written by the creator or LINQ himself |
21:21:03 | ZZZZZZZZZ | just 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:21 | Varriount | onionhammer: I need your opinion on something. |
21:28:47 | onionhammer | whats that |
21:30:51 | Varriount | onionhammer: 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:00 | Varriount | *I modified |
21:31:59 | Varriount | onionhammer: You can see what I did here: https://github.com/Varriount/NimLime/commit/9c5702bb77a3f3190261d4e2c89220598ef392bd |
21:33:33 | Varriount | However, 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:55 | onionhammer | mm |
21:34:03 | Varriount | Do you think I should make that change, even though it relied on undocumented behavior? |
21:34:13 | Varriount | *relies |
21:34:33 | Varriount | The undocumented behavior is part of ST2 by the way. |
21:34:45 | onionhammer | do you happen to know if many other packages rely on it? |
21:35:35 | Varriount | No, I don't. I haven't looked. |
21:35:46 | onionhammer | if 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:33 | Fernandos | I 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:58 | Fernandos | ZZZZZZZZZ: 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:38 | Varriount | Fernandos: Were you talking to me/onionhammer? |
21:53:23 | Fernandos | Z*9 sent me the link to http://cacm.acm.org/magazines/2011/10/131398-the-world-according-to-linq/fulltext |
21:53:56 | Fernandos | Varriount: I asked earlier why nim hasn't chosen to be functional+relational (that would be LINQ) |
21:55:33 | Fernandos | tl;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:19 | Jehan_ | Fernandos: There is really no way to make that work automagically. |
22:07:46 | * | filwit joined #nim |
22:07:52 | Jehan_ | However, there are ways to mass-import a bunch of modules, such as "include prelude" |
22:07:57 | Jehan_ | And you can define your own, of course. |
22:08:03 | Fernandos | I'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:30 | Jehan_ | Fernandos: About functional programming: Nim is a system programming language and its design reflects that. |
22:08:40 | Fernandos | Ah! |
22:08:43 | Jehan_ | It's really hard to do a functional system programming language. |
22:08:53 | Jehan_ | BitC was the only attempt I can think of. |
22:08:54 | Fernandos | I thought it's a general purpose language, now that makes sense. |
22:09:08 | Jehan_ | Basically, functional data structures are lists and trees, but the hardware wants arrays. |
22:09:24 | Jehan_ | It is actually fairly expressive for a system programming language. |
22:09:46 | Jehan_ | But it has finer control over memory layout and other low-level aspects than you'd expect from a general purpose language. |
22:10:00 | Fernandos | "Asynchronous Module Definition (AMD)" solved autoloading libraries |
22:10:02 | Jehan_ | Frankly, I hardly use it for system programming purposes myself. |
22:10:23 | * | NimBot joined #nim |
22:12:35 | Jehan_ | As far as I know, AMD doesn't figure out the modules you need to import itself. |
22:12:46 | Jehan_ | You still have to specify them, it handles the loading part. |
22:13:11 | Jehan_ | If two modules both define a procedure foo(), which one do you import? |
22:13:17 | * | BlaXpirit quit (Quit: Quit Konversation) |
22:13:18 | Jehan_ | That's simply not decidable. |
22:13:26 | Fernandos | afaik, named scopes work as triggers for loading specific libraries automatically |
22:13:54 | * | strcmp1 joined #nim |
22:15:04 | Fernandos | google.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:19 | Jehan_ | 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:21 | Fernandos | The 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:56 | Fernandos | looking in the system modules automatically and into 3rd party modules manually would eliminate the decision problem I think |
22:17:45 | landgraf | Hi 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:06 | Fernandos | Jehan_: ie. nim.require({ module: 'math' }); would be the alternative |
22:18:17 | Fernandos | but that's already there |
22:18:28 | Jehan_ | Fernandos: Well, that's really not different from using "import math" |
22:18:44 | Fernandos | yep, the last example could be useful for build-tools |
22:18:45 | Jehan_ | In the end, import statements make up a tiny fraction of the code. |
22:19:03 | Fernandos | but the order of those can drive people mad *wink* |
22:19:23 | Jehan_ | landgraf: It is, but unfortunately I am not familiar with the http stuff. |
22:19:24 | Fernandos | hehe, well at least in C, that was my experience |
22:19:43 | Jehan_ | Order shouldn't matter. |
22:20:06 | Jehan_ | When more than one module defines the same function, you're required to explicitly disambiguate between them. |
22:20:36 | Fernandos | Jehan_: oh, you say that import oder doesn't matter in nim? That's actually fantastic! |
22:21:27 | Jehan_ | 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:41 | Jehan_ | But well-written code shouldn't have a problem with (1) and shouldn't do (2). |
22:25:32 | * | transfuturist joined #nim |
22:26:01 | transfuturist | is nim particularly attached to exceptions? |
22:27:08 | Jehan_ | transfuturist: What do you mean? |
22:27:25 | transfuturist | exceptions seem like a bad method of error handling for multiple reasons |
22:27:47 | transfuturist | hidden control-flow, incompatibility with parallelism, speed, etc. |
22:28:03 | Jehan_ | Personally, I agree, but they are sometimes unavoidable. |
22:28:20 | Jehan_ | Failed preconditions, for example. |
22:28:46 | transfuturist | return early |
22:29:02 | transfuturist | anyway, why should the standard library use them? |
22:29:04 | Jehan_ | What would you do with sqrt(-1)? |
22:29:23 | Jehan_ | Sometimes NaN is the answer, but not always. |
22:29:25 | * | vbtt_ joined #nim |
22:29:25 | transfuturist | return an error |
22:29:33 | transfuturist | log it |
22:29:47 | Jehan_ | Which is an utter pain if you have math-heavy code. |
22:29:50 | Matthias247 | return i ;) |
22:29:51 | transfuturist | certainly not interrupt the whole control flow |
22:31:26 | transfuturist | and how are you going to do math-heavy parallelism, then? |
22:32:04 | Jehan_ | 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:22 | Jehan_ | transfuturist: I'll abort on an exception, because at this point, the algorithm is broken. |
22:32:29 | transfuturist | 'an unhandled exception in one thread terminates the whole process' |
22:32:37 | transfuturist | empty catch clauses |
22:32:46 | transfuturist | :l |
22:32:52 | Jehan_ | That's why you write a top-level handler that either gracefully aborts, restarts, or whatever. |
22:33:07 | Jehan_ | Mind you, I'm not a huge fan of C++-style exceptions. |
22:33:29 | Jehan_ | 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:48 | transfuturist | but why is it in the standard library? |
22:35:42 | Jehan_ | 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:47 | Jehan_ | transfuturist: You'll have to ask Araq. |
22:35:54 | transfuturist | and speaking of, shouldn't there be a version of the standard library that works with nogc? |
22:36:42 | Jehan_ | transfuturist: Well, if you're volunteering to write it ... :) |
22:36:58 | Jehan_ | But it'd have to have a different API, so it wouldn't be a drop-in replacement. |
22:37:24 | transfuturist | why a different API? |
22:37:54 | Jehan_ | 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:14 | Jehan_ | A major argument in favor of GC is that it aids modularity, in fact (see Jones and Lins for the details). |
22:39:39 | ZZZZZZZZZ | there will be a Maybe[T] soon in nim |
22:39:50 | ZZZZZZZZZ | that way you can replace the exception if you want |
22:39:56 | transfuturist | i'm not arguing against GC, just that it should be as easy as possible to use nim without it |
22:40:11 | Jehan_ | ZZZZZZZZZ: Well, you can already return (bool, T) |
22:40:17 | ZZZZZZZZZ | yeh |
22:40:23 | Jehan_ | transfuturist: In an ideal world, yes, but that's a ton of work. |
22:40:25 | ZZZZZZZZZ | just sayin, something more standard |
22:40:31 | ZZZZZZZZZ | and simpler to use |
22:40:36 | ZZZZZZZZZ | with map etc |
22:40:42 | ZZZZZZZZZ | applicative |
22:41:48 | ZZZZZZZZZ | that way you can just x.f.map(g).map(h) |
22:41:49 | transfuturist | ZZZZZZZZZ: Would optional types be able to hold different kinds of errors, as in Either, or is it just Maybe? |
22:42:17 | ZZZZZZZZZ | https://github.com/Araq/Nim/pull/2515 |
22:42:57 | ZZZZZZZZZ | looks just like a maybe, |
22:43:29 | transfuturist | there should be an either type in order to replace exceptions |
22:43:53 | ZZZZZZZZZ | pull request it |
22:43:56 | Jehan_ | transfuturist: Or a Try type, per Scala's approach. |
22:44:17 | ZZZZZZZZZ | and see what happens |
22:44:40 | transfuturist | well, Either could be called Try. |
22:45:49 | Jehan_ | transfuturist: Either is a different type. |
22:46:03 | Quora | it's really a union tbh |
22:46:26 | transfuturist | Jehan_: in Scala maybe. |
22:46:57 | ZZZZZZZZZ | i wish there was native pattern matching |
22:46:57 | Jehan_ | transfuturist: Yes, and there's a reason why it's a different type. |
22:47:17 | ZZZZZZZZZ | especially if Maybe and Either and more complex types get introduced |
22:47:22 | ZZZZZZZZZ | into the standard library |
22:47:38 | transfuturist | it just seems to be Try[T] = Either[Throwable, T] |
22:48:13 | Jehan_ | transfuturist: And has constructors for success and failure, while Either is a generic thing. |
22:48:21 | transfuturist | okay |
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:24 | vikaton | Nice Job Nim |
23:05:49 | def- | Hello vikaton |
23:05:57 | vikaton | Hey def- |
23:10:33 | dom96_ | hey vikaton |
23:10:43 | vikaton | hey dom96_ |
23:10:46 | vikaton | how goes |
23:10:54 | dom96_ | it goes well :) |
23:10:59 | dom96_ | welcome to #nim :) |
23:13:45 | vikaton | Thanks :) |
23:14:17 | vikaton | I was just looking on how to parse JSON data in Rust and had a bit of trouble |
23:14:36 | vikaton | then 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:39 | dom96_ | vikaton: cool |
23:19:49 | dom96_ | vikaton: What are you developing? |
23:20:11 | transfuturist | comefroms :P |
23:21:15 | vikaton | dom96_: nothing specific, I wanted to parse some JSON so that I could maybe create something using JSOn data in the future |
23:21:41 | vikaton | Kind of like what I did with crystal and how I create my Crystal Shards bot, it parses Github JSON data |
23:22:20 | dom96_ | ahh |
23:30:50 | * | NimBot joined #nim |
23:33:47 | transfuturist | uhhh |
23:33:55 | transfuturist | trying to implement either is making me miss haskell |
23:34:05 | transfuturist | how good is nim with monad transformers? >> |
23:37:16 | transfuturist | i 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 |