00:08:22 | * | a_b_m quit (Ping timeout: 245 seconds) |
00:15:21 | * | [rg] joined #nim |
00:32:26 | * | sentreen quit (Ping timeout: 268 seconds) |
00:39:55 | * | fredrik92 joined #nim |
00:40:08 | * | couven92 quit (Disconnected by services) |
00:40:17 | * | fredrik92 is now known as couven92 |
00:43:25 | * | dddddd quit (Read error: Connection reset by peer) |
00:44:27 | * | sentreen joined #nim |
00:46:42 | * | sentreen_ joined #nim |
00:49:57 | * | sentreen quit (Ping timeout: 258 seconds) |
01:05:12 | FromGitter | <jrfondren> the old manual's at https://nim-lang.org/docs/manual.html#procedures-do-notation |
01:12:33 | * | couven92 quit (Quit: Client Disconnecting) |
01:13:56 | FromGitter | <jrfondren> chopping block: Package level objects, Void type, Covariance, Automatic dereferencing, Automatic self insertions, Do notation, Read/write tracking, Concepts, type[T], type operator, special operators, Type bound operations, Term rewriting macros, AST based overloading, Unchecked pragma, Prallel & Spawn, Guards and locks, Taint mode |
01:15:55 | * | [rg] quit (Quit: Leaving) |
01:18:32 | * | jasper__ joined #nim |
01:20:54 | * | rnrwashere joined #nim |
01:26:52 | jasper__ | That stuffs been moved to the experimental manual. Link near top of normal manual. Maybe there should be a link from docs mainland? |
01:27:11 | jasper__ | mainpage* |
01:28:08 | * | rnrwashere quit (Remote host closed the connection) |
01:28:08 | FromGitter | <jrfondren> rather, I don't look for navigational content in the main body of the manual |
01:28:18 | FromGitter | <jrfondren> which is a polite way of saying I didn't read boring stuff at the beginning |
01:29:04 | * | rnrwashere joined #nim |
01:30:03 | FromGitter | <jrfondren> the type operator's still gone, though |
01:38:38 | * | rnrwashere quit (Remote host closed the connection) |
01:55:57 | * | flaviu joined #nim |
02:07:17 | * | banc quit (Quit: Bye) |
02:23:18 | * | arecaceae quit (Remote host closed the connection) |
02:23:38 | * | arecaceae joined #nim |
02:28:33 | * | banc joined #nim |
02:36:50 | FromGitter | <brentp> this throws an underflow error. |
02:36:53 | FromGitter | <brentp> `````` |
02:37:00 | FromGitter | <brentp> ```var x:uint32 = 0 ⏎ for i in 0..<x: ⏎ echo i ``` [https://gitter.im/nim-lang/Nim?at=5cbfcbcb5b3f941aa5803f60] |
02:37:28 | FromGitter | <brentp> I can see why, and can cast to int, but this seems surprising. is it a bug? |
02:52:28 | FromGitter | <jrfondren> common behavior in other languages is to do nothing in such cases, but I don't know if it's an actual bug. |
02:53:59 | FromGitter | <jrfondren> ah wait, the languages I thought of didn't have unsigned ints though. this loop also does nothing in Nim, given signed ints |
02:54:52 | FromGitter | <jrfondren> what behavior were you hoping from that loop? A loop of FFFF_FFFF iterations and a loop of zero iterations both seem reasonable. |
02:56:59 | FromGitter | <jrfondren> (in d:release, the behavior you get is FFFF_FFFF iterations) |
03:00:21 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:21:03 | FromGitter | <jrfondren> correction: the behavior you get in d:release is an infinite loop. |
03:21:27 | FromGitter | <jrfondren> this might be because of GCC optimizing an 'impossibility' out of the loop test. |
03:21:40 | FromGitter | <jrfondren> in any case, that makes it a lot more of a candidate for a bug. |
03:22:28 | FromGitter | <jrfondren> I'll submit an issue about it |
03:24:43 | shashlick | got the android build done but now nimble doesn't run - could not import: SSL_CTX_ctrl |
03:25:14 | FromGitter | <brentp> @jrfondren I don't see inifinte loop with -d:release |
03:25:35 | FromGitter | <jrfondren> try this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cbfd72f8790b0307ef0249d] |
03:27:38 | FromGitter | <brentp> hrm well. I do see infinte loop in original. I was just compiling without -r flag |
03:40:07 | leorize[m]1 | shashlick: maybe because android doesn't use openssl? |
03:40:37 | * | leorize[m]1 is now known as leorize[m] |
03:41:37 | shashlick | i'll have to statically link openssl into nimble? |
03:42:17 | shashlick | there's a libssl.so in the lib directory and per termux's package info, it is 1.1.1 |
03:42:44 | shashlick | but nm -D doesn't show SSL_CTX_ctrl |
03:46:41 | shashlick | my ubuntu copy of libssl.so does |
04:02:05 | * | kapil____ joined #nim |
04:29:45 | * | nsf joined #nim |
05:01:07 | * | rnrwashere joined #nim |
05:19:13 | FromDiscord_ | <treeform> I am trying to convert a utf16 string, but I get strange error: |
05:19:14 | FromDiscord_ | <treeform> echo convert("T\0h\0e\0 \0M\0", "UTF-8", "UTF-16") |
05:19:29 | FromDiscord_ | <treeform> Error: unhandled exception: The parameter is incorrect. |
05:19:39 | FromDiscord_ | <treeform> What am I doing wrong? |
05:26:20 | * | narimiran joined #nim |
05:26:52 | * | leorize quit (Quit: WeeChat 2.3) |
05:39:33 | FromGitter | <jrfondren> works for me. |
05:41:11 | FromGitter | <jrfondren> complete workable example on stable and devel: ⏎ ⏎ ```import encodings ⏎ echo convert("T\0h\0e\0 \0M\0", "UTF-8", "UTF-16")``` [https://gitter.im/nim-lang/Nim?at=5cbff6f73b6cb0686a434db7] |
05:43:18 | FromGitter | <jrfondren> encodings makes use of libiconv on posix, and some kernel32 stuff on windows. if that example's failing for you, you probably have iconv problems. try stracing the executable to see what it's doing. |
05:46:41 | * | solitudesf- joined #nim |
05:49:58 | FromDiscord_ | <treeform> no I am on windows, I am having windows kernal32 problems. |
05:50:31 | FromDiscord_ | <treeform> this line: https://github.com/nim-lang/Nim/blob/master/lib/pure/encodings.nim#L395 |
05:50:37 | * | rnrwashere quit (Remote host closed the connection) |
05:50:50 | FromDiscord_ | <treeform> It seems like it tries wideCharToMultiByte several times, then gives up. |
05:51:51 | FromDiscord_ | <treeform> I just did my own utf16 decoding and it works, probably not idea. |
05:54:26 | * | leorize joined #nim |
05:57:21 | * | rnrwashere joined #nim |
05:59:37 | * | krux02 joined #nim |
06:00:09 | * | leorize quit (Ping timeout: 256 seconds) |
06:02:10 | FromGitter | <kayabaNerve> Anyone else's Nim compiler outputting "_7" a lot? |
06:03:07 | FromGitter | <kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cbffc1b97dcb371d803cb00] |
06:03:24 | FromGitter | <kayabaNerve> It's only happening with Nimble packages. |
06:07:38 | leorize[m] | it's the "same module name in nimble" fix |
06:08:10 | leorize[m] | see https://github.com/nim-lang/Nim/commit/0121dda9ba903b764cbd234667cc03f79ebadf44 |
06:10:35 | * | thomasross quit (Ping timeout: 246 seconds) |
06:20:33 | Araq | I want to fix the compiler message but not the file mangling :P |
06:20:43 | Araq | anybody got a problem with that? ;-) |
06:21:58 | * | leorize joined #nim |
06:29:37 | * | leorize quit (Ping timeout: 256 seconds) |
06:32:51 | leorize[m] | nimble really needs a better dependency graph |
06:33:31 | leorize[m] | install a package and it asked me to "overwrite" that dependency installed earlier 3 times in a row |
06:35:55 | Araq | I agree. |
06:40:05 | * | PMunch joined #nim |
06:46:02 | * | solitudesf- quit (Ping timeout: 250 seconds) |
06:46:23 | * | rokups joined #nim |
06:46:40 | leorize[m] | Araq: I believe a template can be used as a pragma without annotating with {.pragma.}, right? |
06:46:45 | leorize[m] | or does that just applies to macros? |
06:47:19 | Araq | these are different things. .pragma is for object field pragmas etc |
06:47:29 | Araq | proc transformators don't have the .pragma |
06:49:23 | leorize[m] | I see |
06:58:45 | * | solitudesf- joined #nim |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:04:48 | * | gmpreussner joined #nim |
07:05:14 | * | solitudesf- quit (Ping timeout: 258 seconds) |
07:11:54 | PMunch | Why is getEnv in the ospaths module? That is a bit unintuitive |
07:12:51 | FromGitter | <jrfondren> in devel, that's a deprecated module that just reexports from os |
07:23:29 | PMunch | Ah, nice |
07:25:12 | * | Perkol joined #nim |
07:41:56 | * | slugm joined #nim |
07:53:43 | FromGitter | <kayabaNerve> Thanks leorize[m] for the clarification |
07:54:17 | * | rnrwashere quit (Remote host closed the connection) |
07:54:59 | FromGitter | <kayabaNerve> Nim |
07:55:15 | FromGitter | <kayabaNerve> *Nim's macros are one of the best things about Nim, especially with how flexible they are. |
07:55:33 | * | SebastianM joined #nim |
07:56:02 | FromGitter | <kayabaNerve> I use two macros in my code base, one for stricter error handling and a valid raises on async, and one to stop double setting fields on refs by accident. |
07:56:10 | SebastianM | Hey guys, |
07:56:18 | FromGitter | <kayabaNerve> It's great to be able to open up the compiler like that. Next we just need file wide macros... |
07:56:32 | FromGitter | <jrfondren> templates can be scoped to a single proc body. |
07:56:52 | SebastianM | Is there a way to discover object methods like in Python? dir(object)? |
07:56:55 | FromGitter | <kayabaNerve> Is there a Feature Request for that? It's been discussed often, and the general discussion is: "I want to do X" "Can't be done" "Maybe can be" "Filters" |
07:57:25 | FromGitter | <jrfondren> @kayabaNerve for file-scoped macros? |
07:57:27 | FromGitter | <kayabaNerve> I've been on the side that recommends filters, but I actually sat down with them the other day and they just aren't a valid option. |
07:57:28 | FromGitter | <kayabaNerve> Yeah. |
07:57:36 | FromGitter | <kayabaNerve> A single line at the top of the file. |
07:57:51 | FromGitter | <kayabaNerve> Filters are line by line and therefore can't be used to apply a leading ident to the entire file. |
07:58:30 | FromGitter | <jrfondren> SebastianM, what I tend to do is start inim and type void.blah , so that inim can complain about the type mismatch, and suggest valid alternatives |
07:58:33 | FromGitter | <kayabaNerve> I tried doing two replace filters chained together; one replacing \n with `\n `, and one replacing `\n <-` with \n. |
07:59:02 | FromGitter | <kayabaNerve> Gitter removes the spaces, but the `\n`s in code tags are meant to have 4 spaces after... |
07:59:04 | FromGitter | <jrfondren> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc0174797dcb371d8048fbd] |
07:59:38 | FromGitter | <jrfondren> the wiki says that dir()-style reflection is possible but I haven't seen an example of it yet |
08:02:03 | * | neceve joined #nim |
08:03:08 | FromGitter | <jrfondren> are you sure that macros *aren't* file scoped already? |
08:03:37 | SebastianM | jfrontdren, thank you |
08:03:50 | FromGitter | <jrfondren> loosely speaking. modules like sugar have export symbols on their macros after all. |
08:04:55 | * | SebastianM quit (Quit: Seeya) |
08:05:46 | * | floppydh joined #nim |
08:07:10 | FromGitter | <jrfondren> OK, I guess you're watching to be given the entire AST of the file to work with. |
08:17:11 | FromGitter | <jrfondren> @kayabaNerve well it looks relatively easy to add a new kind of source filter. |
08:17:34 | FromGitter | <jrfondren> start with filterNames in compiler/syntaxes.nim |
08:18:01 | FromGitter | <jrfondren> and applyFilter has a case that could be extended. |
08:23:10 | PMunch | Hmm, I'm trying to create a template/macro that adds explanations to error messages to the documentation. Something like expl("Something went wrong", "This message occurs when blah, blah, blah, blah") only "Something went wrong" will be printed, but the procedure should have a table of messages and explanations |
08:23:45 | PMunch | Hmm, maybe a pragma applied to the procedure is the only way.. |
08:24:05 | PMunch | Adding ## in the middle of a procedure body doesn't work.. |
08:25:09 | leorize[m] | you can use a placeholder template I believe |
08:26:14 | PMunch | Placeholder? |
08:28:01 | leorize[m] | ah, I misread your msg, sorry |
08:28:16 | * | slugm quit (Remote host closed the connection) |
08:28:24 | leorize[m] | yea, I think you'd need a pragma for that |
08:32:30 | * | slugm joined #nim |
08:33:22 | FromGitter | <kayabaNerve> @jrfondren It's possible to edit the compiler in a lot of ways. |
08:33:46 | FromGitter | <kayabaNerve> A file wide macro that requires a compiler edit shouldn't be via a filter. |
08:38:35 | FromGitter | <jrfondren> that's at least an option that clearly signals that something weird's going on. I'm already a little repulsed by the performWithUndo do-notation example, where code that looks visually unrelated to the preceding code is actually part of the preceding code's control flow. |
08:40:09 | Araq | the 'do' notation was moved to manual_experimental for a reason |
08:40:33 | Araq | and I *hate* full file rewrite macros which is why they don't exist |
08:41:01 | Araq | you cannot read code where anything is subject to arbitrary macro rewrites |
08:41:44 | * | slugm_ joined #nim |
08:43:02 | * | Vladar joined #nim |
08:44:08 | * | slugm quit (Ping timeout: 258 seconds) |
08:44:30 | FromGitter | <jrfondren> or even if you can in practice, tooling stops being able to. Perl can't even syntax check a script if it includes a module that isn't available. |
08:45:23 | * | slugm_ quit (Remote host closed the connection) |
08:48:27 | * | slugm joined #nim |
08:48:40 | * | SebastianM joined #nim |
08:50:37 | * | slugm quit (Remote host closed the connection) |
08:50:56 | SebastianM | Araq, guys:I discovered nim secrets and playing with it for learning purposes. But when i type e.g var a = 10 it echoes 10 and when i then type e.g a = 15 it echoes 10, the previous value.Could you please check it? Nim nightly from yesterday. Thank you |
08:51:12 | * | SebastianM quit (Client Quit) |
08:51:48 | leorize[m] | nim secret is a secret for a reason :p |
08:52:25 | FromGitter | <jrfondren> nimble install inim . it's pretty good. |
08:52:27 | * | slugm joined #nim |
08:52:30 | PMunch | SebastianM, you mean like this http://ix.io/1H3v/ ? |
08:52:37 | narimiran | SebastianM: see if `inim` works better for you |
08:53:21 | FromGitter | <kayabaNerve> Araq: It's all about scope. Can you read a function if it has a macro? |
08:53:34 | FromGitter | <kayabaNerve> If you can, then why can't you read a file if it has a macro? |
08:53:34 | PMunch | Hmm, what's the best way to have a macro just slightly modify it's input? |
08:53:49 | FromGitter | <kayabaNerve> It's just removing the requirement to apply a 4 space ident to everything |
08:54:00 | PMunch | As in replace instances of something with something else. Do I need to build the entire tree over again, or use deepCopy? |
08:54:03 | narimiran | btw, i also tested it on devel (PMunch tested it with 0.19.4) and it seems to work correctly |
08:54:26 | FromGitter | <kayabaNerve> It's not like the discussion is about having external files apply macros. The discussion is about a file having it's L1 declaring a file wide use of macro X. |
08:55:30 | leorize[m] | don't really know if this works: {.push: yourmacro.} |
09:06:22 | Araq | yes, I can read the function because the macro call would be written as |
09:06:26 | Araq | m: proc |
09:06:34 | Araq | or proc ... {.m.} |
09:06:51 | Araq | and that makes all the difference |
09:06:58 | * | sentreen_ quit (Quit: sentreen_) |
09:07:14 | * | sentreen joined #nim |
09:12:51 | leorize[m] | Araq: should "cast[seq[byte]](string)" (and the reverse) get their own procs? This is common enough in Nim when you have to deal with binary data |
09:13:15 | PMunch | Hmm, so I can't deep copy, and I can't define the input to a macro as var. So do I have to manually recreate the entire tree? |
09:14:22 | FromGitter | <mratsim> I don't think so |
09:14:46 | FromGitter | <mratsim> we should change usage of strings for binary to seq[byte] instead |
09:15:05 | FromGitter | <mratsim> I'm not even sure how cast seq[byte] would interact with destructors |
09:15:28 | FromGitter | <mratsim> @PMunch, thoughts on protobuf2 support? https://github.com/PMunch/protobuf-nim/issues/16 |
09:16:12 | leorize[m] | IIRC Araq said it'd work, and a quick look at their structures in seqs and strs module yield similar structures |
09:16:33 | PMunch | mratsim, oh sorry. I read that while on a super dingy internet connetion and forgot to reply when I got back |
09:17:11 | * | Perkol quit (Remote host closed the connection) |
09:17:27 | Araq | leorize[m]: didn't you fix 'cast' with --newruntime? |
09:17:49 | leorize[m] | mratsim: and while we should change string to seq[byte] for binary, that won't make all the current libs change :/ |
09:18:11 | leorize[m] | Araq: I didn't? |
09:18:33 | leorize[m] | must be cooldome or someone else :p |
09:19:41 | Araq | ok it was somebody else then. but it works |
09:23:19 | FromGitter | <mratsim> @leorize, yeah I know but I think we're going there. For crypto I already raised this: https://github.com/nim-lang/RFCs/issues/32 and nimcrypto is doing the right thing (TM) and PMunch added streaming from seq byte in streams as well. |
09:23:46 | FromGitter | <mratsim> I'm not too sure about the other domain that often use binary blobs (graphics?) |
09:26:44 | FromGitter | <mratsim> @Araq, thoughts on revisiting all binary blob proc in stdlib, use seq[byte] and deprecated the string API? I think we should do that for 0.20 so that we don't entrench bad practice in 1.0 |
09:26:51 | FromGitter | <mratsim> deprecate* |
09:27:58 | FromGitter | <mratsim> I think we should leave newStringStream for interop with C `char *` but at least all the crypto packages should be changed |
09:29:58 | PMunch | Why isn't there a prepend in the macros module? |
09:33:01 | * | xet7 quit (Quit: Leaving) |
09:34:18 | * | stefanos82 joined #nim |
09:34:27 | FromGitter | <jrfondren> so the benefit of avoiding strings for binary data, is it that strings are immutable but when you have large blobs of binary data you often want to mutate it? or is it "the word string should only apply to properly encoded human text" like in lots of other languages? |
09:34:44 | * | Cthalupa quit (Ping timeout: 258 seconds) |
09:34:49 | leorize[m] | the latter |
09:35:03 | FromGitter | <jrfondren> then I prefer the status quo. |
09:35:22 | narimiran | jrfondren: strings are mutable, btw |
09:35:44 | * | Cthalupa joined #nim |
09:35:46 | FromGitter | <jrfondren> too many experiences of "OK I want to sling bytes around and I don't care about them at all except that they should move from here to there OH NO AN UNICODE ALLIGATOR EMOJI, the server just crashed" |
09:36:02 | * | xet7 joined #nim |
09:36:19 | FromGitter | <jrfondren> that's a real world example btw. |
09:37:39 | leorize[m] | uhmm, care to elaborate? If it's utf-8, then everything is composed with byte, how can your server crash? |
09:38:18 | FromGitter | <jrfondren> the server validated its strings. Unicode though is a moving target, so clients started sending what they but not the server considered to be valid. |
09:39:36 | leorize[m] | Nim doesn't do that unless you told it to :p |
09:39:41 | FromGitter | <jrfondren> yeah, I like that. |
09:40:10 | dom96 | what does this have to do with seq[byte] vs. string? |
09:40:13 | FromGitter | <mratsim> It's not about the message content or encoding, it's about what is expected. |
09:40:29 | * | Cthalupa quit (Ping timeout: 258 seconds) |
09:40:38 | FromGitter | <jrfondren> I like the status quo where Nim doesn't enforce any encoding and strings can contain binary. |
09:40:53 | FromGitter | <mratsim> binary blob --> seq[byte], something for humans --> string |
09:40:56 | FromGitter | <jrfondren> I asked what the point was of moves to not enforce the bad practice of using the string type for binary data |
09:41:19 | dom96 | jrfondren: Oh I agree with you there |
09:41:25 | FromGitter | <mratsim> the goal is about using the type system to prevent bugs |
09:41:45 | FromGitter | <jrfondren> type HumanString = distinct string |
09:41:48 | FromGitter | <mratsim> especially for crypto, where you have string message but output binary blob |
09:42:08 | dom96 | Do we really want socket.recv to return a seq[byte]? |
09:42:26 | FromGitter | <jrfondren> well the output could be anything, couldn't it. Someone could encrypt random noise and send it to you. |
09:42:30 | dom96 | Most protocols are in fact human friendly |
09:42:50 | * | Cthalupa joined #nim |
09:43:14 | leorize[m] | which is why I think a set of zero cost conversion procs are nice... |
09:43:47 | FromGitter | <jrfondren> seq[byte] and string do seem to be identically backed. |
09:43:48 | FromGitter | <mratsim> wehn you see a seq[byte] in the signature, you know that you can receive anything, so that you need to validate it. |
09:44:00 | FromGitter | <mratsim> yes string and seq[byte] can be casted into each other |
09:44:20 | FromGitter | <mratsim> apparently it started as an implementation detail but Araq will keep it like that in the future |
09:44:55 | dom96 | casted? He should make it possible to type convert these then |
09:45:04 | dom96 | cast should be viewed as dangerous |
09:46:14 | FromGitter | <mratsim> Regarding recv, it uses a void *: https://nim-lang.org/docs/posix.html#recv%2CSocketHandle%2Cpointer%2Cint%2Ccint |
09:46:57 | FromGitter | <mratsim> so you can recv into a seq byte |
09:47:04 | FromGitter | <jrfondren> yeah, the raw syscalls don't care about data. I really hate spending hours at a time trying to find the incantation that'll tell some of these languages how to do that and not mess with it further. |
09:47:13 | FromGitter | <mratsim> This is what we use in Chronos |
09:47:14 | Zevv | I would be sad if I could no longer recv and send strings |
09:47:42 | Zevv | conversion is still cumbersome, and casting is nasty |
09:47:44 | leorize[m] | I'm pretty sure recv should return a TaintedString |
09:48:17 | Zevv | seems the right thing to do |
09:48:25 | FromGitter | <jrfondren> does distinct not work well on strings? I've noticed that it can be pretty annoying to get the desired borrows, in other uses. |
09:48:45 | FromGitter | <mratsim> we can have recv(buffer: var TaintedString|seq[byte], foo: ...) |
09:49:01 | FromGitter | <mratsim> distinct works on strings, but is unusable with generics |
09:49:04 | leorize[m] | distinct works well, just that it's underused |
09:49:15 | dom96 | most people use the recv that returns a string |
09:49:32 | FromGitter | <mratsim> because they have no other option |
09:49:58 | leorize[m] | doesn't mean you should drop the byte folks when you could just support them :p |
09:50:31 | leorize[m] | also TaintedString seems to be more inline with how other parts like readLine works |
09:53:28 | dom96 | yeah, I agree that TaintedString should be returned |
09:54:40 | * | r4vi quit (Ping timeout: 264 seconds) |
09:54:40 | * | enigmeta quit (Ping timeout: 264 seconds) |
09:54:52 | * | enigmeta joined #nim |
09:58:38 | * | r4vi joined #nim |
09:58:56 | * | iLiquid joined #nim |
10:02:05 | FromGitter | <yglukhov> `string` in computer science usually means a sequence of characters. `TaintedString` means something intended to be a string, but needing some validation first. `seq[byte]` is a sequence of arbitrary bytes (binary data). What am i missing here? |
10:02:44 | * | lritter joined #nim |
10:02:48 | Zevv | well, it just depends on how you're going to handle the data. Some protocols are better handled by strings, some by binary data. |
10:03:00 | FromGitter | <jrfondren> there are a bunch of crypto modules that differ in the types they use and that's annoying. There's also a sentiment that strings should mean valid Unicode and that worried me. that's all. |
10:03:42 | Zevv | Oh I never knew that - but there is nothing in place enforcing that anywhere, right? |
10:03:44 | leorize[m] | oh, I believe Nim will never enforce any encoding on string |
10:03:48 | FromGitter | <mratsim> user-supplied string needs to be checked anyway for validity |
10:04:15 | Zevv | But still - apart from casting, there is no zero-cost way to convert strings into seq[char] or seq[byte], right? |
10:04:29 | FromGitter | <mratsim> but the string type should be intended for something using human characters whatever encoding is used, not for raw binary data |
10:04:56 | FromGitter | <jrfondren> since the casting is safe, I guess the zero-cost way would just be an inline proc that does the cast, so you don't have to :) |
10:05:07 | FromGitter | <yglukhov> So is `recv` is tcp/udp, there's no notion of "sequence of characters" at that level. It's only binary data. Which you can further try interpreting as sequence of characters (ie string). |
10:05:22 | leorize[m] | Zevv: yea, and I think we should add some proc for that |
10:05:44 | Zevv | that would make sense. If the underlying representation changes one day, casting is no longer valid. |
10:06:28 | Zevv | And the system calls handling void* is a good indicatio that there is no right answer here. It is just bytes - I might want to put it in a string, or put it in a seq[byte], depending on what I'm doing. |
10:07:06 | FromGitter | <jrfondren> which anyway leads back to "modules differ in their choices and that's annoying" |
10:07:45 | leorize[m] | anyone want to make toString and toSeqByte? |
10:07:52 | FromGitter | <mratsim> which is why I want to tackle standardizing that, at least for my domain of interest |
10:08:00 | * | couven92 joined #nim |
10:08:18 | FromGitter | <mratsim> because I don't want to have more crypto packages using string or seq[uint8] (yes there are) |
10:08:42 | FromGitter | <mratsim> and string is sometimes expected to be hex string ... |
10:08:58 | Zevv | mratsim: makes sense, what is your proposal then? |
10:09:40 | FromGitter | <mratsim> For crypto, deprecates string for binary, and have a seq[byte] proc for starter |
10:09:47 | Zevv | 11:14 < FromGitter> <mratsim> we should change usage of strings for binary to seq[byte] instead |
10:09:51 | Zevv | sorry :) |
10:10:23 | FromGitter | <mratsim> also I have to check the "$" implementation so that it's consistent, some produce a binary string, and some produce hex code |
10:10:59 | FromGitter | <mratsim> regarding networking I think we should have both TaintedString|seq[byte] recv and friends |
10:11:05 | FromGitter | <mratsim> and deprecate the string one. |
10:11:15 | FromGitter | <jrfondren> that's going too far. |
10:11:16 | FromGitter | <mratsim> that's assuming we want to go forward with TaintedString |
10:11:31 | FromGitter | <mratsim> there is a RFC by timotheecour on that though |
10:11:32 | FromGitter | <jrfondren> oh well TaintedString instead of string is fine |
10:12:09 | Zevv | TaintedString makes sense, as converting to a string is trivial |
10:12:36 | Zevv | TaintedString is nothing more then a distinct string, right? |
10:12:48 | Zevv | there is no magic under the hood |
10:12:57 | FromGitter | <mratsim> iirc there were some complaints that it's still costly because you have to think about it but better check the RFC, I didn't really participate in it |
10:13:12 | FromGitter | <jrfondren> moreover if you don't turn tainting on, you get a string. |
10:14:00 | FromGitter | <mratsim> Feel free to discuss: https://github.com/nim-lang/RFCs/issues/24 |
10:14:05 | Zevv | well, the whole purpose is to make you think about it. You're pulling in unsafe data, just on your hands for a second before you handle it |
10:14:31 | FromGitter | <jrfondren> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc037073b6cb0686a44eb7b] |
10:14:46 | FromGitter | <jrfondren> see? what a cool language. |
10:15:09 | FromGitter | <mratsim> The conversation is stale so it's good to have new Nim devs perspective on that |
10:15:53 | FromGitter | <jrfondren> want that in Ruby or Perl, you've got to hack it into the guts of the interpreter. If Nim didn't provide TaintedString, a nimble module could provide all the tainted versions and people could use that instead of the flag. |
10:16:04 | Zevv | I guess defaulting to the safe mode is also good from the PR stance of Nim being a safe language. |
10:23:50 | * | Vladar quit (Remote host closed the connection) |
10:27:02 | Araq | maybe TaintedString is the wrong idea |
10:27:37 | Araq | 'string' is already quite "untyped", what matters is that you don't end up with 'string' in your SQL/HTML |
10:28:33 | Araq | nor in your osproc calls... |
10:30:28 | FromGitter | <mratsim> Hopefully showing that we care about types in stdlib will make dev care about types in their own lib |
10:35:46 | Araq | yeah. I think that's it. in the compiler I have nimnode.strVal of type 'string'. has that gone through Nim's parser? yes. so it's not a 'TaintedString'. Can I pass n.strVal to 'exec'? seems to be a terrible idea |
10:49:16 | FromGitter | <kayabaNerve> Araq: So proc {.m.} is clear, as well as m: proc, but not apply(m) \r\n proc() |
10:49:36 | Araq | yes. |
10:49:45 | FromGitter | <kayabaNerve> Eh. Writing it as a function call sucks. apply is also way to generic a function name. |
10:49:52 | FromGitter | <kayabaNerve> :thinking: |
10:49:59 | Araq | that's where Nim and I draw the line. |
10:50:18 | Araq | a macro can influence its children, not its parents |
10:50:42 | * | kapil____ quit (Quit: Connection closed for inactivity) |
10:51:40 | FromGitter | <kayabaNerve> I think those are the same level |
10:52:15 | FromGitter | <kayabaNerve> I think a parent would be if a file wide macro affected a file which imported the file the macro was in |
10:57:43 | krux02 | @mratsim: can you elaborate more on what you want to do in 11091 a bit more? |
10:57:58 | krux02 | I think I did something similar in the past, and there is a better approach to do it. |
10:59:34 | FromGitter | <mratsim> my main issue is the openSymChoice of [] instead of nnkBracketExpr |
11:02:08 | FromGitter | <mratsim> second issue but more meta is that I'm always fighting with symbols in macros :/ |
11:02:21 | PMunch | Hmm, grid tables aren't implemented. That's incovenient.. |
11:02:33 | PMunch | The simple table syntax is a bit of a pain to make programatically |
11:02:39 | FromGitter | <mratsim> I've opened a feature request a year ago about grid tables |
11:07:05 | FromGitter | <mratsim> Pandoc outputs grid tables by default as well which is useful to convert markdown to rst |
11:11:17 | FromGitter | <mratsim> A captcha with what is the result of 2+2 would go a long way to prevent those pesky spammers |
11:11:51 | Zevv | !eval 2+2 |
11:11:51 | NimBot | Compile failed: <no output> |
11:12:07 | FromGitter | <mratsim> or a hidden field that is not supposed to be filled or both |
11:12:10 | narimiran | !eval echo 2+2 |
11:12:11 | NimBot | Compile failed: <no output> |
11:12:41 | FromGitter | <mratsim> !eval echo(2+2) |
11:12:41 | NimBot | Compile failed: <no output> |
11:12:48 | FromGitter | <mratsim> I think the bot is dead |
11:12:50 | FromGitter | <liquid600pgm> iirc nimbot is broken |
11:12:55 | Zevv | For months |
11:13:00 | FromGitter | <mratsim> !eval echo "It's alive!" |
11:13:00 | NimBot | Compile failed: <no output> |
11:13:25 | Zevv | I fork bombed it once, and that also killed the live nim playbin. |
11:13:41 | Zevv | iirc the original maintainers were not pleased with the setup and decided not to bring it back up |
11:14:06 | FromGitter | <mratsim> mmm the playground is dead as well :/ |
11:14:17 | krux02 | that is sad |
11:14:22 | narimiran | playground has been dead for quite a long time |
11:14:27 | Zevv | ^ |
11:14:41 | FromGitter | <mratsim> I guess that's why the bot doesn't work |
11:14:43 | krux02 | mratsim: but about your problem with the symbols in the macro, I had very similar problems |
11:15:13 | dom96 | nimbot isn't broken |
11:15:15 | dom96 | the playground is |
11:15:19 | FromGitter | <mratsim> Yeah I expect everyone to have issues with those, even strformat was due to symbols |
11:15:20 | dom96 | all nimbot does is call it |
11:15:24 | krux02 | I think I eventually gave in and made my macro aware of nnkBrackedExpr and the call to ``[]`` as well. |
11:15:30 | dom96 | once again, I repeat |
11:15:35 | dom96 | I've got a Droplet ready |
11:15:42 | dom96 | someone just needs to set up the playground on it |
11:15:44 | dom96 | any takers? |
11:16:12 | * | dddddd joined #nim |
11:16:23 | FromGitter | <mratsim> what's a droplet :? |
11:16:30 | PMunch | I was supposed to take over the playground.. |
11:16:31 | krux02 | I wanted to ask the same thing |
11:16:38 | krux02 | I have no idea what a droplet is |
11:16:39 | dom96 | digitalocean VPS |
11:16:46 | krux02 | VPS? |
11:16:50 | PMunch | But no-one ever gave me access to it.. |
11:16:55 | FromGitter | <liquid600pgm> virtual private server |
11:16:58 | FromGitter | <mratsim> VPS is like a server |
11:17:05 | FromGitter | <mratsim> but in a container |
11:17:09 | FromGitter | <liquid600pgm> ^ |
11:17:15 | krux02 | ok |
11:17:21 | PMunch | So I guess what I'm saying is dom96 that I can set it up |
11:17:39 | krux02 | I think sooner or later we are better off with a real PS (private server) |
11:17:46 | PMunch | Or well, I don't know how to, since I never saw the old setup. But I can hopefully figure it out :P |
11:17:58 | dom96 | PMunch, it's a learning experience :) |
11:18:07 | dom96 | send me your public ssh key and I'll add you |
11:18:16 | dom96 | krux02, why? |
11:18:23 | krux02 | mratsim: what does your macro compile |
11:18:40 | krux02 | dom96, mostly because of testing timeouts. |
11:19:07 | krux02 | on private servers we can control the testing environment better. |
11:19:08 | dom96 | you mean for CI? |
11:19:12 | FromGitter | <mratsim> @krux02: the full example is here - https://github.com/mratsim/compute-graph-optim/blob/master/e10_DSL_compiler_interleaved.nim#L364-L381 |
11:19:12 | krux02 | yes |
11:19:21 | dom96 | I agree |
11:19:28 | dom96 | but just call them VPS' |
11:19:29 | * | vlad1777d__ quit (Ping timeout: 255 seconds) |
11:19:47 | krux02 | mratsim: what does it do? |
11:20:05 | FromGitter | <mratsim> I'm building a neural network compiler, so mostly linear algebra, for now I compile to Nim code, next step is compiling to SSE/AVX instructions with dynamic dispatch |
11:20:19 | FromGitter | <mratsim> next step is compiling to LLVM bitcode for cuda/opencl/vulkan code generation |
11:21:10 | FromGitter | <mratsim> basically I have a expression, say a + b + c on a sequence of floats, I fuse all loops and output optimised SIMD instructions with runtime CPU detection |
11:21:12 | krux02 | well, since I already have a working nim to glsl compiler I think I might be able to give you some valuable information |
11:21:33 | krux02 | so what is a in this context? |
11:21:41 | FromGitter | <mratsim> a sequence of float |
11:21:47 | krux02 | is a + b + c part of a kernel? |
11:21:49 | FromGitter | <mratsim> b is the same, of the same length |
11:21:53 | FromGitter | <mratsim> and c as well |
11:21:59 | FromGitter | <mratsim> you can view that as a kernel yes |
11:22:00 | krux02 | or is `+` a vector/seq instruction? |
11:22:08 | FromGitter | <mratsim> and in the future I want to be able to compose them |
11:22:09 | krux02 | ah ok |
11:22:29 | krux02 | you want to compose what? |
11:22:31 | FromGitter | <mratsim> basically a is an AstNode, and compile materialize that |
11:23:06 | FromGitter | <mratsim> foo = a + b + c, bar = foo * 2 --> foobar should fuse everything without ever materializing the foo intermediate sequence |
11:23:37 | FromGitter | <mratsim> and it should support statement as well, like foo += a |
11:24:15 | * | Trustable joined #nim |
11:24:34 | FromGitter | <mratsim> the link I gave is a proof of concept working for scalars |
11:25:21 | krux02 | ah, I get it now. |
11:25:46 | krux02 | the syntax is a bit confusing to me right now |
11:25:59 | FromGitter | <mratsim> I'll work on that |
11:26:24 | krux02 | I would probably try to keep the normal function syntax |
11:26:59 | FromGitter | <mratsim> Yeah I could use normal function syntax and scan it in a macro |
11:27:03 | krux02 | proc foobar[T](a, b, c: T): tuple[bar, baz, buzz: T] {.compile.} = buzz = a * 1000 |
11:27:16 | FromGitter | <mratsim> I wouldn't need a template for scoping that way |
11:27:19 | FromGitter | <mratsim> even better |
11:27:33 | FromGitter | <mratsim> thanks for the suggestion |
11:27:36 | krux02 | with get impl you can even do it without annotating the function at all |
11:28:43 | krux02 | sometimes the solution is very simpler, but for strange reasons you just don't see it. |
11:29:28 | FromGitter | <mratsim> I was focused on the AST so I just used my first idea for API :p |
11:29:55 | * | i7sDream joined #nim |
11:30:27 | krux02 | yea, it matters to reuse existing patterns in the language, because they have been proven to work |
11:30:41 | krux02 | and they are supported by other structures in the language. |
11:31:05 | FromGitter | <mratsim> when I say focused, I was checking embedded domain specific language in Scala, Haskell, ocaml, stuff like church encodings, attribute grammars, tagless typed interpreters: https://github.com/mratsim/Arraymancer/issues/347#issuecomment-461009747 |
11:31:53 | krux02 | I don't know church encodings, but I do know embedded DSLs |
11:32:09 | krux02 | I think Nim is the best language in the world right now to implement them. |
11:32:15 | FromGitter | <mratsim> I agree |
11:33:33 | FromGitter | <mratsim> I think it's also the best language to implement emulators/VM and JITs |
11:33:45 | krux02 | not sure about that, never did it |
11:34:07 | krux02 | but it can be |
11:34:08 | FromGitter | <liquid600pgm> writing a programming language was pretty fun in Nim, never finished it though |
11:34:17 | FromGitter | <liquid600pgm> I plan on getting back to the project after a while |
11:34:19 | FromGitter | <mratsim> all emulators and JIT need an opcode table |
11:34:31 | krux02 | I once implemented an eDSL in Nim, where sums in einstein notation should be compiled into calls into blas. |
11:34:42 | FromGitter | <mratsim> Plenty use an intermediate codegen either in the host language or Python |
11:34:52 | FromGitter | <mratsim> ah I'm interested |
11:35:05 | krux02 | so expressions like a[i,j] = x[i,k] * y[j,k] |
11:35:05 | FromGitter | <mratsim> I need to implement einsum for Arraymancer |
11:35:30 | FromGitter | <liquid600pgm> oh man I love the fact you can have multiple index arguments |
11:35:44 | FromGitter | <liquid600pgm> it's pretty useful for implementing tilemap-based worlds in game dev |
11:35:56 | krux02 | well, it is just a minor thing |
11:36:23 | krux02 | btw for tilemap I prefer to use vector types for indexing |
11:36:32 | krux02 | mymap[vec2i(3,4)] |
11:36:38 | FromGitter | <liquid600pgm> why? |
11:36:53 | krux02 | because I use vector types everywhere |
11:37:07 | krux02 | for pos in vec2i(0) ..< vec2i(size): |
11:37:30 | FromGitter | <liquid600pgm> aah, that makes sense |
11:38:01 | FromGitter | <liquid600pgm> those minor things add up though, and make for a pretty sweet language |
11:38:15 | krux02 | you can also have an overload for bilinear sampling mymap[vec2f(1.4,2.12)] |
11:38:29 | FromGitter | <mratsim> iirc someone proposed to create a nimgame channel as we have several game devs |
11:39:43 | krux02 | well, I don't think we have enough of them to keep a nimgame channel active |
11:40:01 | krux02 | also I don't want to be a lurker in 100 channels |
11:40:06 | FromGitter | <mratsim> :P |
11:40:26 | FromGitter | <mratsim> then I guess, a regular NimGame blog post with those kind of tips might attract more people |
11:40:41 | narimiran | +1 |
11:40:53 | krux02 | well the vec2i(0) ..< vec2i(size) loop works in all languages that I used so far |
11:41:08 | krux02 | maybe not go |
11:41:32 | krux02 | but it works in c++, scala and Nim |
11:41:44 | * | Trustable quit (Remote host closed the connection) |
12:08:23 | federico3 | I think we need a nimgame lib more than a channel ;D |
12:08:38 | narimiran | federico3: https://github.com/Vladar4/nimgame2/ ? |
12:09:15 | narimiran | one of the best documented nim packages from what i've seen. https://vladar4.github.io/nimgame2/ |
12:09:24 | FromGitter | <liquid600pgm> I'm also creating a game engine for Nim, it's not finished yet though |
12:09:41 | federico3 | something like that |
12:10:56 | * | NimBot joined #nim |
12:27:42 | * | i7sDream_ joined #nim |
12:28:05 | FromGitter | <liquid600pgm> was `generic` ever a keyword in Nim? |
12:30:27 | * | i7sDream quit (Ping timeout: 245 seconds) |
12:33:20 | Araq | yes I think so |
12:33:57 | FromGitter | <liquid600pgm> aah, that explains why the VS Code syntax highlights it red, as if it were a syntax error |
12:56:11 | * | i7sDream_ is now known as i7sDream |
13:08:02 | * | i7sDream quit (Quit: WeeChat 2.4) |
13:11:50 | shashlick | Anyone gotten nimble running on Android? Having libssl issues |
13:16:05 | PMunch | shashlick, I think couven92 might've done it |
13:16:33 | PMunch | By the way, onyone know how to have a .. code-block formatted as Nim code in a documentation comment |
13:17:19 | narimiran | PMunch: what do you mean? what is the problem? |
13:17:45 | PMunch | I tried to do .. code-block:: Nim (both upper and lower case) but it just messed up the formatting |
13:17:58 | FromGitter | <mratsim> .. codeblock::nim o something like that, can never remember RST |
13:18:43 | FromGitter | <mratsim> .. code:: nim |
13:18:57 | narimiran | PMunch: stdlib uses exactly what you have tried.... |
13:19:05 | FromGitter | <mratsim> https://github.com/mratsim/Arraymancer/blob/a4d3fc11f337f0c1837fdb19a34c3b7b7fa6c65c/src/tensor/higher_order_applymap.nim#L116-L136 |
13:19:13 | FromGitter | <liquid600pgm> are you sure you indented the code block correctly? |
13:19:41 | FromGitter | <mratsim> and this is the output: https://mratsim.github.io/Arraymancer/tensor.higher_order_applymap.html#map%2CTensor[T]%2C |
13:19:44 | narimiran | yes, was going to ask exactly that. leave some spaces between ## and your not-indented stuff |
13:19:46 | * | stefanos82 quit (Remote host closed the connection) |
13:20:06 | FromGitter | <liquid600pgm> one space should be enough |
13:20:24 | narimiran | but for you own sake, use two ;) |
13:21:31 | PMunch | narimiran, aaah I just forgot to have a blank newline before my .. code-block :) |
13:21:40 | narimiran | heh |
13:22:05 | narimiran | (nim's) rst parser is quite picky and it doesn't forgive any mistakes :) |
13:22:40 | narimiran | once i did ..code-block:: and it failed |
13:22:44 | shashlick | Thanks @PMunch - wonder if @couven92 is on here |
13:23:02 | shashlick | I could statically compile in libssl but that doesn't feel right |
13:23:24 | shashlick | Also am really wondering who will be compiling stuff directly on the end device |
13:23:33 | narimiran | now, how do i create theindex.html? |
13:23:56 | PMunch | --index:on or something like that |
13:24:07 | PMunch | It's in the docgen documentation |
13:24:37 | narimiran | PMunch: thanks, found it |
13:26:33 | narimiran | ...but there's no index still :) |
13:28:27 | narimiran | hahah, downloading https://nim-lang.github.io/Nim/theindex.html works like a charm for my use case :D :D |
13:28:51 | FromGitter | <kaushalmodi> narimiran: probably this might help: https://github.com/kaushalmodi/nim_config/blob/ffdefa859b9b9837dcb8fe643f04a75e5f98089b/config.nims#L249-L266 |
13:29:12 | narimiran | kaushalmodi: thanks! |
13:29:41 | FromGitter | <kaushalmodi> there was a hack involved as you see in that task |
13:32:17 | * | leorize joined #nim |
13:33:27 | leorize | anyone used `norm` (the nim ORM)? |
13:37:33 | Araq | NOTE: appveyor is down/weird |
13:37:46 | Araq | do not merge PRs until it's active again |
13:52:46 | FromGitter | <mratsim> Nim ORM is supposed to be Ormin |
13:54:44 | leorize | There's a new ORM called norm |
13:55:42 | leorize | I'm having no idea how to search for a row via a field in the object though |
14:11:58 | Araq | narimiran: actually Nim's RST parser is less picky than docutils' |
14:12:08 | Araq | but it sucks :-) |
14:12:26 | narimiran | :D |
14:16:54 | * | clyybber joined #nim |
14:18:04 | clyybber | HCR talk got uploaded yesterday: https://www.youtube.com/watch?v=7WgCt0Wooeo |
14:22:50 | clyybber | dom96: And the corresponding HN thread: https://news.ycombinator.com/item?id=19738572 |
14:23:12 | FromGitter | <jrfondren> "heavily biased C++ rant", exactly what my morning needed :) |
14:26:16 | * | solitudesf- joined #nim |
14:28:43 | Zevv | What's this Viktor Kirilov's real name? |
14:28:51 | Zevv | Is it someone we know from #nim? |
14:28:57 | dom96 | oooh nice clyybber |
14:29:01 | krux02 | clyybber, well sad to know that that the talk is already outdated |
14:29:44 | FromGitter | <mratsim> https://www.reddit.com/r/programming/comments/bgvai3/nim_first_natively_compiled_language_with_hot/ |
14:29:46 | krux02 | multimethods are on the way out |
14:31:16 | leorize | Zevv: it's someone that's currently hired with the grant from Status |
14:31:19 | PMunch | Is there a way to pass a list to a pragma? |
14:31:28 | leorize | I believe I've never seen that guy on IRC |
14:31:52 | FromGitter | <jrfondren> like {.emit: [result, " = getenv(\"this?\");"].} |
14:31:59 | narimiran | Zevv: https://github.com/onqtam |
14:32:02 | FromGitter | <mratsim> I'll redo the reddit post it's broken |
14:32:07 | leorize | PMunch: you can just use an array? |
14:33:09 | * | floppydh quit (Quit: WeeChat 2.4) |
14:33:34 | FromGitter | <mratsim> ah, playback on other websites is disabled |
14:33:47 | FromGitter | <mratsim> so https://www.reddit.com/r/programming/comments/bgvbym/nim_first_natively_compiled_language_with_hot/ |
14:34:36 | PMunch | leorize, those are static length |
14:34:47 | * | Vladar joined #nim |
14:35:12 | leorize | you can use varargs for non-static length |
14:40:26 | clyybber | Zevv: Its onqtam on github |
14:41:44 | PMunch | leorize, hmm. I'll have to look into that tomorrow |
14:43:33 | * | PMunch quit (Remote host closed the connection) |
14:49:16 | livcd | Viktor Kirilov sounds so damn familiar |
14:49:30 | FromGitter | <mratsim> He is often in C++ conferences |
14:49:42 | livcd | I dont watch those |
14:51:24 | livcd | hmm there are still no videos from RubyKaigi |
14:54:42 | * | rnrwashere joined #nim |
14:58:23 | * | banc quit (Ping timeout: 246 seconds) |
15:05:42 | * | rnrwashere quit (Remote host closed the connection) |
15:13:56 | * | ober left #nim ("ERC (IRC client for Emacs 26.1)") |
15:32:57 | * | Trustable joined #nim |
15:40:25 | * | thomasross joined #nim |
15:55:23 | * | thomasross quit (Ping timeout: 258 seconds) |
16:03:04 | * | leorize quit (Quit: WeeChat 2.3) |
16:05:03 | * | floppydh joined #nim |
16:06:53 | FromDiscord_ | <turbosoggy> Is nim production ready? |
16:07:04 | * | Vladar quit (Remote host closed the connection) |
16:11:27 | Zevv | define production ready. It is for me, but it might not be for you |
16:13:45 | federico3 | https://lobste.rs/s/e0skes/nim_first_natively_compiled_language |
16:18:32 | FromGitter | <mratsim> It's used in atleast one hedge fund |
16:19:30 | * | Snircle joined #nim |
16:19:53 | FromDiscord_ | <turbosoggy> I mean are there any un documented features, compiler errors, errors with the gc, etc |
16:20:19 | FromGitter | <mratsim> compiler errors are not really a problem for production |
16:20:52 | FromGitter | <mratsim> GC, we don't have GC issues since a year or more, apart from sometimes when we want to avoid it. |
16:20:56 | shashlick | 0.19.x is a pretty good base |
16:20:59 | FromGitter | <mratsim> undocumented features, ye there are |
16:23:41 | livcd | hedge fund ? |
16:24:00 | FromGitter | <mratsim> yes, those funds with hundreds of millions of dollars |
16:24:51 | livcd | which one ? ^^ |
16:25:07 | livcd | ahh i think i know |
16:27:59 | livcd | I dont. Unicredit is not a hedge fund |
16:28:15 | * | krux02 quit (Ping timeout: 264 seconds) |
16:28:33 | FromGitter | <mratsim> Unicredit is a bank and I don't think andrea is using Nim in visible projects |
16:30:11 | disruptek | i'm busy atm, but can i get some feedback on #11088? i think i understand the issue pretty well, now, and it's more of a documentation-versus-code thing. the semantics are different from, say, Python, and that's fine if 1) we document them and 2) they work correctly with {.raises.} and 3) the compiler validates them correctly. |
16:30:20 | FromDiscord_ | <turbosoggy> Maybe i didnt say it right but by compiler errors i mean the compiler produces the wrong code |
16:30:36 | livcd | mratsim: yeah that's why I was confused. But there was a repo on github @ unicredit |
16:30:45 | livcd | https://www.blackrock.com <- this gave me a massive headache |
16:30:49 | FromGitter | <mratsim> @turbosoggy, no such cases |
16:30:55 | livcd | (was just checking out hedge funds) |
16:31:10 | livcd | mratsim: you cant disclose the hedge fund ? |
16:31:16 | FromGitter | <mratsim> there are errors that are caught by clang/gcc |
16:31:44 | FromGitter | <mratsim> @livcd, I don't know, but there is a core Nim contributor in a fund. |
16:32:04 | livcd | (furiously searching) |
16:32:06 | FromGitter | <mratsim> and at Status we're using it for blockchain as well |
16:33:17 | * | krux02 joined #nim |
16:34:41 | livcd | ok did not find who |
16:38:00 | * | curious joined #nim |
16:38:20 | * | curious quit (Client Quit) |
16:38:27 | * | krux02 quit (Ping timeout: 264 seconds) |
16:38:36 | * | krux02 joined #nim |
16:42:58 | * | Jesin quit (Quit: Leaving) |
16:47:51 | * | Jesin joined #nim |
16:51:10 | * | natrys joined #nim |
16:55:37 | * | rnrwashere joined #nim |
16:57:12 | * | harryrford joined #nim |
16:57:21 | harryrford | hey is anyone here? |
16:57:38 | livcd | yes |
16:58:35 | * | neceve quit (Remote host closed the connection) |
16:58:38 | harryrford | how are you going |
16:58:55 | harryrford | i have a few questions about nim, have you been in the space for a while? |
16:59:43 | * | jjido joined #nim |
17:00:03 | harryrford | is the nim community growing? |
17:00:20 | FromGitter | <kaushalmodi> harryrford: everybody here would be somehow in the Nim "space" :) |
17:00:27 | FromGitter | <kaushalmodi> and it's an awesome and growing community |
17:00:42 | harryrford | fantastic :) |
17:02:45 | * | Jesin quit (Quit: Leaving) |
17:03:37 | Zevv | I heard there are *dozens* of us :) |
17:05:00 | Zevv | naah that was some time ago. It is a pretty active and friendly community. IRC is often busy, and when nothing is happening there is usually someone idling who can answer your questions |
17:05:21 | * | Jesin joined #nim |
17:05:39 | Zevv | I think it is mainly european, so when europe is asleep things might be a bit more slow |
17:06:09 | FromGitter | <kaushalmodi> US east coast here |
17:07:57 | Zevv | and the core devs are usually around here as well, which is great. |
17:11:38 | harryrford | Thats great, the more I read the more fascinated by this languageI I become. I see serious potential for this language to be used in production in the future, I hope it happens. |
17:11:49 | harryrford | Thats great, the more I read the more fascinated by this language I become. I see serious potential for this language to be used in production in the future, I hope it happens. |
17:15:19 | Zevv | the future is here, for some of us. I have Nim code managing phone calls and presence info in a big dutch telco, running pretty deep in the core network |
17:15:35 | Zevv | people do cryptocurrency in Nim |
17:17:02 | harryrford | thats awesome. so people have build a blockchain implementation in nim? |
17:19:00 | FromGitter | <alehander42> Livcd yeah I guess rubykaigi upload would take more time |
17:19:07 | FromGitter | <alehander42> They had a lot of talks |
17:19:31 | FromGitter | <alehander42> Ooh the Victor talk got traction on hn nice |
17:19:48 | FromGitter | <alehander42> Pretty cool |
17:20:35 | Zevv | #17, lets bring it to the top! |
17:22:06 | * | rnrwashere quit (Remote host closed the connection) |
17:22:44 | * | rnrwashere joined #nim |
17:24:30 | livcd | alehander42: i was on holiday and hoped it would be online when I returned :( |
17:26:01 | * | harryrford quit (Quit: Page closed) |
17:27:34 | * | rnrwashere quit (Ping timeout: 276 seconds) |
17:29:18 | Zevv | Maybe Narimiran should throw in his case-style explanation from last week before anyone starts complaining :/ |
17:29:45 | narimiran | Zevv: last week? you mean yesterday? :D :D |
17:30:05 | Zevv | Oh I'm completely off, it's holidays here, I was convinced it was monday :) |
17:30:53 | disruptek | kayabaNerve: wanna share your {.async raises.} solution? |
17:33:04 | narimiran | when it comes to case (in)sensitivity, it feels like a quick sand. the more you explain that it is not a problem, the more people who haven't tried it complain that it is |
17:33:56 | FromGitter | <jrfondren> "it's less insensitive than Common Lisp" |
17:38:29 | FromGitter | <jrfondren> @Zevv, https://gist.github.com/jrfondren/a944af2448b8aa36a55e2341906f36c4 prints out the `str` string vertically. This works for UTF8. Is there a quick way I can take advantage of unicode.runeLenAt to match a Rune in an npeg pattern, without A) hardcoding runeLenAt's logic in the pattern, or B) giving up and rewriting npeg to work with runes from the get-go? |
17:38:57 | FromGitter | <jrfondren> I have random unicode garbage in this dataset, and unidecoding it makes it unparseable. |
17:39:33 | FromGitter | <jrfondren> but I know at least that the unicode will always appear in a certain sections of the data, so I could just match it potentially. |
17:40:27 | FromGitter | <jrfondren> what I'd like is a R atom that only matches non-ASCII runes. |
17:41:59 | Zevv | let me see |
17:44:26 | * | Trustable quit (Remote host closed the connection) |
17:48:07 | Zevv | does http://p.zevv.nl/?b517 help you? |
17:48:52 | dom96 | yay HN front page |
17:50:04 | * | rnrwashere joined #nim |
17:50:28 | FromGitter | <jrfondren> that's the hardcoding that I was wanting to avoid but... yeah I guess that's a lot easier than the alternative. |
17:50:57 | FromGitter | <jrfondren> thanks, I'll go with this for now |
17:51:05 | Zevv | I did some prototyping with various ways to handle unicode/utf8/runes, but they were all nasty - dependencies, performance, etc |
17:52:43 | * | rnrwashere quit (Client Quit) |
17:53:21 | FromGitter | <jrfondren> aye. and that'd be a shame since npeg's performance seems to be very good right now. |
17:55:18 | FromGitter | <jrfondren> in a benchmark pulling email senders out of a 400MB exim log, it does as well as Python: https://github.com/jrfondren/topsender-bench |
17:55:46 | * | rokups quit (Quit: Connection closed for inactivity) |
17:56:45 | narimiran | jrfondren `-d:release` already includes `--opt:speed` |
17:57:10 | * | stefanos82 joined #nim |
17:57:34 | FromGitter | <jrfondren> oh |
17:58:24 | Zevv | Ah cool, npeg in a benchmark |
17:58:45 | Zevv | let me do some profiling |
17:59:17 | Zevv | where do I find your exim_mainlog? |
17:59:49 | FromGitter | <jrfondren> well, it's a real log so it's got customer data in it :/ |
17:59:58 | Zevv | ah :) |
18:00:03 | Zevv | Damn, I only got postfix logs |
18:00:05 | narimiran | rot13 it, it will be ok :P |
18:00:35 | Zevv | yeah, that should do. I promise not to look :) |
18:01:02 | FromGitter | <jrfondren> I'll see about a dummy log in a few days. |
18:01:33 | narimiran | jrfondren what is the slowest part of the nim implementations? |
18:02:37 | Zevv | cool benchmark jrfondren. Also good to see NPeg does very good memory-wise |
18:03:19 | narimiran | i.e. how is CountTable behaving? |
18:03:21 | FromGitter | <jrfondren> there's probably a lot of unnecessary string copying from the lines() iterator. 0.19.4's CountTable has a very slow sort but that's already fixed in devel. |
18:03:23 | * | Jesin quit (Quit: Leaving) |
18:03:58 | narimiran | yeah, please use devel for benchmarks |
18:04:20 | shashlick | @narimiran any plans for a 0.19.6? |
18:04:27 | FromGitter | <jrfondren> D is actually the winner on the benchmark, but my pcre wrapper that worked fine on Linux just segfaults on macOS. It is a mystery. |
18:04:37 | narimiran | shashlick: there are plans for 0.20 instead ;) |
18:05:33 | shashlick | okay, will be really cool if we could do one more 0.19.x release even if 0.20 comes out |
18:05:41 | Zevv | jrfondren: NonAt <- Graph - '@' |
18:05:55 | narimiran | jrfondren: btw, how come you didn't use collections.counter in your python version? (https://docs.python.org/3.7/library/collections.html#collections.Counter) |
18:06:20 | FromGitter | <jrfondren> I don't know Python well at all |
18:06:50 | narimiran | shashlick: yes, i see the point in that. i'll talk to Araq about that idea |
18:07:38 | FromGitter | <jrfondren> @Zevv ah, thanks |
18:07:52 | Zevv | I'm pushing 0.10.0 as we speak for the Graph fix |
18:08:11 | shashlick | 0.19.x has already been maintained for 4 months (Sep - Jan) - having one more release will be a really good as a track record for stability |
18:09:06 | narimiran | shashlick: yes, 0.19 is "poor man's 1.0" :) |
18:09:34 | shashlick | if we can claim that every release is maintained for 9 months, will be a good statement |
18:11:53 | shashlick | that's already better than rust, looking at their release history |
18:13:26 | Zevv | Well, I found an exim main log from herbomethairestaurant. I guess they have the http docroot a bit to high up in the filesystem |
18:13:52 | federico3 | shashlick: or at least 6 months as long as the promise is kept |
18:14:17 | * | Jesin joined #nim |
18:14:24 | shashlick | if 0.19.6 comes out tomorrow, it is already 7 months from 0.19.0 |
18:14:36 | shashlick | maybe 9 months means 0.19.8 and that might be too much |
18:15:03 | shashlick | maybe a release 0.x.0 + 2/3/4 bugfix releases |
18:15:17 | * | nsf quit (Quit: WeeChat 2.4) |
18:19:35 | narimiran | make that 1.x.0 ;) |
18:22:07 | * | rnrwashere joined #nim |
18:25:49 | * | rnrwashere quit (Remote host closed the connection) |
18:44:35 | * | natrys quit (Quit: natrys) |
18:49:13 | * | rnrwashere joined #nim |
18:49:18 | * | rnrwashere quit (Remote host closed the connection) |
19:09:23 | * | jjido quit (Quit: Connection closed for inactivity) |
19:29:12 | * | floppydh quit (Quit: WeeChat 2.4) |
19:32:27 | * | rnrwashere joined #nim |
19:35:06 | FromGitter | <arnetheduck> er Araq so with the new `a/util`, `b/util` support, how do you explicitly pick a symbol from one of them? `a.util.symbol` would make sense.. |
19:35:33 | Araq | import a/util as au |
19:35:37 | Araq | au.symbol |
19:36:57 | * | rnrwashere quit (Ping timeout: 258 seconds) |
19:37:41 | FromGitter | <arnetheduck> ok :(.. and another question: what's the plan for all those system modules exporting symbols? `system/memory`, `system/ansi_c` .. are these now part of.. what.. the language standard lib? are they public symbols that are expected to be stable across nim versions? |
19:38:34 | * | rnrwashere joined #nim |
19:39:59 | FromGitter | <arnetheduck> I mean, there's `copyMem` which is a rename of `memcpy`, `zeroMem` which is `memset` but crippled, then there's `nimCopyMem` which.. uh.. implements `copyMem` with another public name? (I'm trying to figure out which name I should use to implement a builtin in nlvm.. llvm has optimized versions of these..) |
19:41:07 | Araq | the problem is that some C environments pretend that memcpy is provided by the "OS" and so lack it when you don't have an OS |
19:41:46 | Araq | which makes no fucking sense but that's why we also have our own non-libc nimCopyMem that "always" works |
19:42:17 | * | rnrwashere quit (Remote host closed the connection) |
19:42:19 | * | rnrwashe_ joined #nim |
19:42:42 | Araq | and zeroMem is not a "crippled" memset, it's a fixed memset because you cannot get the argument order wrong |
19:44:05 | FromGitter | <arnetheduck> well, in nim, it's crippled because you can only fill with `0` - where in reality it could take a `byte` and not have the argument order issue, at least not the same way |
19:44:38 | Araq | anyhow, system/memory and friends are an implementation detail. for now |
19:44:53 | Araq | we need a --leanSystem switch to complete the cleanup |
19:45:11 | Araq | or something better. I'm listening for ideas. |
19:45:15 | FromGitter | <arnetheduck> but what I'd like to understand is whether there's any pattern to follow here.. ie some of these pseudo-builtins from c are magics, some of them are ansi_c, some of them are `lib/core`, etc etc.. |
19:45:58 | * | rnrwashe_ quit (Remote host closed the connection) |
19:46:41 | Araq | oh the pattern is maybe a bit complex but mostly sound. A proc is 'magic' if we need it to be builtin for the C/JS/VM target combination |
19:46:42 | FromGitter | <arnetheduck> I'd go with anything, as long as the rest of the lib is cleaned up at the same time.. there are now like 5-6 started refactorings and cleanups that each introduces its own style.. that's the hard part, for me at least, when doing nlvm |
19:47:11 | Araq | some 'magic' procs also need their own special sem'check |
19:47:35 | Araq | few are 'magic' simply because of legacy |
19:47:42 | FromGitter | <arnetheduck> so `system/ansi_c` for example being an implementation detail will soon turn into a backwards compat thing because of the public symbols it exports.. |
19:48:05 | Araq | huh? sytem imports it but doesn't export it |
19:48:20 | FromGitter | <arnetheduck> but `import system/ansi_c` is valid from user code so.. |
19:48:28 | Araq | and pre 0.20 you cannot import system/ansi_c |
19:48:37 | Araq | well maybe you can, I haven't tried |
19:48:43 | Araq | but it wasn't documented |
19:49:03 | FromGitter | <arnetheduck> no, it didn't export the names, so it would have been a noop |
19:49:14 | Araq | ah, right. |
19:50:12 | * | rnrwashere joined #nim |
19:50:51 | * | banc joined #nim |
19:50:53 | FromGitter | <arnetheduck> an inelegant solution is what c does, which reserves all symbols starting with `__` and `_X` for the "system", whatever that is, so that the namespace is not polluted |
19:51:06 | FromGitter | <arnetheduck> er, so the namespace is polluted in a predictable way |
19:51:44 | FromGitter | <arnetheduck> what's bothersome for larger projects is that you can break module a by adding a symbol to module b very easily.. it's worse when the std lib does it because of how it's imported everwhere |
19:53:48 | Araq | yeah but that's a different topic and also has a solution but I'm not sure we'll do anything about it for v1 |
19:54:17 | * | rnrwashere quit (Remote host closed the connection) |
19:55:07 | Araq | anyway. the idea was that you import core/module but never system/module and that's now reversed |
19:55:59 | FromGitter | <arnetheduck> here's a little feather in the hat for you, btw: https://twitter.com/jcksie/status/1120693600759754753 |
19:56:23 | FromGitter | <arnetheduck> that's where the whole nim_program_result stuff comes from :) |
19:57:27 | Araq | er thanks but it's your feather, I think. |
19:58:47 | FromGitter | <arnetheduck> well, it's the aggressively-dead-code-eliminating design of the language at work.. there's still a number of writeable, non-optional globals being output in "normal" mode, but for `os:standalone` that's the last of them, unless you start using exceptions |
20:00:12 | Araq | back to the problem: assuming that use --leanSystem (which doesn't exist) you shouldn't import system/assertions |
20:00:44 | Araq | but instead std/assertions. I think. |
20:01:43 | Araq | and so system should import std/assertions. which shouldn't be imported unless you use --leanSystem. confusing. |
20:02:39 | FromGitter | <arnetheduck> confusing. |
20:04:37 | Araq | or we have an import std/assertions that always works |
20:05:19 | * | gangstacat quit (Quit: Ĝis!) |
20:07:48 | FromGitter | <arnetheduck> I actually have a local repo with a mosly-empty system.nim that I'm playing around with to test (nothing concrete yet).. it would be used for embedded systems, and the first test it would apply to symbols (for inclusion) would be that they have no runtime cost if not used (so no exceptions, no globals, etc). anything that has (hidden) cost you'd have to explicitly import. . another test would be that you should be |
20:07:48 | FromGitter | ... able to have two versions of most things, so if I come up with a better assertion scheme, I should be able to import assertions2 etc.. this is important for versioning reasons, so that I can make changes without breaking old code (a bit like C++ has inline namespace which change the ABI symbol but work like nim and ... [https://gitter.im/nim-lang/Nim?at=5cc0c214a4ef097471f2bdfd] |
20:08:24 | FromGitter | <arnetheduck> well, I you won't be able to escape this issue without the user being explicit somewhere.. |
20:09:13 | * | rnrwashere joined #nim |
20:09:14 | FromGitter | <arnetheduck> I don't believe in API/ABI-altering compile-time-flags in general, it doesn't scale.. the --leanSystem code wouldn't work with non-lean-system code and that would be a problem |
20:11:03 | FromGitter | <arnetheduck> we just had that discussion about -d:release for nimbus, and how it turns off checks.. but out-of-bounds etc when checks are on are part of a well-defined semantic of the language/library and alter the expected control flow - a try/except will swallow them for example. this means that instead of one semantic to test and search for security issues and weird flows, you end up with many... not good for reliability. |
20:12:53 | Araq | hmm? don't use -d:release, instead use --stackTrace:off --opt:speed/size |
20:13:29 | Araq | and then turn off more checks via .push for relevant procs that the profiler marked |
20:14:52 | * | [rg] joined #nim |
20:14:55 | Araq | but Nim and to a large extend C++/Rust/<"system programming language"> have an inherent debug/release split that kinda sucks. the .NET/JVM platforms are much better at "one mode of operation for everything and everybody" |
20:15:08 | * | rnrwashere quit (Remote host closed the connection) |
20:15:24 | * | go|dfish joined #nim |
20:15:33 | Araq | afaict a JIT helps to accomplish this. |
20:15:35 | * | rnrwashere joined #nim |
20:16:10 | FromGitter | <arnetheduck> well, yeah, we can, but then we're fighting the language. what I'm saying is that `leanSystem` falls in the same category - we'll end up with some libraries expecting it and some not, and then you can't combine them -> doesn't scale.. we used bitops as another example |
20:16:42 | Araq | you're definitely not "fighting" the language by not using -d:release |
20:16:43 | * | gangstacat joined #nim |
20:17:12 | Araq | code that only "works" with --checks:off is broken code |
20:19:37 | * | rnrwashere quit (Ping timeout: 245 seconds) |
20:20:22 | FromGitter | <arnetheduck> it might be broken but only by convention, and where the less onerous thing is to write broken code - because the mechanism for delivering the breakage is the same as non-broken code (exceptions), stuff like a naked `except:` will hide the broken code and you have to make an extra effort (limit the scope of `except`) to find the breakage.. that makes it hard to trust other peoples code for example, reusing "public" |
20:20:22 | FromGitter | ... libraries |
20:21:58 | FromGitter | <arnetheduck> it's a bit like in C - some code might be broken by optimization because it uses some UB that the compiler exploits. these kinds of bugs are extremely hard to track down later, when you have a larger project |
20:22:58 | FromGitter | <arnetheduck> how does a jit help with the "one mode" thing? |
20:23:20 | * | narimiran quit (Ping timeout: 258 seconds) |
20:24:05 | Araq | it helps because it's always turned on and can optimize your array bound checks etc based on the runtime profile |
20:24:53 | shadowbane | They can only optimize it to the point of tagging the branch as unlikely though, a JIT can't (usually) determine that bounds checks aren't needed at all. |
20:25:02 | shadowbane | Java just always runs bounds checks. |
20:25:14 | Araq | nah. |
20:25:49 | Araq | it can hoist it out of loops, ok, a static compiler can do the same. |
20:27:17 | FromGitter | <arnetheduck> rust runs bounds checks always and relies on static elision and safe constructs to avoid them (ie iterator instead of access-by-array-index) |
20:27:22 | FromGitter | <arnetheduck> I suspect swift does the same |
20:29:01 | Araq | sure, but a JIT can better optimize/specialize code for the happy path |
20:29:07 | FromGitter | <arnetheduck> I'm considering to do the same in nlvm actually, to not allow disabling the checks.. but it's difficult, for said semantic reasons (doing so, I'd be breaking some previously working code that for example does `push boundscheck:on; try: a[i] except outofbounds: bla` |
20:30:24 | FromGitter | <arnetheduck> in the case of these checks that are (socially?) expected to not trigger, one would always optimize for the happy case, in a static compiler |
20:31:04 | FromGitter | <arnetheduck> basically, in the C case, you'd sprinkle with `unlikely` and in nlvm, I'll be doing the same (if I ever have time for it) |
20:31:23 | FromGitter | <arnetheduck> but in nlvm I have more powerful toys available to me, bringing down the cost |
20:31:28 | Araq | luaJIT did beat Fortran on one benchmark fwiw. But anyway, if the lib relies on exceptions to turn out-of-bounds into valid code, it's wrong code. The spec explicitly tells it's invalid. |
20:32:17 | FromGitter | <arnetheduck> the compiler doesn't. I tend to follow the compiler, not the documentation, when thinking about practical application of the theory :) |
20:32:57 | Araq | well I can change the compiler :P |
20:33:04 | FromGitter | <arnetheduck> and jvm sometimes beats c++ because it can devirtualize more aggressively and specialize functions for specific instances |
20:33:43 | Araq | exactly. but the thing is, this is all theoretical. You dream up of problems in unknown libraries that you end up using in your mission critical software |
20:34:22 | FromGitter | <arnetheduck> well, it's not theoretical in our case. we had bugs swallowed by it and engineers scratching their heads :) |
20:34:37 | Araq | what? |
20:34:38 | * | rnrwashere joined #nim |
20:34:48 | FromGitter | <arnetheduck> aggressively swallowed exceptions |
20:35:14 | Araq | bah |
20:35:17 | FromGitter | <arnetheduck> and `-d:flag`-dependent library conflicts |
20:35:36 | * | slugm quit (Remote host closed the connection) |
20:36:07 | Araq | I hate this. |
20:36:28 | Araq | Now I'm out of arguments and need to change the compiler. |
20:36:30 | FromGitter | <arnetheduck> panicing on those occasions btw would lead to more efficient code because you could prove it statically to be exception-free and elide the exception bloat :) |
20:36:43 | Araq | I know. |
20:37:11 | Araq | I still like my "quirky exceptions" best fwiw. |
20:37:26 | FromGitter | <arnetheduck> I like it for its boldness :) |
20:39:40 | Araq | I thought about injecting 'if error: return' for procs with the IO .tag |
20:40:08 | Araq | then the check is paid for at proc entry but not after every proc call |
20:42:34 | * | rnrwashere quit (Ping timeout: 276 seconds) |
20:42:58 | Araq | a related problem is that people use -fno-exceptions and say "yay, smaller and faster code" but that's because they turned the exceptions into a panic, not into an if-cascade. But at the same time panic is often all you need when you write an application so this -fno-exceptions switch is very useful... |
20:43:46 | Araq | so under this new "fixed C++ exception handling" proposal you would lose a useful switch and turn everything into a shitty if-cascade instead. |
20:44:37 | FromGitter | <arnetheduck> its `-fno-exceptions` I'm after actually, in a sense.. contradicting my own arguments above about one-way-only, yay! |
20:45:33 | FromGitter | <arnetheduck> but it's a bit less bad, because code that's written to be exception-free works with exceptions also |
20:47:21 | Araq | not sure what you mean. IMO the code is broken anyway and there is no language that lacks the nasty stack unwinding feature, even C has setjmp and signal handlers |
20:47:59 | Araq | Go has defer and panic and Rust also offer(ed) stack unwinding |
20:48:17 | * | xet7 quit (Quit: Leaving) |
20:50:34 | Araq | btw with -d:nimQuirky I turn index-out-of-bounds into fatal errors |
20:51:09 | FromGitter | <arnetheduck> so why not do it for normal nim too? afair the manual allows it so you can always point to it and say told you so :) |
20:52:06 | Araq | yeah, consider it done for v0.20 (I hope?). It might be some work to adapt the tests. |
20:52:44 | FromGitter | <arnetheduck> ooh nice. |
20:53:26 | Araq | also, I plan to do -d:safety vs -d:performance and make -d:release a legacy |
20:54:01 | Araq | too many people don't understand -d:release |
20:54:41 | FromGitter | <arnetheduck> well, with those names, -d:performance will become the -d:release.. why would you *not* want performance? |
20:55:14 | Araq | hmm good point |
20:56:47 | FromGitter | <arnetheduck> have you measured recently btw the cost of `--checks:on`? afair, the biggest perf-killer in nim is `--linetrace` - that's like 2-3x slowdown on `--opt:speed` |
20:57:14 | Araq | I haven't but that's what I hoped for ;-) |
20:57:34 | Araq | the integer overflow checking is hard for the C backend |
20:57:45 | FromGitter | <arnetheduck> I can imagine that if you turn those checks to panics it shouldn't be too bad |
20:58:55 | FromGitter | <arnetheduck> well, it's made slightly harder I think by all the `NI` casts - I think they confuse the c compiler - it's one of the differences I've seen in the generated llvm code when comparing.. |
20:59:42 | Araq | never seen these turn into something in the produced assembler code |
20:59:49 | FromGitter | <arnetheduck> specially bools - when values are guaranteed to be 0/1 the optimizer can reason about them better |
21:00:17 | FromGitter | <arnetheduck> they don't turn into something, the lead to missed-optimizations mainly |
21:00:46 | Araq | strange but ok |
21:00:58 | disruptek | i like quirky. what's the "fixed C++ exception handling" proposal? |
21:01:41 | Araq | Herb Sutter's superior new way of doing exceptions by if checks on a misused CPU flag |
21:01:43 | FromGitter | <arnetheduck> like when a bool is a char (like in c), it has 256 possible values for the optimizer, and it has a harder time proving things. |
21:01:54 | disruptek | oh right. |
21:02:03 | Araq | we map bool to C++'s bool. |
21:03:08 | disruptek | can we talk about the #11088 issue? i just want to know if it is intentional. |
21:03:08 | FromGitter | <arnetheduck> when you extend that same logic to `NI` it gets even worse.. sometimes it's fine, but sometimes I've seen some pretty big differences - it's one of the reasons why I can get better perf in nlvm over c, because I can be a bit more specific |
21:04:06 | FromGitter | <arnetheduck> well c++'s bool is a #define in c, just like enum is an int |
21:04:09 | disruptek | i am going to be using nlvm, btw -- thanks for that. i am building a pipeline with klee and running everything in graal, so i'm all about the IR. :-) |
21:04:54 | FromGitter | <arnetheduck> still hoping that someone will do the right thing and add windows and osx support :) |
21:05:51 | disruptek | too many people use -d:release, period. |
21:05:58 | * | banc quit (Ping timeout: 276 seconds) |
21:06:39 | FromGitter | <arnetheduck> if you're all about the IR you'll also be sad to know that nlvm generates setjmp for exceptions instead of doing it properly *hint, hint* |
21:06:55 | Araq | ouch |
21:07:11 | disruptek | well, i still don't understand exceptions in nim, so i'm not too worried about it yet. :-D |
21:07:27 | disruptek | i mean, i get it, i just am not convinced it's as intended. |
21:07:32 | Araq | disruptek: I don't understand the issue |
21:07:44 | * | banc joined #nim |
21:08:59 | FromGitter | <arnetheduck> yeah I know.. sad and embarrassing. but now it should be plausible to fix, because it no longer has to go by similarity-to-c-backend with the test suite mostly passing. the new skipTests flag will help with that. |
21:09:02 | disruptek | there doesn't seem to be a way to dominate an exception type in the except: clause and still make use of the `as error:` binding as the original type -- it gets shadowed as the dominating type. |
21:10:26 | disruptek | then if you re-raise it, you're raising a dominating type which means it poisons your {.raises.} to be, perhaps, broader than you intended. which could be fine, if that's the semantic we want. i just don't know. |
21:10:36 | disruptek | it's not, fwiw, the way it works in python. |
21:11:05 | Araq | see this is where it becomes super-confusing |
21:11:27 | Araq | do you talk about the .raises effects or about the order of 'except' clauses? |
21:11:38 | disruptek | when i say that if you re-raise it, you're raising a dominating type, you're not /actually/. the type doesn't change. but the {.raises.} has to, because nim is split-brained about the type of the exception. |
21:12:52 | disruptek | i'm talking about both. i think nim should tell me when i'm dominating a later clause in the stmt list, for one thing. and if it won't do that because it's not the job of nim, then i feel like we should document that {.raises.} is code in that it only works if you correctly order in contents. ie. you need to know the exception inheritance tree and encode it into every proc. |
21:13:11 | disruptek | there are good reasons to do that. but nim is missing one leg of the stool right now, imho. |
21:13:51 | * | revere quit (Ping timeout: 264 seconds) |
21:14:12 | Araq | I'm afraid I'll reply tomorrow properly. |
21:14:32 | disruptek | it's fine, i just wanted to know if there was there there or if i was just missing something. ;-) |
21:14:50 | Araq | But a .raise list like [Exception, ValueError] conveys the idea that the compiler assumes the worst and it can raise any Exception |
21:15:02 | Araq | but it also computed that it definitely can raise ValueError :P |
21:15:17 | disruptek | that's an impossible raise list, currently. Exception dominates ValueError. you'll get a warning if it compiles. |
21:15:48 | * | revere joined #nim |
21:15:56 | Araq | maybe if you wrote this list explicitly |
21:16:05 | Araq | if it's computed, it's a valid outcome |
21:16:27 | disruptek | it may be valid, but if so, i wish it would compile and/or not create spurious warning messages. |
21:18:04 | Araq | but why? if you wrote it down explicitly, you were confused |
21:18:14 | Araq | as Exception dominates ValueError |
21:18:38 | Araq | the compiler is allowed to communicate its confusion but the programmer should know better |
21:20:24 | disruptek | that's fine, if every time i write a {.raises.} i need to express a hierarchy of exceptions that will not change... it just means that if i move an exception type around in the hierarchy, i may have to modify raises everywhere. that's fine. but it's not really clear from the documentation, and the error messages aren't helpful. plus, the poison issue... |
21:20:47 | disruptek | the compiler should not be confused about exception inheritance, should it? |
21:22:49 | Araq | no it shouldn't. but is it? |
21:24:00 | disruptek | let me put it this way... if i use an except Exception: to catch a ValueError and then re-raise it, does the compiler really think that the method can raise Exception? because that's the way {.raises.} works right now, and it means that it's hard to both use dominating clauses and have functions not raise broader and broader exceptions, even when they provably do not. |
21:24:35 | Araq | ah I see. |
21:24:38 | disruptek | and i still cannot do anything ValueError specific in that Exception clause, which makes it pretty weak in terms of utility. |
21:26:22 | disruptek | i still want to emphasize that it's not that the semantic is necessarily wrong, it's just different and not clearly communicated. it's also not clear if it's working as intended. |
21:26:39 | Araq | well I need to investigate. there is no logic in the compiler that says "oh, it says except E so I'm gonna add 'E' to the .raises list" |
21:27:21 | disruptek | i think maybe re-raise is getting wrapped and unwrapped or something. i dunno. i haven't looked at the compiler, i've only tested it with code. |
21:28:04 | disruptek | or, perhaps more likely, raise creates an effect that propogates upwards, so when it's called with an Exception type, that's what bubbles up. |
21:28:36 | Araq | well yes, that's what 'raise' does |
21:29:36 | disruptek | so, in an Exception as foo: clause, raise foo will raise Exception. even if the original type is ValueError. and we can catch that `raise foo` as a ValueError upwards in the stack. |
21:29:49 | Araq | I still consider the .raises effect system business a largely failed experiment btw |
21:30:32 | disruptek | i think it could work really well, we're just missing the piece that the compiler can provide to ensure we don't create logic bugs when changing exceptions. it's almost complete, to my eye. |
21:32:36 | Araq | even assuming it works 100% perfectly, it's mostly sophistry. |
21:32:59 | disruptek | why is that? |
21:33:54 | Araq | in practice I only care about can-raise vs cant-raise and can-raise should be reserved to IO which are pervasive failures that have some hope of being re-tryable |
21:34:07 | * | iLiquid quit (Quit: iLiquid) |
21:34:48 | disruptek | exactly. this is a very real scenario. |
21:35:19 | Araq | and then I don't need static checking for it, frankly. |
21:35:40 | disruptek | i have some api code that makes async requests. failures can occur at the network level, due to an api failure, or due to response parsing failures. |
21:35:42 | Araq | I know which procs do IO |
21:36:07 | disruptek | the reason to have static checking is that the compiler is smarter than we are. :-) |
21:36:13 | Araq | the compiler can help with that but it's not required and the compiler could instead check for more important things |
21:36:52 | disruptek | well, it doesn't currently check for except: clauses that will never get executed because they are dominated in the same expression. |
21:37:09 | disruptek | so bikeshedding {.raises.} seems a little misplaced. :-P |
21:37:32 | Araq | as I said, let's assume a "perfect" implementation. |
21:37:52 | disruptek | okay. do you pretty dominating clauses to work like python? or nim? |
21:37:56 | disruptek | ^prefer |
21:38:09 | Araq | then I would still reject it based on my experiences. |
21:38:30 | Araq | except Exception: echo "A" |
21:39:00 | Araq | except ValueError: echo "B" # invalid code, the checks are performed one after the other |
21:39:27 | disruptek | that's a good improvement for nim, yes. |
21:39:46 | Araq | that's how it's done in Nim and also how it's done in Python |
21:39:48 | Araq | afaik |
21:39:56 | disruptek | we don't error on that code. |
21:40:05 | disruptek | afaik |
21:40:23 | Araq | and Python does? |
21:40:59 | disruptek | i dunno, but the python vs. nim comparison isn't about detecting dominance. |
21:41:31 | disruptek | it's about the fact that in python, if you except Exception as foo: then `foo` has whatever type it was when thrown, not Exception. not so in nim. |
21:42:18 | disruptek | in nim, whatever you catch gets painted with the dominating exception type brush. and that paints right into {.raises.} (which we aren't talking about) |
21:43:08 | disruptek | maybe nim's way is better. so far, i am not loving it, but i can be taught! |
21:43:16 | Araq | er ... |
21:43:35 | Araq | except Exception as foo: # surely foo has the type Exception, what else? |
21:46:34 | disruptek | sometimes we want to operate on several exceptions -- a type of exception that share the same parent, eg. IOErrors -- identically, in the same block. nim currently requires me to write code that operates on IOErrors in those blocks. this part is fine, and as it should be. but IOErrors may be defined with sub-types and thrown, and the exception i get to work with is only the IOError, not the subtype |
21:46:40 | disruptek | caught by the broader, dominating except IOError: |
21:47:20 | disruptek | except Exception as foo: is type Exception in nim, but might be ValueError in python. |
21:49:46 | disruptek | here's an example of how python does it: https://gist.github.com/disruptek/3b173a17989c0c6047908cd72832264e |
21:51:35 | disruptek | does that help? |
21:54:06 | disruptek | gotta split, bbiab. |
22:02:08 | Araq | Python has no static typing |
22:02:50 | FromGitter | <deech> Are there any plans for separate namespaces for compile/run time? It would be nice if I could do something like: ⏎ ⏎ ```proc f(): auto {.compileTime.} = discard ⏎ proc f(): int = 100``` ⏎ ⏎ Although that would make invoking more complicated. [https://gitter.im/nim-lang/Nim?at=5cc0dd0a990feb4518f899e6] |
22:02:58 | clyybber | krux02 are you there? |
22:03:23 | * | solitudesf- quit (Ping timeout: 245 seconds) |
22:04:13 | FromGitter | <dom96> Araq: is that really how Nim works? |
22:04:35 | FromDiscord_ | <!!Liam is Unlucky> 'trying to get glfw to work with this https://github.com/ephja/nim-glfw |
22:04:35 | FromDiscord_ | <!!Liam is Unlucky> I get, the output, could not load: glfw3.dll |
22:04:35 | FromDiscord_ | <!!Liam is Unlucky> anyone know |
22:04:54 | FromGitter | <dom96> You need that DLL beside your exe |
22:05:10 | FromDiscord_ | <!!Liam is Unlucky> oh ok |
22:14:09 | Araq | dom96: I don't know what "really how" means and I'm sleeping |
22:14:58 | FromDiscord_ | <!!Liam is Unlucky> hmmm, I put it in the same directory as my exe, but still get the same output |
22:15:39 | * | lritter quit (Ping timeout: 258 seconds) |
22:21:25 | FromGitter | <matrixbot> `noonereally` is nim more portable than golang? |
22:21:35 | FromGitter | <matrixbot> `noonereally` being c api? |
22:33:35 | FromDiscord_ | <exelotl> yes |
22:35:18 | federico3 | I have to say --hints:off makes compilation nicer |
22:44:23 | krux02 | clyybber, sorry not today anymore, I was offline. I will be online in 7 hours again |
22:44:29 | * | krux02 quit (Remote host closed the connection) |
22:46:26 | * | vlad1777d__ joined #nim |
22:47:20 | clyybber | krux02: Ok, good night |
22:47:34 | * | clyybber quit (Quit: WeeChat 2.4) |
23:00:11 | * | WilhelmVonWeiner quit (Quit: leaving) |
23:01:00 | * | WilhelmVonWeiner joined #nim |
23:01:19 | * | stefanos82 quit (Remote host closed the connection) |
23:09:48 | * | [rg] quit (Quit: Leaving) |
23:15:50 | * | Jesin quit (Quit: Leaving) |
23:24:38 | FromGitter | <kayabaNerve> disruptek: You still there? |
23:25:52 | * | Jesin joined #nim |
23:26:22 | FromGitter | <kayabaNerve> My async raises code is part of a more expansive macro which stops exception bubble up. It creates function copes and strips out the async code for sync code. |
23:28:36 | FromGitter | <kayabaNerve> Alone as an async raises macro, it'd only work if your async function never calls any async procs itself, or you wrap every async call in a try: except: block. |
23:29:06 | FromGitter | <kayabaNerve> If you're still interested, https://github.com/MerosCrypto/ForceCheck |
23:32:13 | * | gangstacat quit (Ping timeout: 276 seconds) |
23:35:30 | disruptek | kayabaNerve: thanks, i'm sure we have run into the same problems, so i appreciate a shared solution as well. ;-) |
23:36:56 | disruptek | i don't see what static typing has to do with it. |
23:38:34 | FromGitter | <kayabaNerve> I don't see why you' |
23:38:41 | FromGitter | <kayabaNerve> *you're bringing up static typing. |
23:38:49 | FromGitter | <kayabaNerve> I'm guessing if my lib mentions that, it's a typo :P |
23:39:32 | disruptek | no, it was something Araq had mentioned in reply to the earlier convo re: exceptions. |
23:40:20 | FromGitter | <kayabaNerve> Oh, sorry. |
23:44:07 | disruptek | so if i'm reading this readme right, you basically munge the async functions so you can properly do exception bubble up for the purposes of compilation only? just to detect/generate a sync function with a proper raises? |
23:45:46 | FromGitter | <kayabaNerve> This macro is meant to stop exception bubble up and force explicit error handling at every level. |
23:46:04 | FromGitter | <kayabaNerve> It's an overkill solution to a lack of error handling in my project that's served quite well. |
23:46:17 | FromGitter | <kayabaNerve> A benefit is that we get a proper raises on async procs. |
23:46:31 | disruptek | doesn't sound like overkill to me; you already have to do this to deal with async properly. that's the problem. ;-) |
23:47:03 | FromGitter | <kayabaNerve> We create two duplicates which Nim removes as dead code. The first has all of its awaits replaced with waitFor, async removed, and every raise replaced with discard. |
23:47:39 | FromGitter | <kayabaNerve> That stops the bubble up. The second has the same async mods, but the raises are untouched. That has the raises added. |
23:47:45 | FromGitter | <kayabaNerve> Your original function has no raises added. |
23:48:12 | FromGitter | <kayabaNerve> ```proc () {.async.} = ⏎ echo "Hi"``` [https://gitter.im/nim-lang/Nim?at=5cc0f5bce416b84519d5c839] |
23:48:46 | FromGitter | <kayabaNerve> That should compile with a blank raises. Async will force that to have Exception added to the raises. It will compile with a blank forceCheck. |
23:49:30 | disruptek | right, so you use the sync version to detect the raises and then add them to the original function? |
23:50:08 | FromGitter | <kayabaNerve> The original function never gets any raises as it will never compile with any meaningful raises. |
23:50:48 | FromGitter | <kayabaNerve> The sync version with untouched raise statements gets the raises pragma. |
23:50:48 | disruptek | i mean, the second one that "has the raises added". |
23:51:02 | disruptek | right. |
23:52:10 | FromGitter | <kayabaNerve> As long as you wrap your async calls to stop bubble up, the larger purpose of the macro, it enables adding a meaningful raises pragma to async functions. |
23:52:51 | disruptek | yeah, it's useful, thanks. right now my async stuff is just a forest of try/except: and it's making me grumpy. |
23:53:33 | FromGitter | <kayabaNerve> I'm happy if it helps |