00:00:06 | zacharycarter | fails with invalid indentation |
00:00:39 | * | FromGitter quit (Read error: Connection reset by peer) |
00:00:48 | * | FromGitter joined #nim |
00:00:53 | zacharycarter | Alright - need some help with some type design |
00:01:07 | * | zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/rqyOGjTBakxxlRhERpIoBlpG > |
00:01:11 | zacharycarter | I want to do something like this - |
00:01:28 | * | zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/PUfawjbnDSwVxwIoLqZhVuQY > |
00:01:41 | * | zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/txARTXJDzQJBiMddYqNJILyr > |
00:02:00 | zacharycarter | but I don't know how to mix types for the value / 2nd generic param |
00:03:33 | FromGitter | <rayman22201> @zacharycarter this does not compile though: β β ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4e83c4ecc1f82e2fc08f01] |
00:03:55 | * | avsej joined #nim |
00:03:55 | * | avsej quit (Changing host) |
00:03:55 | * | avsej joined #nim |
00:04:39 | * | zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/yYHBehKGwteftBJpSDRSvsYb > |
00:04:41 | zacharycarter | will though |
00:05:55 | FromGitter | <rayman22201> interesting. You are correct |
00:06:28 | FromGitter | <rayman22201> That fixed that issue. Thanks! The compiler could probably use a better error message there. |
00:06:59 | zacharycarter | yeah - may want to file an issue |
00:07:09 | FromGitter | <rayman22201> I now get the error: ```lib/pure/pegs.nim(91, 11) Error: attempt to redefine: 'sons'``` |
00:07:12 | zacharycarter | I don't think Nim supports declarations like that |
00:07:41 | zacharycarter | ah yeah you can't redefinine a type attribute with the same name in multiple case clauses in the same varidic type |
00:07:42 | zacharycarter | so |
00:08:16 | * | zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/iASgCuNRXcPSrFrYYeAesObG > |
00:08:18 | zacharycarter | sorry |
00:08:27 | * | FromGitter quit (Read error: Connection reset by peer) |
00:09:01 | * | NimBot joined #nim |
00:09:05 | zacharycarter | basically if you have the type attribute bar defined under 0 |
00:09:08 | zacharycarter | you can't re-define it again under `1 |
00:09:21 | zacharycarter | it has to have a different identifier |
00:10:54 | FromGitter | <rayman22201> is that behavior considered a bug / open issue, or is it just an accepted design limitation? |
00:11:24 | * | zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/NOrKcHudcjbwyGRNcufMzpJg > |
00:11:44 | * | zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/MDBHuOvGxMwhkGNTLEvVBdUg > |
00:12:02 | zacharycarter | this is as designed - it'd be very difficult to overcome this limitation |
00:12:19 | * | FromGitter quit (Read error: Connection reset by peer) |
00:12:33 | zacharycarter | the compiler would have to get very smart |
00:12:48 | zacharycarter | and it's already very smart |
00:12:58 | * | FromGitter joined #nim |
00:13:53 | * | avsej quit (Ping timeout: 248 seconds) |
00:14:20 | FromGitter | <rayman22201> lol. ok? and? |
00:17:10 | zacharycarter | that's the answer |
00:17:35 | zacharycarter | it's not going to be doable - not in the forseeable future of the language |
00:17:45 | FromGitter | <rayman22201> My question is why? |
00:17:52 | zacharycarter | I explained why |
00:18:20 | zacharycarter | it's extremely difficult to do in the compiler |
00:18:31 | zacharycarter | I didn't write the compiler |
00:18:32 | * | FromGitter quit (Read error: Connection reset by peer) |
00:18:41 | zacharycarter | bug Andreas if you want a real answer |
00:20:02 | * | FromGitter joined #nim |
00:20:25 | * | avsej joined #nim |
00:20:25 | * | avsej quit (Changing host) |
00:20:25 | * | avsej joined #nim |
00:27:16 | * | erblite joined #nim |
00:30:21 | * | xylef joined #nim |
00:37:23 | FromGitter | <rayman22201> Nothing? Is there documentation on this limitation anywhere? Github wiki, Github issue, the forum? I'm not trying to be an ass, I just want to understand this limitation better. |
00:38:20 | FromGitter | <rayman22201> It seems like the kind of thing that should be in the docs at least. |
00:40:10 | zacharycarter | I'm pretty sure it is |
00:40:24 | zacharycarter | https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants |
00:40:38 | zacharycarter | you can always dig into the compiler to understand why it'd be difficult |
00:41:30 | FromGitter | <rayman22201> where does that document describe that limitation? |
00:43:05 | FromGitter | <rayman22201> neither is it described here: https://nim-lang.org/docs/manual.html#types-object-variants |
00:43:11 | zacharycarter | I'm not sure that it does - I was just linking to where I knew the doc was |
00:43:31 | * | FromGitter quit (Remote host closed the connection) |
00:43:34 | zacharycarter | well - I guess the argument from the language creator would probably be that it doesn't assert that it allows for that either |
00:43:39 | * | FromGitter joined #nim |
00:44:05 | zacharycarter | and since Nim is built on top of C, it's on the user when they assert that the language does exhibit such a feature |
00:44:16 | zacharycarter | but I don't disagree that a PR couldn't hurt |
00:45:03 | zacharycarter | but I A) Don't know where the best place to put the comment would be or B) how it would be best phrased |
00:45:27 | zacharycarter | maybe an issue would be the best place to start - not sure if there is one already existing or not |
00:45:28 | * | FromGitter quit (Read error: Connection reset by peer) |
00:46:07 | * | FromGitter joined #nim |
00:46:23 | zacharycarter | going to skate to the convenience store real quick, be back in a few |
00:46:37 | FromGitter | <rayman22201> π |
00:47:07 | * | subsetpark quit (Quit: --) |
00:50:29 | CodeVance | rayman there's the docs for the compiler internal |
00:50:49 | * | FromGitter quit (Remote host closed the connection) |
00:50:58 | * | FromGitter joined #nim |
00:51:21 | CodeVance | https://nim-lang.org/docs/intern.html#the-compiler-s-architecture-short-description-of-nim-s-modules |
00:56:14 | * | avsej quit (Ping timeout: 256 seconds) |
01:01:18 | * | subsetpark joined #nim |
01:03:55 | * | avsej joined #nim |
01:03:55 | * | avsej quit (Changing host) |
01:03:55 | * | avsej joined #nim |
01:07:25 | * | cspar_ joined #nim |
01:08:35 | * | avsej quit (Ping timeout: 240 seconds) |
01:17:58 | * | Jesin joined #nim |
01:21:26 | * | avsej joined #nim |
01:21:26 | * | avsej quit (Changing host) |
01:21:26 | * | avsej joined #nim |
01:31:29 | * | avsej quit (Ping timeout: 256 seconds) |
01:32:36 | * | slmjkdbtl joined #nim |
01:32:37 | * | slmjkdbtl left #nim (#nim) |
01:38:01 | * | avsej joined #nim |
01:38:01 | * | avsej quit (Changing host) |
01:38:01 | * | avsej joined #nim |
01:39:37 | * | donlzx quit (Remote host closed the connection) |
01:40:02 | * | donlzx joined #nim |
01:42:42 | * | avsej quit (Ping timeout: 256 seconds) |
01:50:24 | * | avsej joined #nim |
01:50:24 | * | avsej quit (Changing host) |
01:50:24 | * | avsej joined #nim |
01:52:05 | skrylar | i bring more presents https://github.com/skrylar/raylib-nim |
01:54:02 | * | leorize quit (Ping timeout: 256 seconds) |
01:56:40 | * | death916 quit (Quit: EliteBNC 1.6.5 - http://elitebnc.org) |
02:00:09 | * | Death916_ joined #nim |
02:00:09 | * | Death916_ quit (Changing host) |
02:00:09 | * | Death916_ joined #nim |
02:00:09 | * | Death916_ quit (Changing host) |
02:00:09 | * | Death916_ joined #nim |
02:01:07 | * | Snircle joined #nim |
02:02:25 | * | Snircle quit (Client Quit) |
02:03:21 | * | vegax87 quit (Quit: EliteBNC - http://www.elitebnc.net/) |
02:16:19 | CodeVance | thanks XD |
02:17:23 | zacharycarter | skrylar: zengine is basically a giant port of raylib π
|
02:17:31 | zacharycarter | with some added stuff |
02:17:35 | zacharycarter | and some missing stuff |
02:17:59 | zacharycarter | but anyhow - I'm going to work on a new engine soon |
02:18:06 | zacharycarter | and skeasing will be in it for sure! |
02:18:35 | zacharycarter | although I really think you should name the library skeasy |
02:19:48 | * | Death916_ is now known as death916 |
02:24:28 | * | donlzx quit (Remote host closed the connection) |
02:31:42 | * | donlzx joined #nim |
02:37:32 | * | vegax87 joined #nim |
02:41:20 | skrylar | zacharycarter, i did a big bugfix to skeasing the other day. and added physics springs |
02:46:52 | * | BitPuffin quit (Remote host closed the connection) |
03:02:02 | * | gangstacat quit (Ping timeout: 256 seconds) |
03:04:20 | * | gangstacat joined #nim |
03:06:26 | * | erblite quit (Ping timeout: 276 seconds) |
03:07:40 | * | endragor joined #nim |
03:24:33 | FromGitter | <gogolxdong> Is there any SOAP nimble packeage? |
03:29:31 | * | krux02 quit (Remote host closed the connection) |
03:47:01 | skrylar | i don't see one |
03:49:03 | skrylar | zacharycarter, have you dealt with lattice deformations? having a trouble wrapping my head around them, although current best guess is to subdivide NxN lattices in to smaller 2x2's |
03:49:47 | * | dddddd quit (Remote host closed the connection) |
03:50:26 | skrylar | will probably have to shelve the question until i have a tesselator and preview rig though :\ |
04:10:07 | FromGitter | <gogolxdong> then how to translate a SOAP python serializer to nim? |
04:23:45 | skrylar | use custom pragmas for annotations, have a macro scrape those annotations and generate code using the xml module to produce xml output? |
04:27:26 | * | xet7 joined #nim |
04:42:38 | skrylar | heh reading the 2017 survey; people wanted tk? |
04:42:50 | skrylar | I mean, i guess. Tk is a decently simple GUI, not a lot to it tho |
05:09:01 | * | beaumonta joined #nim |
05:09:44 | * | zama_ joined #nim |
05:10:40 | * | Calinou_ joined #nim |
05:11:09 | * | dzho_ joined #nim |
05:16:29 | * | Cthalupa quit (*.net *.split) |
05:16:29 | * | zama quit (*.net *.split) |
05:16:35 | * | Calinou quit (*.net *.split) |
05:16:35 | * | odc quit (*.net *.split) |
05:16:35 | * | zielmicha_ quit (*.net *.split) |
05:16:35 | * | euantor quit (*.net *.split) |
05:16:35 | * | m712 quit (*.net *.split) |
05:16:35 | * | dvn quit (*.net *.split) |
05:16:35 | * | dzho quit (*.net *.split) |
05:16:35 | * | abeaumont quit (*.net *.split) |
05:17:45 | * | Cthalupa joined #nim |
05:20:07 | * | zama_ quit (Changing host) |
05:20:07 | * | zama_ joined #nim |
05:20:09 | * | zama_ is now known as zama |
05:24:30 | * | nsf joined #nim |
05:30:11 | * | xet7 quit (Remote host closed the connection) |
05:34:12 | * | amosbird quit (Read error: Connection timed out) |
05:34:41 | * | amosbird joined #nim |
05:35:13 | * | dvn joined #nim |
05:35:13 | * | odc joined #nim |
05:35:13 | * | zielmicha_ joined #nim |
05:35:13 | * | euantor joined #nim |
05:35:13 | * | m712 joined #nim |
06:06:09 | * | xet7 joined #nim |
06:26:12 | FromGitter | <gogolxdong> Is tk popular ? never heard of. |
06:29:48 | FromGitter | <gogolxdong> tried http://rosettacode.org/wiki/100_doors#Tcl |
06:33:20 | CodeVance | python |
06:33:28 | Araq | tk itself is undead |
06:33:44 | Araq | but it's the standard UI lib for Python and maybe for Ruby too |
06:34:36 | CodeVance | tk would actually benifit from nim's macros |
06:34:54 | Araq | most UIs would, see Karax. |
06:34:56 | CodeVance | since theres so much boilerplate |
06:35:15 | CodeVance | What I don't like about tk is the interface with its internals |
06:35:30 | CodeVance | I know but tk especially. |
06:39:59 | FromGitter | <rayman22201> Good morning @Araq! Can you explain to me the situation with Variant types not being able to redefine type fields with the same name? |
06:40:15 | Araq | there is a long issue about it |
06:40:45 | FromGitter | <rayman22201> Is there a github link I can read? |
06:46:37 | Araq | https://github.com/nim-lang/Nim/issues/3629 |
06:47:05 | FromGitter | <rayman22201> Thank you! π my search skills suck today |
07:41:36 | * | PMunch joined #nim |
07:42:43 | PMunch | Hmm, we should promote this pattern in the internal options menu: https://github.com/superfunc/maybe |
07:43:14 | * | ng0 joined #nim |
07:43:24 | PMunch | s/menu/module |
07:47:54 | FromGitter | <mratsim> sounds good. |
07:48:00 | Araq | which pattern? |
07:56:42 | PMunch | Instead of doing a check if an option is valid, then try to access it's variable, have a block that exposes the value to you if it's there, and one where it's not there. |
07:57:29 | PMunch | Right now it would be entirely possible to do "if not x.isSome: echo x.get" |
07:57:36 | PMunch | Which obviously won't work |
07:57:55 | PMunch | https://shreevatsa.wordpress.com/2015/01/31/boolean-blindness/ |
07:58:43 | PMunch | Came across this when looking at Toccata: http://www.toccata.io/2017/10/No-Booleans.html |
07:58:55 | PMunch | It's a functional language that compiles to C, and it doesn't have booleans |
07:59:04 | PMunch | No if clauses |
08:00:13 | Araq | I've seen that, yes. |
08:00:23 | Araq | And don't understand it. |
08:01:01 | PMunch | What do you mean you don't understand it? |
08:01:16 | Araq | "bool" is not a result from "goto" statements, it's stupid |
08:01:53 | Araq | boolean logic predates imperative asm programming by hundreds of years |
08:02:36 | Araq | nor is the compression of information "bad". |
08:02:47 | Araq | every "sum" and "avg" operation does that too. |
08:03:11 | PMunch | Yeah he's not saying that booleans comes from gotos |
08:03:37 | PMunch | He was just using gotos as an example of things most modern languages have removed, or at least shuns. |
08:04:30 | PMunch | And compression of information, while not inherently bad, can be scary |
08:05:01 | Araq | compression is the essence of perception. |
08:06:41 | PMunch | Look at the maybe/options use-case. By creating two scopes, one with the value present, and one without it, we don't lose any information about our maybe. This means that we can't mess up something which is obviously illegal. |
08:09:02 | PMunch | Or consider NULL pointers, not a huge problem in Nim, but it happens from time to time. By compressing the check myPointer == nil into a boolean you've essentially lost information about what that boolean means. Booleans as a type is yes true or false, without retaining any information about what they actually checked. By scoping this in a similar way to the options we ensure that we can't create null pointer dereferences as the null pointer isn't visible in |
08:09:02 | PMunch | our scope. |
08:09:08 | FromGitter | <mratsim> > As Conor McBride puts it, to make use of a Boolean you have to know its provenance so that you can know what it means. β [β¦] β > Keeping track of this information (or attempting to recover it using any number of program analysis techniques) is notoriously difficult. β β Checking where a boolean comes from is difficult? [https://gitter.im/nim-lang/Nim?at=5b4ef5a44b583a74a7250e46] |
08:10:20 | FromGitter | <mratsim> Iβm fine with superfund/maybe pattern, currently reading the boolean blindness article but I think the hypothesis itβs starting with is flawed. |
08:10:27 | PMunch | @mratsim, if you only have a boolean it's impossible to know where it comes from |
08:10:56 | FromGitter | <mratsim> if you only have an int itβs impossible to know where it comes from, should we remove int? |
08:11:51 | FromGitter | <mratsim> i.e. use enums and a proper type system. |
08:11:51 | PMunch | No, the idea is that while 5 is just a number, true carries some implicit meaning of what is true |
08:12:27 | PMunch | Yeah, that is one way to solve a lot of the things they point out |
08:13:00 | FromGitter | <mratsim> 5 is not just a number, it can be kilometrs, miles, integer_overflow_error, launch the missile, health remaining, Passport ID |
08:13:00 | PMunch | I'm not saying we should go crazy and delete booleans from Nim by the way :P I just wanted to see it in the options module :P |
08:13:26 | PMunch | Yes of course |
08:14:01 | PMunch | Which is where distinct types comes in |
08:16:49 | FromGitter | <mratsim> I much prefer this essay by the same author: btw, itβs quite funny: https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html |
08:18:25 | PMunch | I haven't actually read it yet, but I've seen it referenced. I think I'll read it right away :) |
08:21:41 | * | regtools joined #nim |
08:21:46 | * | regtools quit (Client Quit) |
08:21:51 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
08:30:49 | Araq | "Iβm fine with superfund/maybe pattern, currently reading the boolean blindness article but I think the hypothesis itβs starting with is flawed" exactly my position too. |
08:37:22 | PMunch | http://www.hxa.name/notes/note-hxa7241-20131124T0927Z.html <- This talks about the issue you raised mratsim of "5 is not just a number" |
08:38:13 | PMunch | And I agree with you, the same way a bool only carries its value, so does an integer |
08:40:12 | PMunch | Imagine the case where we have many procedures which passes pointers around, each should check if it's null, even if that check was just done in the previous procedure. |
08:41:02 | PMunch | If we had created a distinct type NonNullablePtr and required that for all our procedures along with creating some way to check and convert a pointer to a NonNullablePtr this check could be done once. |
08:44:29 | PMunch | Hmm, in a macro, can you hide a symbol? |
08:44:34 | Araq | sure, so it's about 'nil' again. |
08:45:27 | PMunch | Huh, not really. That was just an example. You can make the exact same argument with e.g. range types |
08:46:08 | PMunch | Or any distinct type really |
08:57:36 | * | Vladar joined #nim |
09:11:43 | * | chemist69 joined #nim |
09:33:14 | * | dddddd joined #nim |
09:44:36 | * | yglukhov[i] joined #nim |
09:55:11 | FromGitter | <tim-st> @Araq I think it would be better if the github tags for compiler crashes are separated between crash with line number and crash without linenumber. the last one is more critical imo |
09:56:43 | FromGitter | <Vindaar> @Araq could you explain to me / point me somewhere as to what makes the `=~` template special? Looking at the code it's just an inject pragma in a `when declaredInScope` context. But I just checked and I have a similar template, which works just fine in generics. |
09:58:18 | Araq | what does "similar" mean? if it injects a variable, it has the same problem |
09:59:25 | Araq | tim-st: the compiler shouldn't crash. |
10:00:48 | FromGitter | <tim-st> Though when the linenumber is unknown maybe the dev has to search all the code |
10:01:15 | FromGitter | <tim-st> especially type definitions seem very easy to full crash |
10:03:53 | FromGitter | <tim-st> It seems only type definitions make full crashes? |
10:04:05 | * | xylef quit (Quit: WeeChat 2.2) |
10:05:07 | FromGitter | <Vindaar> Hm, yes. It also injects a variable and it works fine. I check again |
10:09:08 | * | erblite joined #nim |
10:09:53 | * | xylef joined #nim |
10:09:56 | FromGitter | <Vindaar> For example the following works fine: β β ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4f11f3623cc3040b2bcbcb] |
10:10:03 | * | beaumonta is now known as abeaumont |
10:10:06 | FromGitter | <Vindaar> where the template `withH5` looks as follows: |
10:10:34 | FromGitter | <Vindaar> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4f121a3187ca3ee8bdb099] |
10:12:21 | FromGitter | <Vindaar> (yes it doesn't check whether h5f is declared in the scope. But I created my own `=~` template which doesn't do that either and it throws the same error) |
10:16:33 | * | Perkol joined #nim |
10:19:05 | * | cspar_ quit (Ping timeout: 240 seconds) |
10:22:27 | Araq | yes. |
10:25:15 | Araq | sections passed to an 'untyped' parameter are not subject to the generic scope checking |
10:25:35 | Araq | but =~ doesn't take a block of code, it injects the 'matches' array |
10:25:49 | * | cspar_ joined #nim |
10:26:29 | FromGitter | <Vindaar> oohhhh, I was so focused on the variable being injected that I didn't even consider it the other way round. Thanks, that explains a lot :) |
10:26:46 | Araq | and it's a bad thing. It was mostly a clever idea back then to check if the compiler works. |
10:27:21 | Araq | so yeah ... maybe it's a library design problem and not a language design problem. injecting variables is pretty bad. |
10:28:59 | FromGitter | <Vindaar> I think it's a neat feature exactly for cases like this. At first I found it really weird, but if not overdone it's kinda nice. I love `mapIt`, hehe |
10:30:09 | Araq | oh hmm |
10:31:32 | Araq | `mapIt` solves my problem with `map`. it gives you an explicit "current item" |
10:33:44 | FromGitter | <Vindaar> so your problem with `map` is that there is no current item by default? |
10:34:01 | Araq | yeah. |
10:34:28 | Araq | map means I have to pass a function to it, not an expression and so my function must adhere to a certain prototype |
10:34:34 | Araq | and it doesn't so I need currying... |
10:37:10 | Araq | and I dislike features that imply more features that then need more features... |
10:38:07 | FromGitter | <Vindaar> I can relate to that |
10:38:42 | Araq | and in the end you pray your map+filter code gets optimized into the imperative for-loops you've been taught to hate. |
10:42:13 | Perkol | How do i increment a string? I know it sounds strange, it's just that crypto system I'm using uses nonces in string format. |
10:43:14 | FromGitter | <Vindaar> I guess that's true, yes. I just like the conciseness of map, filter etc. It makes the intent of the loop it replaces clear immediately. If I see a raw loop I need to check what it does manually |
10:51:43 | * | stefanos82 joined #nim |
10:52:04 | FromGitter | <tim-st> Perkol: the obvious way would be to parseInt and then back to string, but if the last char is in '0'..'8' you can increment without parseInt if it's '9' I would use parseInt |
10:56:36 | FromGitter | <tim-st> I didnt understand til today why "functional programming" is a thing... I asked different people noone could answer |
11:06:29 | Perkol | But nonce are not a number, just a sequence of random bytes? |
11:07:20 | FromGitter | <tim-st> nonce=number only used once; that depends on your context, normally nonces are in fact random so maybe incrementing means calling random.next ? |
11:11:02 | Perkol | https://download.libsodium.org/doc/advanced/salsa20.html It says you can increment it |
11:17:47 | FromGitter | <tim-st> "Counter mode" yes, that's the only one that uses this unsecure thing |
11:19:05 | FromGitter | <tim-st> "to avoid incrementing the nonce after each block" |
11:20:06 | FromGitter | <tim-st> it says incrementing is prefered (that's the way I descibed) but it doesnt say why it's prefered (for good reason) |
11:24:40 | * | endragor quit (Remote host closed the connection) |
11:25:10 | * | endragor joined #nim |
11:29:21 | * | endragor quit (Ping timeout: 244 seconds) |
11:30:18 | PMunch | Does macros have the power to remove a variable from a scope? |
11:30:52 | PMunch | Without iterating the tree for it |
11:31:12 | FromGitter | <mratsim> @Perkol are your nonces hex strings? |
11:32:12 | FromGitter | <mratsim> I suggest you use an object backed by a sequence of bytes instead and define a βincβ proc on it |
11:33:13 | Perkol | Yes, I guess |
11:33:49 | FromGitter | <mratsim> alternatively, you can use my library: https://github.com/status-im/nim-stint |
11:34:25 | FromGitter | <mratsim> the io proc to deal with Hex are there: https://github.com/status-im/nim-stint/blob/master/stint/io.nim#L185-L191 |
11:35:17 | FromGitter | <mratsim> and: https://github.com/status-im/nim-stint/blob/master/stint/io.nim#L264-L305 |
11:35:19 | Perkol | Yeah, thanks |
11:36:46 | FromGitter | <mratsim> There is an Uint256 alias as Iβm also using it for 256-bit integers mostly |
11:37:25 | FromGitter | <mratsim> but it seems like for Salsa20 you can just use uint64, since the nonce is 64-bit |
11:41:34 | * | krux02 joined #nim |
11:50:54 | FromGitter | <krux02> @mratsim when do you need 256 bit integers? |
11:51:36 | FromGitter | <mratsim> The Ethereum VM is 256-bit. |
11:52:30 | FromGitter | <mratsim> I also need Uint2048 for ethereum bloom filters |
11:55:30 | FromGitter | <krux02> all these virtual currency miners, they are the reason graphcis cards are so expensive right now |
11:58:21 | FromGitter | <mratsim> yeah, itβs costly to do deep learning due to the very high GPU price |
11:58:30 | * | endragor joined #nim |
11:59:35 | FromGitter | <mratsim> But the Ethereum VM is more about building a βworld computerβ |
12:02:35 | * | endragor quit (Ping timeout: 240 seconds) |
12:04:53 | FromGitter | <krux02> I think these crypto currencies are generally a bad thing |
12:07:10 | stefanos82 | @krux02: I thought I was the only one who was thinking about this |
12:07:11 | FromGitter | <krux02> they are a huge waste of energy, they have high deflation ratio that makes rich people richer, and making money flow a secrent mostly helps corruption. |
12:08:15 | FromGitter | <krux02> I honestly think that from a certain limit upwards of your income value, you should be watched very precisely on what you do with your money. |
12:10:52 | * | Perkol quit (Remote host closed the connection) |
12:14:22 | FromGitter | <tim-st> think so too |
12:20:04 | stefanos82 | Araq: is it so bad that I like the second coding style from this example? http://paste.debian.net/hidden/06d79a3f/ |
12:20:23 | stefanos82 | the first one does not feel convenient for me personally :/ |
12:20:56 | stefanos82 | I'm reading Nim coding style and personally did not like this specific suggestion |
12:21:43 | FromGitter | <narimiran> stefanos82: you don't need square brackets in the second example |
12:23:50 | stefanos82 | cool |
12:24:11 | stefanos82 | way more consistent this way! |
12:33:24 | FromGitter | <kaushalmodi> stefanos82: You can probably do without the commas too, in the second style. |
12:33:42 | stefanos82 | yeah, I'm reading the manual page right now |
12:33:46 | FromGitter | <mratsim> @krux02, huge waste of energy agree | deflation makes people richer: thatβs wrong, deflation encourages hoarding money, inflation encourages consumption, they donβt make people richer or poorer in a vacuum | In mainstream cryptocurrencies, money flow is not secret, the underground world has been moving away from Bitcoin and Ethereum because all transactions are public. Also physical cash and diamonds are the best |
12:33:46 | FromGitter | ... way to keep money flow a secret. β β Now Iβm not really into cryptocurrencies, I am much more interested into the blockchain technology and its future use case. But I guess this conversation should be in #nim-offtopic |
12:41:49 | FromGitter | <codem4ster> Hi all :) |
12:41:58 | FromGitter | <mratsim> hi |
12:42:08 | * | donlzx quit (Quit: Leaving) |
12:43:43 | FromGitter | <codem4ster> I meet with Nim newly. Just looking around and trying to write some simple scripts. |
12:45:36 | FromGitter | <codem4ster> When I looked the 3rd party libraries of Nim, I noticed that most of them 3-4 years old but after that time no development on repos. |
12:45:54 | FromGitter | <codem4ster> Is this have a specific reason? |
12:46:26 | FromGitter | <codem4ster> like this: https://github.com/idlewan/jade-nim |
12:47:14 | krux02 | it's just the libraries that you are looking at. |
12:47:30 | krux02 | it is not that particularly something happened 4 years ago |
12:48:50 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
12:49:23 | * | yglukhov[i] joined #nim |
12:51:06 | FromGitter | <codem4ster> Oh ok. I want to make web development with Nim. Do you know any microframework except Jester (I found it a bit slow on benchmarks)? |
12:51:45 | dom96 | What are you planning to develop? |
12:52:16 | dom96 | In the past few days I have been optimising Jester so it should be much faster now |
12:52:20 | FromGitter | <codem4ster> I will make a simple blog at first. |
12:52:41 | FromGitter | <codem4ster> Just for learning. |
12:54:17 | FromGitter | <codem4ster> I loved Nim so much and want to contribute by making 3rd party libraries to web side on my free time but firstly I want to learn the language well. |
12:56:50 | FromGitter | <Yardanico> @dom96 - just curious (again) - how many people finished the survey? :) |
12:58:31 | dom96 | 537 |
12:59:04 | dom96 | It's supposed to end on the 23rd but I might extend it |
12:59:12 | dom96 | I want to add a banner on nim-lang.org about it |
13:00:58 | FromGitter | <mratsim> @codem4ster Iβm like the last person you should ask fro webdev in Nim (and dom96 being the first) but here are some keywords besides Jester: Karax (react-like framework), mofuw (http client), httpbeast (http client used in Jester), check also the source code of the nimforum and nim/website |
13:01:19 | dom96 | mofuw isn't an http client |
13:01:22 | dom96 | It's a web framework too |
13:01:28 | dom96 | neither is httpbeast |
13:01:29 | FromGitter | <mratsim> oh, nice |
13:01:31 | dom96 | it's an http *server* |
13:01:45 | FromGitter | <mratsim> i.e. Iβm the last person to ask about webdev ;) |
13:02:06 | FromGitter | <Yardanico> hmm, strange, in 2016 survey there were 790 responses, in 2017 one - 603 |
13:04:00 | PMunch | @mratsim, Araq, added the Options safe pattern: https://github.com/nim-lang/Nim/pull/8358 |
13:04:13 | PMunch | Along with some other stuff from Toccata |
13:05:25 | * | Vladar quit (Quit: Leaving) |
13:06:20 | dom96 | Yardanico: First year the survey was on HN |
13:06:25 | dom96 | No such luck with the second year or this year |
13:06:26 | FromGitter | <mratsim> I donβt like the βoptionCaseβ, we should just use case fooOption: some x: none: |
13:06:43 | FromGitter | <codem4ster> thanks @mratsim I will look mofuw also. |
13:06:47 | dom96 | Well, actually, a comment I made on the Rust community survey became popular |
13:06:52 | dom96 | The launch itself wasn't on HN |
13:07:21 | PMunch | mratsim, is that even possible? |
13:07:34 | PMunch | That would require having an overload on case.. |
13:07:37 | FromGitter | <mratsim> rename optionCase to case β> ??? β> profit? |
13:07:46 | PMunch | Does it work? |
13:08:07 | FromGitter | <mratsim> good question, if itβs a reserved keyword it won't |
13:08:59 | dom96 | or rename it to `match` |
13:09:08 | FromGitter | <mratsim> yeah itβs reserved so it must be added on the compiler/magic side i suppose |
13:09:15 | FromGitter | <mratsim> match is good too |
13:09:36 | dom96 | Can macros be overloaded though? |
13:09:44 | dom96 | Could a `match` macro be defined for more types? |
13:09:51 | dom96 | if not then we need a different solution |
13:09:59 | FromGitter | <mratsim> if the signature is different yes |
13:10:40 | FromGitter | <narimiran> PMunch: i don't understand why this is true `optCmp(some(30), 20, leq) == none(int)` |
13:10:48 | FromGitter | <mratsim> if itβs `match(body: untyped)` you will have several if-elseif in a super match macro |
13:11:01 | FromGitter | <narimiran> line 106 in your PR |
13:11:34 | PMunch | narimiran, 30 is not lower or equal to 20 |
13:12:03 | FromGitter | <narimiran> oooh, `none` is equivalent of `false` |
13:12:12 | PMunch | Yeah, in a way |
13:12:26 | dom96 | Why not just define `and` and `or` for these instead? |
13:12:53 | dom96 | Meh, I'm not convinced about how practical these are |
13:13:03 | FromGitter | <mratsim> btw Iβm pretty sure I saw a lengthy discussion about the bind (`>>=`) operator |
13:13:25 | FromGitter | <mratsim> and the outcome is, use something searchable |
13:13:29 | dom96 | Yep |
13:13:33 | FromGitter | <narimiran> wooo, inplace right-shift! :D |
13:13:33 | dom96 | We prefer words over operators |
13:13:49 | dom96 | IIRC Scala takes this approach too |
13:13:53 | dom96 | so it would be good to copy it |
13:14:06 | PMunch | dom96, well `or` typically returns a boolean |
13:14:10 | FromGitter | <mratsim> github doesnβt help, impossible to search for >>= |
13:14:51 | PMunch | Oh yeah, that was just a plain copy from superfuncs version |
13:15:08 | FromGitter | <kaushalmodi> @mratsim https://github.com/nim-lang/Nim/pull/6404 ? |
13:15:21 | FromGitter | <mratsim> thank you |
13:15:29 | PMunch | dom96, you weren't here earlier when we discussed this, but this is what sparked it: http://www.toccata.io/2017/10/No-Booleans.html |
13:16:02 | PMunch | I read that, went searching for something similar in Nim and came across this: https://github.com/superfunc/maybe |
13:16:27 | dom96 | TL;DR? :) |
13:16:40 | PMunch | Uhm, booleans bad, composing good? |
13:17:44 | FromGitter | <kaushalmodi> PMunch: Looking forward to a blog post on this topic from you :) |
13:17:55 | FromGitter | <mratsim> more like, new syntax proposal, OK, article bad starting hypothesis ;) |
13:19:17 | PMunch | The argument goes something like this: booleans hide what they actually compared. By using patterns like this you avoid doing bad stuff like "if not x.isSome: echo x.unsafeGet". The and/or/cmp things are to work with the has-ity of option values so that you can avoid these situations. |
13:20:17 | dom96 | We need a longer example |
13:20:19 | FromGitter | <mratsim> i.e. this is extending case statement βnot all cases are coveredβ to Option |
13:20:24 | dom96 | You can just `echo x`... |
13:20:37 | dom96 | And I'm having a hard time imagining a use for these new templates |
13:20:41 | PMunch | kaushalmodi, I was thinking about it. But I'm not sure if I would contribute with anything new :P |
13:21:04 | PMunch | dom96, well I've already used them, so has superfunc apparently :P |
13:21:28 | dom96 | I've used many things, doesn't mean they should be in the stdlib :P |
13:21:41 | FromGitter | <mratsim> I think within a `some x` block you can automatically unbox x. |
13:21:47 | PMunch | The use case is the same as the regular if check and exceptions way of doing it, just a bit more on the functional side |
13:21:56 | FromGitter | <kaushalmodi> PMunch: In general I am intrigued about the options module. So if this PR goes through, it would be cool if you had a brief refresher post on the updated options module. |
13:22:01 | PMunch | mratsim, that's what it does |
13:22:33 | FromGitter | <mratsim> Anyway, it seems like you didnβt participate in https://github.com/nim-lang/Nim/issues/7476, you should add your input there |
13:22:41 | PMunch | The "optionCase option: some x:" will unpack option into x when it has a value |
13:22:57 | dom96 | I understand the purpose of `optionCase |
13:23:16 | PMunch | kaushalmodi, well that I can do :) |
13:23:18 | FromGitter | <krux02> I like the idea in toccata that (= x 15) yields <maybe 15> |
13:23:20 | dom96 | But optCmp, optAnd, etc. I'm unconvinced about |
13:23:26 | PMunch | dom96, yeah that was for mratsim |
13:23:33 | dom96 | Okay, just want to be clear |
13:23:45 | FromGitter | <mratsim> some position as dom96, optionCase/match seems good enough |
13:24:04 | FromGitter | <krux02> I don't know how useful it will be eventually, but often I want to do test conditions on a value, and if that test condition is true, then I want to operate on that value |
13:24:10 | PMunch | optCmd/optAnd/optOr are basically flow control with options |
13:24:42 | PMunch | krux02, that is exactly what optCmp would give you |
13:24:44 | FromGitter | <mratsim> just overload and/or? |
13:24:56 | FromGitter | <krux02> what is optCmp? |
13:25:13 | Araq | a comparison option. |
13:25:36 | PMunch | krux02, comparison that returns a maybe like in Toccata |
13:25:36 | FromGitter | <mratsim> ... |
13:25:52 | PMunch | mratsim, but as I said and/or are meant to return booleans |
13:25:56 | FromGitter | <mratsim> that was for Araq comment |
13:25:58 | PMunch | These return a maybe |
13:26:02 | FromGitter | <mratsim> mmm |
13:26:05 | FromGitter | <krux02> is it implemented somewhere? |
13:26:28 | PMunch | krux02, https://github.com/nim-lang/Nim/pull/8358 |
13:28:03 | FromGitter | <krux02> sorry, please no PR. This is highly experimental stuff. |
13:28:34 | FromGitter | <mratsim> I think we need proper lift proc like in Haskell or continuation βthenβ/βand_thenβ like in Rust/JS, β That would be helpful for much more than Option (i.e. Result/Error/Either types). |
13:28:39 | PMunch | What? It's not experimental.. |
13:28:45 | FromGitter | <krux02> there is absolutely no reason why you can't do this in a nimble package |
13:29:00 | FromGitter | <krux02> nim is very flexible in adding functionality to existing data types |
13:29:08 | FromGitter | <krux02> and the data type is given in th standard library. |
13:29:22 | FromGitter | <krux02> I like that you improved on the documentation |
13:29:34 | FromGitter | <krux02> but I don't like at all the new names that you introduced |
13:29:35 | PMunch | Oh well, I guess I could add the optCmp/optAnd/optOr stuff in a nimble package.. |
13:29:55 | FromGitter | <krux02> yes pleas |
13:29:56 | PMunch | Yeah the names are open for change :P |
13:30:09 | Araq | I think this makes for an excellent blog post and nimble package |
13:30:21 | PMunch | So in conclusion, find a new name for optionCase, and move the rest to a Nimble package? |
13:30:40 | FromGitter | <krux02> I mean if you make the nimble package and it turns out that you use it every of your projects and it really is super duper useful without too much performance penalty. Then yes it might become part of the standard library. |
13:30:48 | Araq | can give you case statement macros ... |
13:31:02 | Araq | they would work like for statement macros... |
13:31:10 | PMunch | Huh? |
13:31:19 | FromGitter | <krux02> but think about it. This is about to change several times, and everything that is in th standard library as to be maintained by the nim developers. |
13:31:24 | Araq | which really need to be behind an .experimental switch |
13:31:44 | FromGitter | <krux02> is there an .experimental switch? |
13:31:50 | FromGitter | <mratsim> yes |
13:32:00 | PMunch | krux02, fair enough. I was just using superfunc/maybe and thought that it was a much nicer pattern than the current Options implementation. The optAnd/optOr/optCmp was just added as it was in the same vein. |
13:32:06 | FromGitter | <mratsim> {.experimental: myNewFeature.} |
13:32:35 | FromGitter | <krux02> what I did to improve the control flow in my macros is, I overloaded the `or` operator for the NimNode type |
13:33:02 | FromGitter | <krux02> so I could say: let mynode = nodaA or nodeB |
13:33:26 | Araq | ^ yeah that can be nice. |
13:33:58 | FromGitter | <krux02> Araq: it is, and it is even very readable |
13:34:09 | PMunch | Wait, what does that do? |
13:34:11 | * | nsf quit (Quit: WeeChat 2.1) |
13:34:30 | FromGitter | <mratsim> Pattern matching would be better than optAnd: β β match x { β β ```code paste, see link``` ... [https://gitter.im/nim-lang/Nim?at=5b4f41e6623cc3040b2c68a3] |
13:34:46 | FromGitter | <krux02> well men nodeA is empty or nil, then it evaluates to nodeB, otherwise it evaluates to nodaA |
13:35:30 | FromGitter | <mratsim> match x { β β ```Some(x) and y => βFoo", β Some(x) or z => βBar", β None => βBaz"``` β β }); [https://gitter.im/nim-lang/Nim?at=5b4f4221fd1b3474a69b8b3a] |
13:35:35 | FromGitter | <krux02> nil doesn't really exist for nodes, they are most of the time of kind`nnkEmpty` |
13:36:00 | FromGitter | <krux02> that I don't understand |
13:36:41 | PMunch | krux02, ah gotcha |
13:38:06 | FromGitter | <krux02> BTW, the `or` is a pattern that I knew from lisp programming |
13:39:09 | FromGitter | <krux02> in elisp there is no boolean type, just a nil and anything else (and a T for non creative programmers). |
13:39:17 | PMunch | @mratsim, I agree that pattern matching would be better |
13:39:45 | FromGitter | <krux02> and (or (exp1) (exp2) ...) selects the first non nil value in the arguments. It even has lazy evaluation |
13:40:24 | FromGitter | <krux02> do you all know about my ast pattern matching library? |
13:40:45 | PMunch | Yeah I've used it, great stuff! |
13:41:09 | PMunch | And that example would work exactly the same with optAnd and optOr :) |
13:41:23 | PMunch | But not the non-nil, but the none options |
13:42:08 | PMunch | Well, you could even drop the and and just use optOr since you only pass it one argument |
13:57:29 | PMunch | Oh well, I'm going on a little fishing trip. I'll play around with this some more when I get the time |
13:58:30 | * | PMunch quit (Quit: Leaving) |
14:07:17 | * | _dorelix joined #nim |
14:09:27 | * | dorelix_ quit (Ping timeout: 240 seconds) |
14:11:15 | * | dzho_ is now known as dzho |
14:19:04 | * | drazan quit (Remote host closed the connection) |
14:20:56 | * | drazan joined #nim |
14:23:03 | * | Vladar joined #nim |
14:31:24 | * | cspar_ quit (Ping timeout: 260 seconds) |
14:42:23 | * | cspar_ joined #nim |
14:43:26 | FromGitter | <codem4ster> Hi all |
14:43:50 | FromGitter | <codem4ster> I have two files with same name in different folders |
14:44:05 | FromGitter | <codem4ster> some/lib.nim and another/lib.nim |
14:44:32 | FromGitter | <codem4ster> but it says module names need to be unique per nimble package module clashes with ... |
14:45:13 | FromGitter | <codem4ster> ```import some/lib as some β import another/lib as another``` [https://gitter.im/nim-lang/Nim?at=5b4f52798fe2780689c0ccc6] |
14:45:34 | FromGitter | <codem4ster> cannot we use these just like this |
14:46:08 | FromGitter | <codem4ster> at the end they're different modules in different files |
14:46:36 | * | nsf joined #nim |
14:47:21 | krux02 | codem4ster: can't you make your package names unique? |
14:47:35 | krux02 | nim doesn't have nested packages |
14:47:47 | krux02 | you only have paths to packages |
14:48:30 | krux02 | it is not really recommended to names something just "lib" anyway. |
14:48:39 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
14:49:00 | dom96 | Create a pkgA.nimble and pkgB.nimble files inside those directories |
14:49:02 | dom96 | then it will work |
14:49:14 | * | yglukhov[i] joined #nim |
14:50:49 | krux02 | dom96: that is exactly what I think is weird about nimble projects |
14:52:58 | FromGitter | <codem4ster> in web perspective `models/user` and `controllers/user` are common used folder pattern |
14:53:36 | dom96 | krux02: This is a Nim implementation detail |
14:54:22 | krux02 | codem4ster: well nim is not web. |
14:54:54 | FromGitter | <codem4ster> oh ok, sorry for asking then :) |
14:55:14 | krux02 | in nim you need to be able to use a unique package name for symbol disambiguation |
14:55:37 | krux02 | so you can do pkgA.foo or pkgB.foo in case foo is not unique on it's own |
14:55:53 | krux02 | the path where the package comes from is just not part of that unique identifier |
14:56:46 | krux02 | dom96: One think that always bothered me in Nim, it is not universally possible to get correct syntax checking for any file just by providing the file name. |
14:57:23 | FromGitter | <codem4ster> I got it. But I think that is not a good design decision for modules. |
14:57:35 | krux02 | this makes it hard for editors like emacs to support syntax checking by default |
14:57:45 | FromGitter | <codem4ster> But implementation is implementation at the end. |
14:57:54 | krux02 | users always have to go though this hassle of setting up a project properly |
14:58:04 | krux02 | I want to get rid of that. |
14:58:26 | krux02 | Open a nim file in editorX and there you get syntax checking. No setup required |
14:58:58 | dom96 | I would have liked for it to just work (TM) too |
14:59:02 | krux02 | that should be highest priority, and that is what the language Go just got right, and Nim does fail at. |
14:59:04 | dom96 | But Araq had his reasons for doing it this way |
14:59:27 | Araq | that doesn't work for any language out there I know. |
14:59:33 | Araq | maybe it does for Go. |
14:59:47 | Araq | it certainly doesn't for C# which has/had one of the best IDEs |
14:59:53 | FromGitter | <codem4ster> That is first language I ever saw using modules like this. But I will try to adapt. May be I can use include. |
14:59:55 | krux02 | It does for Go and that is why I would recommend Go for every beginner in programming |
15:00:02 | * | fvs left #nim ("ERC (IRC client for Emacs 26.1)") |
15:00:03 | krux02 | not Nim |
15:00:50 | Araq | ok, so how can it work? |
15:01:05 | krux02 | just because it doesn't work for C#, that is no reason that it also shouldn't work for Nim. |
15:01:13 | Araq | you pass the directory to nimsuggest, nimsuggest figures out the main file and off you go. |
15:01:33 | Araq | ah ok, but your plugin does not pass the directory and so it's Nim fault, got it. |
15:01:45 | krux02 | and what exactly is the problem of figuring out the directory on it's own? |
15:02:27 | krux02 | why not just search the directory tree upwards for "project.nimble" where project is a constant name that can't be changed |
15:03:29 | krux02 | and that nimble file should work, even if it is empty. |
15:03:52 | Araq | that's what nimsuggest does, except for the "search in parent dirs" part. which we can add. |
15:04:08 | Araq | but then the problem remains because you're just unwilling to use a non-broken plugin. |
15:04:58 | krux02 | when I open a file in emacs, The only information I have is that filename and the content of that file |
15:05:36 | krux02 | so when I want to pass the directory to nimsuggest, I have no a single bit more information about a project than nimsuggest. |
15:05:49 | krux02 | so my question is, why can't nimsuggest solve it? |
15:07:01 | Araq | if you pass a file to nimsuggest, that's the main file, if you pass a directory it performs a search. |
15:07:13 | Araq | I dunno what's so hard to understand here. |
15:07:44 | Araq | in VS code you can configure the main file, for example. |
15:07:58 | Araq | and that's useful because -- wait for it -- |
15:08:01 | krux02 | there is no concept of a "project" in emacs like in an IDE. It doesn't even have a constant working directory. When you open a file, the cwd (current working directory) is always the directory of that file |
15:08:06 | Araq | the "main" file can be ambiguous. |
15:08:29 | krux02 | and commands that work on the filesystem are then executed in the directory of the file. |
15:09:05 | krux02 | yea in vs code you have one project open at a time and you can set "project" settings |
15:09:13 | krux02 | emacs doesn't have "project" variables |
15:09:26 | krux02 | all I can do is to put all the information in the file system |
15:09:36 | krux02 | and that is what I eventually did. |
15:09:52 | Araq | either you can extract the directory part of a filename in Elisp or you can't. if you can't, just say so. if you can, patch your plugin. |
15:10:07 | krux02 | but when I have to put it in the filesystem anyway, then nimsuggest can read that information, too |
15:10:38 | krux02 | and when nimsuggest actually reads that inforamtion, then I don't need to add support for different editors to read the information. |
15:10:57 | Araq | either you can extract the directory part of a filename in Elisp or you can't. if you can't, just say so. if you can, patch your plugin. |
15:11:17 | krux02 | I can extract the directory part of a filename |
15:11:31 | Araq | ok, so patch the plugin. |
15:12:25 | Araq | yeah, I know you won't and in 2 weeks this discussion will pop up again. |
15:12:52 | krux02 | Araq: I solved the problem of `ambiguous main` with a file in the filesystem |
15:13:07 | krux02 | I have "nimsuggest-project-file" in my project |
15:13:16 | Araq | yes, you essentially solved it in exactly the way that nimsuggest does. |
15:13:21 | krux02 | and the content of that file is just "fancygl.nim" |
15:13:26 | Araq | and I have told you this now for the 3rd time. |
15:13:40 | krux02 | but then why doesn't it work for nimsuggest? |
15:13:59 | krux02 | why do I need to pass nimsuggest that file manually? |
15:14:40 | Araq | PASS THE DIRECTORY TO NIMSUGGEST; OMG JUST HOW HARD IT CAN BE TO READ? |
15:16:46 | krux02 | Araq: so when I pass /some/path/pkg/subpkg/ to the nimsuggest process of /some/path/pkg/subpkg/somefile.nim, it will find /some/path/pkg/main.nim? |
15:21:54 | Araq | https://github.com/nim-lang/Nim/blob/devel/compiler/options.nim#L572 |
15:22:40 | Araq | as I said, it does the search, but doesn't go up in the path tree. you can patch it to do that, or you can patch your plugin to do that. |
15:23:17 | Araq | if I patch it, you still need to patch your plugin to pass a directory to nimsuggest. |
15:30:41 | * | erblite quit (Ping timeout: 276 seconds) |
15:31:53 | * | Vladar quit (Remote host closed the connection) |
15:40:33 | * | chemist69 quit (Quit: WeeChat 1.9.1) |
15:43:53 | * | stefanos82 left #nim ("Leaving the channel.") |
16:07:39 | dom96 | Jester 0.4.0 is here: https://github.com/dom96/jester/blob/master/changelog.markdown#040---18072018 :) |
16:17:20 | Araq | dom96: is sendFile Linux-specific? |
16:17:35 | dom96 | no |
16:17:58 | dom96 | But there is an optimisation that I could do |
16:18:01 | dom96 | which I don't do right now |
16:18:19 | FromGitter | <Varriount> I thought Windows didn't have sendfile? |
16:19:04 | Araq | ah ok, got it, thanks |
16:19:20 | dom96 | sendFile != posix sendfile |
16:19:27 | dom96 | It's just a jester template |
16:20:13 | FromGitter | <Varriount> Also, this is interesting: https://docs.microsoft.com/en-us/windows/desktop/api/mswsock/nf-mswsock-transmitfile |
16:21:08 | * | cspar_ quit (Ping timeout: 255 seconds) |
16:25:20 | * | cspar joined #nim |
16:25:36 | Araq | yeah, so Windows has sendfile too |
16:25:52 | * | endragor joined #nim |
16:30:15 | * | endragor quit (Ping timeout: 245 seconds) |
16:33:48 | FromGitter | <Varriount> Araq: Regarding exceptions and that C++ paper, did you come to any conclusions? |
16:35:04 | Araq | yeah, but it requires an RFC |
16:39:05 | * | xylef quit (Quit: WeeChat 2.2) |
16:39:07 | Araq | in a nutshell, remove the 'ref object' exceptions, replace it by a single enum. attach stack traces, error messages etc to a thread-local variable. export system.panic() that is called for the builtin failures like IndexError. panic() can be overwritten in an 'supervise' environment, a supervisor knows the allocator and all open file handles and resources and can free them, it's our "poor man's OS" for webservices and embedded systems. |
16:41:35 | dom96 | Yeah, write this RFC already. I have lots of questions about this |
16:43:09 | * | erblite joined #nim |
16:47:37 | * | cspar quit (Ping timeout: 244 seconds) |
16:53:34 | Araq | like? ask them now so that I can address them in my proposal |
16:54:42 | * | Calinou_ is now known as Calinou |
16:59:36 | * | jjido joined #nim |
17:00:36 | dom96 | Like, what's the problem with 'ref exceptions'? |
17:01:39 | dom96 | enums imply there will no longer be an exception hierarchy, is that the case? |
17:09:17 | * | Vladar joined #nim |
17:11:54 | * | nsf quit (Quit: WeeChat 2.1) |
17:15:40 | Araq | yup, no hierarchy |
17:16:25 | Araq | ref exceptions mean you need a heap and GC. for embedded targets these are problematic |
17:17:35 | FromGitter | <tim-st> maybe I'm completly wrong but arent exceptions and the amount of memory for those known at compile time? |
17:19:02 | Araq | no, they are not, you can inherit and add fields |
17:19:11 | Araq | exceptions can also be nested |
17:20:03 | FromGitter | <tim-st> yes, I thought this can be represented on an array as hierachy when specific features are turnt off which are not possible at compile time |
17:37:50 | * | stefanos82 joined #nim |
17:38:54 | * | rauss joined #nim |
17:42:28 | * | rauss quit (Client Quit) |
17:45:51 | dom96 | Araq: That's a pretty serious limitation (No hierarchy) |
17:53:14 | * | yglukhov[i] quit (Remote host closed the connection) |
17:53:50 | * | yglukhov[i] joined #nim |
17:55:24 | stefanos82 | dom96: I finished your book. I liked it, but you left me with lots of questions that I would love to read even more. How about writing another book, like "Nim in Depth" or "Advanced Nim"? |
17:58:37 | * | yglukhov[i] quit (Ping timeout: 256 seconds) |
17:59:11 | dom96 | I'll let someone else do that. One book is enough for me for now :) |
17:59:23 | stefanos82 | hahaha ^_^ that's fair! |
17:59:46 | * | nsf joined #nim |
18:00:01 | * | Vladar quit (Quit: Leaving) |
18:00:12 | stefanos82 | dom96: it took me 1,5 years to finish mine while I was working for a private university and it was indeed quite exhausting procedure |
18:06:18 | * | sleepyqt joined #nim |
18:08:15 | * | yglukhov[i] joined #nim |
18:12:26 | krux02 | stefanos82, I think dom96 would do a revision 1.1 of his book before making a second one, because of all the breaking changes that I put in the languages :P |
18:12:40 | stefanos82 | I'm in. |
18:12:47 | * | yglukhov[i] quit (Ping timeout: 256 seconds) |
18:13:03 | krux02 | I changed the output of a NimNode in the treeRepr |
18:13:16 | krux02 | so the output from the book is incorrect now |
18:14:22 | krux02 | and the nil won't be a state for seq and string anymore, but that change wasn't on me. |
18:14:54 | krux02 | I just created a PR for it that caused weird problems in the GC |
18:15:53 | * | jjido quit (Ping timeout: 255 seconds) |
18:16:03 | dom96 | What did you change in treeRepr? |
18:16:14 | dom96 | I'm mainly concerned about people not being able to compile code in the book |
18:16:20 | krux02 | I removed the `!` in identifier nodes |
18:16:25 | dom96 | If the output is slightly different it shouldn't be an issue |
18:16:32 | dom96 | Yeah, that's really a minor thing |
18:16:46 | krux02 | there was a question about that here in the chat |
18:17:18 | krux02 | dom96: I can imagine that by realeasing the book you didn't necessarily became rich. |
18:17:45 | krux02 | but I am curious about how many book you actually sold. |
18:18:09 | krux02 | but you may keep it as a secret |
18:19:34 | dom96 | Yeah, I'd rather not say :) |
18:20:11 | Araq | stefanos82: which book did you write? |
18:20:30 | * | xylef joined #nim |
18:23:01 | krux02 | dom96: there is still the chance that you might become richt with your book, if Nim becomes the new Holy Grail of programming language any your book will be adopted as the new Bible that every Nim programmer will carry around under their arm to quote from it when it might become necessary |
18:23:44 | dom96 | That's the dream |
18:24:21 | krux02 | but before that a lot of dirty work needs to be done |
18:25:17 | * | sleepyqt quit (Ping timeout: 265 seconds) |
18:25:39 | zacharycarter | I'm trying to drum up support for httpbeast / jester at work |
18:25:45 | zacharycarter | dom96 - do you know when the next round of benchmarks will be published? |
18:26:56 | dom96 | Nope. But they have continuous benchmarks that are constantly running, sadly in the latest run httpbeast failed. No idea why :/ |
18:27:13 | dom96 | It takes ~70 hours to run all the benchmarks too |
18:28:34 | zacharycarter | ugh |
18:28:48 | stefanos82 | Araq: a shorter version of "The C++ Primer Plus" by Stephen Prata |
18:29:11 | stefanos82 | I was given the task to reduce its size for my colleagues and did so for the pleasure of it |
18:29:32 | stefanos82 | that's how I learned about LaTeX |
18:29:50 | Araq | no wonder it took over a year then :-) |
18:29:56 | stefanos82 | yep |
18:30:10 | stefanos82 | oh you mean due to the LaTeX use? on the contrary |
18:30:15 | Araq | LaTex -- spend 1 hour on the content, 4 on the layout. |
18:30:17 | stefanos82 | learning it was the easy part |
18:33:52 | Araq | I need to visit a latex guru and watch him work. my theory is that he is actually objectively super unproductive but lives in a delusion of productivity because he doesn't have to touch the mouse. |
18:34:06 | Araq | :P |
18:36:16 | stefanos82 | hey, if you sacrifice like a couple of hours of a whole 1.5 years of actual work, then that's nothing, really! |
18:39:29 | * | tribly quit (Quit: WeeChat 2.1) |
18:40:32 | * | tribly joined #nim |
18:41:11 | dom96 | zacharycarter: What are they currently using at work? |
18:51:23 | * | Ven`` joined #nim |
18:52:56 | * | erblite quit (Remote host closed the connection) |
18:58:54 | dom96 | hrm, seems boehm is to blame here |
19:00:05 | dom96 | has anyone tested --gc:boehm with threads before? |
19:01:19 | * | poopBot joined #nim |
19:01:21 | Araq | it's part of the test suite |
19:01:27 | Araq | I think. |
19:02:48 | stefanos82 | I have heard a few days ago a couple of folks here complaining about boehm too |
19:03:00 | stefanos82 | what's seems to be the problem with it? |
19:03:24 | dom96 | Not sure, it's only failing in the TechEmpower docker container |
19:03:36 | dom96 | It crashes in release mode |
19:03:49 | dom96 | and in debug mode it gives warnings about huge blocks being allocated |
19:05:36 | * | erblite joined #nim |
19:11:19 | * | yglukhov[i] joined #nim |
19:13:10 | stefanos82 | what is the memory limit set up for boehm gc? |
19:13:29 | * | chopzwei joined #nim |
19:17:25 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
19:17:57 | * | yglukhov[i] joined #nim |
19:20:27 | * | jjido joined #nim |
19:20:52 | * | chopzwei quit (Quit: Leaving) |
19:25:12 | FromGitter | <Quelklef> Is there any good comprehensive document on *exactly* what `var` is and how it works? Especially `var` parameters. I've been able to build up an intuition around them but I must admit I don't really get them. And I can't find anything from Google. |
19:25:33 | FromGitter | <Quelklef> IIRC it doesn't just mean "mutable" |
19:28:47 | stefanos82 | the way I memorize it is the following: var == variable, let immutable once it gets assigned with a value, const the same as let but happens during compilation time |
19:28:52 | stefanos82 | I hope I got it correct |
19:29:43 | FromGitter | <Quelklef> Right that's all fine but I'm wondering more with var parameters |
19:30:05 | Araq | a var parameter is very close to C++'s & parameters if that helps you. |
19:30:06 | krux02 | var parameters are there, if you want to change the value of the argument |
19:30:41 | FromGitter | <Quelklef> @Araq unfortunately, I never learned C++. But that gives me a starting point, thanks |
19:30:58 | FromGitter | <Quelklef> @krux02 is the 'thing' I'm modifying the variable, or the value? |
19:31:05 | krux02 | so you can implement ``proc swap(a,b: var int) = let x = a; a = b; b = x |
19:31:05 | stefanos82 | Araq: the funny thing is that those 3 names are identical as those of JavaScript's but with a different semantic |
19:31:06 | krux02 | `` |
19:31:09 | FromGitter | <Quelklef> Sorry, that phrasing is a little weird |
19:31:27 | FromGitter | <Quelklef> Ah, interesting |
19:31:35 | FromGitter | <Quelklef> I'd've thought swap would have to be a macro |
19:31:49 | krux02 | you can't do swap in javascript but in nim, no problem |
19:32:13 | krux02 | that is called a "reference" |
19:32:30 | krux02 | (in global terms, not nim terms or java terms) |
19:32:41 | FromGitter | <Quelklef> Are vars abstractions over pointers? |
19:32:48 | krux02 | (with global I mean compiler construction terms) |
19:32:56 | FromGitter | <Quelklef> So a `var x: int` is like a `int *x` |
19:33:01 | krux02 | they are internally pointers, yes |
19:33:05 | FromGitter | <Quelklef> Ahhhhh |
19:33:06 | Araq | no. |
19:33:15 | FromGitter | <Quelklef> No? |
19:33:17 | Araq | 'var x: int' is not an internal pointer |
19:33:36 | Araq | but it gets turned into one if you pass it to a proc that takes a 'var' parameter |
19:33:48 | krux02 | yes |
19:33:54 | FromGitter | <Quelklef> Ok, better question |
19:34:02 | krux02 | var for variables is a different thing as var for parameters |
19:34:04 | FromGitter | <Quelklef> Can I conceptualize `var x: T` as `T *x` |
19:34:09 | FromGitter | <Quelklef> Ah, I see |
19:34:11 | Araq | no. |
19:34:22 | FromGitter | <Quelklef> Ok |
19:34:23 | krux02 | don't think that way |
19:34:43 | krux02 | normal parameters are also often converted to pointers for performance reasons |
19:35:00 | FromGitter | <Quelklef> Right, but I don't have to worry about that |
19:35:02 | Araq | krux02: that makes things more complex for no reason. |
19:35:09 | stefanos82 | dom96: I have searched a bit about boehm's warnings and based on what others said in forums, github tickets, and so forth, happens when it tries to release a memory lower than the one it got reallocated with greater size than its original one. |
19:35:48 | FromGitter | <Quelklef> So then what's the difference between a var parameter and a pointer? |
19:35:53 | FromGitter | <Quelklef> If they shouldn't be conflated |
19:36:03 | krux02 | different people trying to explain the same thing differently also makes things a bit more complicated. The question war about var parameters specifically, and they are internally pointers |
19:36:30 | krux02 | a pointer is a different type |
19:36:35 | krux02 | a var parameter, is not |
19:36:45 | Araq | it's an open question if they have to be implemented as pointers. |
19:37:11 | Araq | we could also propagate the changes back on proc return |
19:37:16 | krux02 | Araq: yea, but you wrote the compiler, it there any case where a var parameter is not a pointer? |
19:37:31 | krux02 | and when someone understands pointers, then I might just use that |
19:37:37 | krux02 | to base the explanation on |
19:38:09 | * | yglukhov[i] quit (Remote host closed the connection) |
19:38:11 | Araq | no, but I may want to change the implementation. |
19:38:23 | krux02 | that is interesting |
19:38:33 | krux02 | how would you want to change the implementation? |
19:38:45 | krux02 | I can't thing about a different implementation than a hidden pointer |
19:38:54 | Araq | as I said, write back the changes on return. |
19:39:19 | Araq | takesVar(a, b) --> (a, b) = takesVar(a, b) |
19:39:51 | Araq | unlikely to happen anytime soon though. |
19:40:07 | FromGitter | <Quelklef> Araq: I had a similarish idea and I wonder your thoughts on it. It'd be that all side-effects do not "actually" take place, but are instead carried by an implicit context and passed from function to function. Then, there would be special syntax to be able to interact with this context. This way, you could call a function and, for instance, ignore all side-effects |
19:40:12 | krux02 | well might also turn out to be a bad idea |
19:40:51 | Araq | krux02: it is the way aggressive optimizers like. |
19:41:28 | krux02 | but what is with the cases where you pass a big object to a function and only change a single member of it? |
19:41:43 | krux02 | then you would write the entire object back on return? |
19:42:06 | Araq | optimizers reason about code, copy elimination is vastly more effective than removing false aliasing |
19:43:53 | stefanos82 | Araq: have you played with the thought of offering your services as compiler or language designer by demonstrating your language as your actual case study? |
19:44:07 | krux02 | I also have a lot of code written where I append to a string that is a var parameter |
19:44:16 | stefanos82 | I wish I could afford this and I would love to book you a ticket and teach me everything you know around the topic |
19:44:28 | Araq | but the devil is in the details and it might fail for your scenario, krux02 |
19:45:35 | krux02 | Araq: well maybe there is a hybrid solution that compiles sometimes by write back on return, and sometimes just uses pointers for parameters. |
19:45:42 | Araq | krux02: yeah, "append semantics" are awesome for performance. and Nim should get a special rewrite rule to handle this better |
19:47:07 | Araq | stefanos82: lol, well I'm here. |
19:47:46 | Araq | you can ask me here, but I know everything, so that would take some time to teach you all of it. |
19:47:52 | stefanos82 | Araq: I will never stop hoping mate...one day I will make my goals reality |
19:50:08 | Araq | Quelklef: but I like the write effects. and I know where to find Haskell and if I didn't believe in them. |
19:54:16 | FromGitter | <Quelklef> Well the idea is that it'd be transparent. You'd write code as if it were procedural, not worrying about what's actually happening if it's not relevant |
19:54:47 | stefanos82 | Araq: one thing that OCaml caught my attention is how they generate optimized code which if I understood them correctly, it's an optimized C code emitted as assembly that gets compiled in a really fast way. |
19:54:49 | stefanos82 | mind blowing |
19:55:03 | stefanos82 | now about Haskell I have no idea |
19:58:05 | stefanos82 | btw, what's #nim-logos supposed to do? chat without being logged? |
19:58:24 | stefanos82 | *#nim-nologs |
19:59:52 | Araq | #nim-nologs is for our illegal activities, yes |
20:04:06 | stefanos82 | >:} |
20:12:13 | FromGitter | <codem4ster> how can I use include in nim |
20:12:48 | FromGitter | <Quelklef> `include filename` |
20:12:50 | FromGitter | <Quelklef> ... |
20:13:03 | FromGitter | <codem4ster> it seems not working |
20:13:05 | FromGitter | <Quelklef> more accurately, `include module` |
20:13:07 | FromGitter | <Quelklef> example? |
20:15:24 | FromGitter | <codem4ster> ```# main.nim β import models β β let user = User(name: "test-name")``` [https://gitter.im/nim-lang/Nim?at=5b4f9fdbecc1f82e2fc3936b] |
20:15:52 | FromGitter | <Quelklef> `User*` not `User` |
20:16:02 | FromGitter | <codem4ster> ah my bad |
20:16:04 | FromGitter | <codem4ster> sorry |
20:16:07 | FromGitter | <Quelklef> np |
20:16:23 | FromGitter | <Quelklef> Forgetting to export things trips me up fairly often as well |
20:19:03 | FromGitter | <codem4ster> I think, I get over folder structuring with include statement. Is this a good usage? |
20:19:28 | FromGitter | <Quelklef> What's wrong with just `import models/user` |
20:20:01 | FromGitter | <codem4ster> I don't want to make user a module |
20:20:30 | FromGitter | <codem4ster> because I will need controllers/user also |
20:22:54 | stefanos82 | Araq: isn't there any print operator other than stdout.write that behaves more or less like echo, but without the implicit appending of newline at the end of the string? |
20:23:07 | stefanos82 | *print statement, my apologies |
20:27:48 | * | Ven`` quit (Read error: Connection reset by peer) |
20:27:49 | * | jjido quit (Ping timeout: 260 seconds) |
20:28:24 | * | brainproxy quit (Ping timeout: 260 seconds) |
20:30:33 | * | brainproxy joined #nim |
20:31:00 | * | poopBot quit (Remote host closed the connection) |
20:31:02 | * | rockcavera quit (Remote host closed the connection) |
20:35:00 | Araq | no. and I wonder why it keeps coming up. |
20:35:49 | Araq | codem4ster: MVC is dead, got succeeded by the Elm architecture |
20:37:22 | stefanos82 | Araq: because echo appends a newline and people don't want it? Yes I know...it's easy to deal with stdout.write, but I guess it's a matter of habit to deal with print() and echo() separately |
20:38:24 | Araq | well "real" code does not contain many echo/write statements. |
20:39:27 | Araq | sometimes it's full of 'echo' behind a 'when' switch. |
20:39:46 | Araq | I've yet to see a code that is full of "write without newline" calls |
20:40:53 | stefanos82 | by the way Araq in https://nim-lang.org/docs/tut1.html#procedures-result-variable the "echos" comments should be "echoes" |
20:41:51 | stefanos82 | Araq: for example, if I ask for a user input, I wouldn't want to see my user input inserted in the next line |
20:41:59 | stefanos82 | I would like to see it in the same line as my question |
20:42:15 | Araq | that's one implementation of "prompt" then. |
20:42:37 | * | yglukhov[i] joined #nim |
20:42:53 | Araq | proc prompt(question: string): string = stdout.write(question); result = stdin.readLine() |
20:43:50 | stefanos82 | you see? that's one proc I didn't know we have...or did you just implement it on the spot for demonstrative purposes? |
20:43:50 | Araq | this way you can later even go fancy and have some IO "abstraction". who knows, maybe even give your program a UI. |
20:43:59 | Araq | the latter. |
20:44:07 | stefanos82 | that was fast lol |
20:44:09 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
20:44:42 | * | yglukhov[i] joined #nim |
20:44:52 | stefanos82 | do we have something like fmt module? |
20:45:17 | Araq | strformat |
20:45:57 | stefanos82 | yeah, just found it |
20:46:04 | stefanos82 | so fmt is a template |
20:46:05 | stefanos82 | nice |
20:46:15 | * | rockcavera joined #nim |
20:46:16 | * | rockcavera quit (Changing host) |
20:46:16 | * | rockcavera joined #nim |
20:46:37 | * | nsf quit (Quit: WeeChat 2.1) |
20:53:48 | * | Ven`` joined #nim |
20:54:23 | stefanos82 | can't we create a new project with nimble without creating the folder first? :/ |
20:59:09 | stefanos82 | also, why nimble creates only src and tests? what about bin? |
21:00:16 | * | xet7 quit (Ping timeout: 244 seconds) |
21:00:32 | FromGitter | <Bennyelg> Does someone experience this issue? β https://github.com/nim-lang/Nim/issues/8353 β because seems that I can't simulate it. |
21:00:50 | * | yglukhov[i] quit (Remote host closed the connection) |
21:01:05 | * | icebattle joined #nim |
21:01:22 | * | yglukhov[i] joined #nim |
21:04:53 | Araq | Bennyelg: maybe it's just his own branch |
21:05:15 | FromGitter | <Bennyelg> Opening bugs :| |
21:05:21 | FromGitter | <Bennyelg> close it hehe |
21:06:40 | stefanos82 | Araq: where should I open tickets for official documentation? I have found a couple of typos and deprecated code which I want to report so we won't forget about them |
21:07:14 | Araq | can't you just create a PR for them? most docs even have an "edit" button |
21:07:33 | stefanos82 | I can't find this in tut1 |
21:07:53 | Araq | well only the library docs have it |
21:08:08 | stefanos82 | OK :/ |
21:08:17 | Araq | and they are almost never used, so I don't want to spend more time on this feature. |
21:08:35 | stefanos82 | you mean people don't use Nim's tutorial? |
21:08:45 | Araq | they don't use the "edit" button |
21:08:55 | * | Ven`` quit (Quit: q+) |
21:08:57 | FromGitter | <Bennyelg> @Araq |
21:09:07 | stefanos82 | lol how can they use it if it does not exist? ^_^ |
21:09:15 | FromGitter | <Bennyelg> I modified my own branch ospath file I want to compile everything and test it |
21:09:28 | FromGitter | <Bennyelg> just ./koch ? |
21:09:43 | FromGitter | <Bennyelg> bin/nim c koch ? |
21:10:02 | * | yglukhov[i] quit (Ping timeout: 255 seconds) |
21:11:11 | Araq | koch tests |
21:11:38 | FromGitter | <Bennyelg> running now :) |
21:12:50 | * | xet7 joined #nim |
21:13:26 | * | NimBot joined #nim |
21:14:09 | FromGitter | <Bennyelg> How can I sync between my Nim fork to the origin master ? |
21:14:29 | FromGitter | <Bennyelg> I clone my fork to my mac |
21:14:47 | * | yglukhov[i] joined #nim |
21:15:51 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4fae071539a7040ce9b4d9] |
21:18:10 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4fae921539a7040ce9b62a] |
21:18:13 | FromGitter | <Bennyelg> how the hell |
21:19:40 | stefanos82 | let me find my notes Bennyelg |
21:21:35 | stefanos82 | Bennyelg: in my notes I have everything like your steps, but you didn't push your local changes to the master repo |
21:21:51 | stefanos82 | that should be your last command, git push |
21:22:00 | stefanos82 | right after git pull upstream master |
21:37:50 | stefanos82 | off-topic: any metal heads in da house? |
21:49:22 | * | jjido joined #nim |
21:55:15 | * | jjido quit (Remote host closed the connection) |
22:04:49 | * | riidom_ joined #nim |
22:06:27 | * | riidom quit (Ping timeout: 240 seconds) |
22:16:09 | FromDiscord | <treeform> For javascript backend, is there a way to like, cast js object to some thing that behave like a table? I have a js with unknown keys and I need to iterate it? |
22:19:12 | FromGitter | <rayman22201> I think this is what you want? https://nim-lang.org/docs/jsffi.html#15 |
22:19:22 | FromGitter | <rayman22201> @treeform |
22:20:18 | FromDiscord | <treeform> yeah! wow did not know about this module. And I been writing JS apps in nim for like 4 months. |
22:21:17 | FromGitter | <rayman22201> lol. Well, good news is, now you have a greater appreciation for the module after having done it the hard way :-P |
22:26:37 | FromDiscord | <treeform> true to that! |
22:27:38 | FromDiscord | <treeform> I can remove all the {.emits.} now! |
22:34:15 | Araq | watch out for the type unsafe parts of jsffi |
22:34:29 | Araq | I prefer manual wrapping even though it's more work. |
22:34:42 | Araq | so that I get the most out of Nim's type checker. |
22:43:35 | FromDiscord | <treeform> I am casting everything to string anyways |
22:44:13 | FromDiscord | <treeform> https://gist.github.com/treeform/dec0decb4e36bdaa333aed59a9ef2f88 |
22:44:42 | FromDiscord | <treeform> My problem is that keys are dynamic for this object. |
22:51:45 | * | Sembei quit (Ping timeout: 248 seconds) |
22:56:22 | * | geocar quit (Quit: Connection closed for inactivity) |
23:00:22 | * | dzho quit (Ping timeout: 264 seconds) |
23:16:47 | Araq | https://github.com/nim-lang/Nim/issues/8363 |
23:17:07 | * | rockcavera quit (Remote host closed the connection) |
23:18:43 | FromDiscord | <treeform> Araq, do you like exceptions in general? |
23:20:27 | Araq | depends on the problem domain. |
23:20:57 | * | rockcavera joined #nim |
23:21:10 | Araq | usually the designs that do without them are the better designs. |
23:22:16 | Araq | but everybody nowadays thinks it means Either or Maybe types everywhere and I hate these much more than I hate exceptions. |
23:24:56 | FromDiscord | <treeform> Exceptions is a complicated topic, there are pro and cons to them. Error handling is hard in general. |
23:25:59 | * | endragor joined #nim |
23:26:48 | FromDiscord | <treeform> Looks like people have implemented their own Either or Maybe types in nim. |
23:27:05 | FromDiscord | <treeform> I have not programed with them though. |
23:27:39 | Araq | sure, people are free to use them. I don't. |
23:28:19 | FromDiscord | <treeform> There is also the return code style, which I have done, and some sections feel like they only handle errors and its very hard to see the non error logic. |
23:30:27 | * | endragor quit (Ping timeout: 240 seconds) |
23:31:57 | Araq | usually, they don't "Handle" errors. they propagate them upwards. all the time. human compiler at work. |
23:35:07 | FromDiscord | <treeform> I think the best answer is just don't fail. Try to minimize errors. Works great with all 3 styles exceptions, returns and maybe |
23:38:17 | * | krux02 quit (Quit: Leaving) |
23:39:55 | * | xet7 quit (Quit: Leaving) |
23:44:10 | FromGitter | <rayman22201> @Araq would library authors or end users implement their own supervisor? |
23:44:44 | * | yglukhov[i] quit (Remote host closed the connection) |
23:44:45 | Araq | you can implement your own, it mostly relies on the panicHook callback. |
23:45:06 | Araq | but it's tough and there will be a single stdlib one that tries to get it right. |
23:48:03 | FromGitter | <rayman22201> got it. cool |
23:50:41 | * | xylef quit (Ping timeout: 255 seconds) |
23:50:43 | FromGitter | <rayman22201> I like the rfc. embedded friendly is good. :-D |
23:54:00 | FromGitter | <Quelklef> I question `IndexError` and perhaps even `OverflowError` being fatal |
23:54:42 | FromGitter | <Quelklef> Especially given that `KeyError` is not and (in my mind, at least) it's the sister Exception to `IndexError` |
23:55:05 | Araq | if these are not fatal, performance suffers as then every proc becomes as "Potentially raises" |
23:55:15 | FromGitter | <kayabaNerve> @Quelklef I think IndexError and KeyError both should be unless in a try-catch, no? |
23:55:46 | FromGitter | <Quelklef> @kayabaNerve If I understand the RFC correctly, you're missing the point |
23:55:52 | FromGitter | <Quelklef> @Araq because they're so common? |
23:55:58 | Araq | and not only performance, if I write .raises: [] and the compiler tells me "can raise IndexError" I throw away the compiler. |
23:56:08 | FromGitter | <Quelklef> Hahahaha |
23:56:11 | FromGitter | <Quelklef> Wait |
23:56:26 | Araq | as my array indices are correct. and if not, it should trap. |
23:56:28 | FromGitter | <Quelklef> Scratch that, I think I don't understand |
23:56:43 | Araq | IndexError is "index out of bounds" |
23:56:43 | FromGitter | <Quelklef> Come again? |
23:56:55 | FromGitter | <Quelklef> Right. Why do you say that every proc can potentially raise it? |
23:57:02 | FromGitter | <Quelklef> Just because it's common |
23:57:04 | FromGitter | <Quelklef> ? |
23:58:00 | Araq | sure. |
23:58:15 | FromGitter | <Quelklef> got it |
23:58:27 | Araq | array access is everywhere, especially in the lower level that everyybody else calls into, directly or indirectly. |