00:01:53 | skrylar | araq will probably hate it, but i have this weird module now where you can associate variables with it and it will do a toposort on those to figure out the update order and run closures when stuff changes |
00:16:23 | * | MJCaley joined #nim |
00:16:49 | * | rbrt joined #nim |
00:20:48 | Araq | skrylar, nope, I'm interested |
00:21:01 | Araq | sounds like what I built for Karax's "reactive extensions" |
00:23:37 | skrylar | spent a chunk of today working on the macro for it |
00:23:56 | skrylar | just needs the sorting chunk and it should be testable |
00:24:54 | Araq | cool, very interesting to compare it to may own dependency graph implementation |
00:25:18 | * | sendell quit (Remote host closed the connection) |
00:28:10 | skrylar | i haven't seen it |
00:28:31 | * | MJCaley quit (Quit: MJCaley) |
00:34:50 | skrylar | I will admit that I think Redbol dialects are.. nicer than macros. |
00:34:58 | skrylar | Although I think the nim compiler would have a seizure with them |
00:35:19 | skrylar | mostly because a redbol dialect just goes straight to a PEG parser, so you can have any random syntax (the token types are fixed, though :|) |
00:47:32 | * | MJCaley joined #nim |
01:07:38 | * | voidspacexyz joined #nim |
01:13:04 | * | marenz__ quit (Ping timeout: 248 seconds) |
02:34:33 | GitDisc | <treeform> I am working on font rasterizer in pure nim. I feel like I made a bunch of progress. I wanted to share. Check this out: |
02:34:36 | GitDisc | <treeform> |
02:34:36 | GitDisc | <treeform> https://cdn.discordapp.com/attachments/371759389889003532/382358106853736469/unknown.png |
02:34:55 | GitDisc | <treeform> And in real scale: |
02:34:57 | GitDisc | <treeform> |
02:34:57 | GitDisc | <treeform> https://cdn.discordapp.com/attachments/371759389889003532/382358191876472833/unknown.png |
02:35:15 | GitDisc | <treeform> Two of them are not mine, can you guss which one is mine? |
02:52:27 | * | MJCaley quit (Quit: MJCaley) |
02:53:44 | GitDisc | <treeform> mratsim, Green thread, fibres, and coroutines, are like names for the same kind of thing. They are all implemented slightly differently. Each implemination has pros/cons. |
02:53:48 | * | chemist69 quit (Ping timeout: 240 seconds) |
03:07:39 | * | chemist69 joined #nim |
03:30:25 | * | endragor joined #nim |
03:32:06 | * | rbrt quit (Quit: Oíche mhaith) |
03:41:05 | skrylar | Sort of tempted to mark that SuSE-specific bug as wontfix |
03:42:12 | skrylar | suppose that depends on if its possible to try/catch a staticexec call and use pass{c,l} from those clauses |
03:45:07 | * | kier joined #nim |
03:45:54 | * | dddddd quit (Remote host closed the connection) |
03:53:00 | * | JappleAck joined #nim |
04:24:11 | * | BitPuffin|osx joined #nim |
04:25:01 | skrylar | Araq, prepare for anneurisms: https://github.com/Skrylar/cobweb |
04:29:21 | * | JappleAck quit (Ping timeout: 248 seconds) |
04:38:19 | * | alfonso joined #nim |
04:43:26 | * | JappleAck joined #nim |
04:50:35 | FromGitter | <Varriount> treeform: The one on the bottom is yours. |
05:06:41 | * | voidspacexyz quit (Ping timeout: 248 seconds) |
05:28:42 | * | skrylar quit (Ping timeout: 260 seconds) |
05:34:56 | * | skrylar joined #nim |
05:40:17 | * | rauss quit (Ping timeout: 248 seconds) |
05:43:29 | * | skrylar quit (Ping timeout: 255 seconds) |
05:45:35 | * | skrylar joined #nim |
05:46:21 | * | voidspacexyz joined #nim |
05:49:28 | * | aa_ joined #nim |
05:49:52 | * | aa_ quit (Client Quit) |
05:54:05 | * | SenasOzys__ quit (Ping timeout: 240 seconds) |
06:38:06 | GitDisc | <treeform> Varriount, nope the one in the middle is mine. |
06:43:21 | * | nsf joined #nim |
07:47:21 | * | dexterk_ joined #nim |
07:47:52 | * | dexterk quit (Ping timeout: 252 seconds) |
07:59:29 | FromGitter | <Varriount> treeform: You're doing really well then, that |
08:03:39 | FromGitter | <Varriount> treeform: How complex is the code? |
08:08:55 | * | Vladar joined #nim |
08:24:43 | * | xkapastel quit (Quit: Connection closed for inactivity) |
08:29:35 | * | claudiuinberlin joined #nim |
08:39:39 | skrylar | well that was fun |
08:40:05 | skrylar | using elisp to convert the foo(): status forms to procs that hceck for errors and raise |
08:40:46 | skrylar | although in retrospect i suppose a macro could have done that and been passed as a pragma :ponders: |
08:48:33 | * | Vladar quit (Ping timeout: 248 seconds) |
08:56:16 | skrylar | ok. firebird wrapper updated to use exceptions |
09:12:20 | * | Arrrr joined #nim |
09:22:08 | * | Shoozza quit (Ping timeout: 252 seconds) |
09:22:08 | * | Shoozza joined #nim |
09:24:07 | Araq | skrylar: https://github.com/pragmagic/karax/blob/master/karax/reactive.nim |
10:03:26 | FromGitter | <mratsim> Free compiler courses at Stanford: from HN comments apparently it's good: https://lagunita.stanford.edu/courses/Engineering/Compilers/Fall2014/about |
10:07:21 | crem | Most compiler courses I saw for some reason spend 90% of time in parsing part and 10% in code generation. |
10:09:37 | crem | At the university I had 100% parsing course, I guess. |
10:26:08 | * | BitPuffin|osx quit (Ping timeout: 248 seconds) |
10:30:00 | * | skrylar quit (Remote host closed the connection) |
10:31:06 | Araq | I fail to see how Java or C++ could be good languages for compiler development, they should have picked an ML variant |
10:33:55 | Araq | this has come up before and even the Scala inventor eventually admitted that sum types are far superior to build a compiler with than any kind of inheritance model plus a visitor pattern |
10:35:26 | * | arnetheduck joined #nim |
10:37:49 | * | floppydh joined #nim |
10:38:28 | * | gangstacat quit (Quit: Ĝis!) |
11:06:15 | FromGitter | <mratsim> Everytime I see "pattern" I read "workaround for language lack of something" |
11:07:02 | FromGitter | <alehander42> |
11:13:34 | * | Vladar joined #nim |
11:30:15 | * | voidspacexyz quit (Ping timeout: 250 seconds) |
11:33:48 | * | jrp93 joined #nim |
11:33:51 | * | jrp93 left #nim ("Leaving") |
11:37:53 | * | gangstacat joined #nim |
11:39:40 | * | dddddd joined #nim |
12:27:55 | FromGitter | <mratsim> Is there a way to make the {.shallow.} ptragma work without wrapping another type? ⏎ ⏎ ```type COWobject[T] = object ⏎ metadata: int ⏎ data {.shallow.} : seq[T]``` [https://gitter.im/nim-lang/Nim?at=5a141bca540c78242d2e7763] |
12:30:03 | Araq | mratsim: nope |
12:34:28 | FromGitter | <mratsim> okay |
12:35:58 | * | alfonso quit (Quit: Page closed) |
12:50:57 | * | sendell joined #nim |
13:03:11 | * | sendell quit (Remote host closed the connection) |
13:05:27 | * | ryanhowe quit (Quit: WeeChat 1.4) |
13:05:53 | * | ryanhowe joined #nim |
13:35:05 | FromGitter | <kinokasai> Hey, I've got a problem, where the TypeMismatchError's got and expected are the same to me |
13:35:08 | FromGitter | <kinokasai> https://play.nim-lang.org/?gist=aa7481459a8afdb1249fb8b8c8b70d40 |
13:35:34 | FromGitter | <kinokasai> (It involves seqs of seqs) |
13:36:26 | FromGitter | <kinokasai> Would someone be so kind as to explain why this is an error ? c: |
13:36:58 | Araq | var seq[seq[int]] # invalid type within an object |
13:37:08 | Araq | the compiler should catch that but doesn't (yay) |
13:37:36 | FromGitter | <kinokasai> Hm. |
13:37:49 | FromGitter | <kinokasai> How could I fix my code? |
13:39:20 | Araq | https://play.nim-lang.org/?gist=bf3e5bd346b127dcebd0890ef1bd5ae0 |
13:42:03 | FromGitter | <kinokasai> Oh man I'm dumb |
13:42:08 | FromGitter | <kinokasai> Thanks a lot. |
13:42:35 | crem | Hm, nimbook says that "break blockname" breaks out of all loops within a block, but that's not what it seems to do. |
13:45:58 | Araq | well it breaks out of the block named "blockname" |
13:46:28 | * | endragor quit (Remote host closed the connection) |
13:46:57 | * | endragor joined #nim |
13:47:11 | * | fvs joined #nim |
13:48:19 | crem | Yes, it doesn't have to do with loops at all. But it sounded like if there is something in the block after the outer loop, it would be executed. And also it's not clear whether code inside outer loop just after inner loop was supposed to execute too. |
13:49:00 | crem | Anyway, after reading but before checking with actual code, I supposed that it works differently. |
13:49:23 | * | endragor_ joined #nim |
13:51:27 | * | endragor quit (Ping timeout: 248 seconds) |
13:52:39 | * | voidspacexyz joined #nim |
13:53:37 | * | voidspacexyz quit (Remote host closed the connection) |
13:53:41 | * | endragor_ quit (Ping timeout: 250 seconds) |
14:03:24 | * | endragor joined #nim |
14:03:25 | * | endragor quit (Remote host closed the connection) |
14:11:05 | * | dddddd quit (Ping timeout: 240 seconds) |
14:11:38 | * | endragor joined #nim |
14:12:43 | Arrrr | is like the block was a proc and you are returning |
14:13:53 | crem | Yes, I understand now, it's a jump to the end of the block. It's just that I originally understood it wrong when reading the book. |
14:22:38 | * | BitPuffin|osx joined #nim |
14:36:54 | * | Guest33 joined #nim |
14:36:58 | Guest33 | Hello |
14:38:19 | Guest33 | If I want to build a REST API with `asyncHTTPserver` and `asyncpg`, do I also need `asyncdispatch` and `asyncnet` ? |
14:48:51 | Araq | hello troll. you need 'asyncdispatch' too. |
15:00:23 | Guest33 | im not a troll |
15:00:33 | Guest33 | im using kiwiirc as a guest |
15:01:17 | Guest33 | Araq I only need asyncdispatch or asyncnet also? |
15:01:45 | Araq | the compiler will tell you |
15:02:45 | * | SenasOzys__ joined #nim |
15:03:02 | Guest33 | alright |
15:03:32 | * | Guest33 left #nim (#nim) |
15:03:44 | * | MJCaley joined #nim |
15:10:32 | * | elrood joined #nim |
15:11:46 | * | BitPuffin|osx quit (Ping timeout: 264 seconds) |
15:14:04 | * | rauss joined #nim |
15:15:13 | * | xkapastel joined #nim |
15:17:27 | * | arecaceae quit (Remote host closed the connection) |
15:17:45 | * | arecaceae joined #nim |
15:23:21 | FromGitter | <mratsim> @Araq there is no way currently to check if a return value will be used in a `let` assignment, `var` assignment or a function call right? |
15:23:44 | GitDisc | <treeform> Varriount, It's not too bad. The code is not very complex, but it feels like I fight for every line. Go back and forth a ton. |
15:24:34 | Araq | mratsim: TR macro? |
15:27:44 | FromGitter | <mratsim> Oh mmm we can use let and var constraints in TR macro? Have to check that would solve my copy on write issue without needing assignment overloading. |
15:29:26 | * | miran quit (Quit: Page closed) |
15:30:09 | Araq | told you before, you can't move into a 'let' |
15:30:26 | Araq | you can only move the last usage |
15:30:38 | Araq | yes, the compiler does it wrong too. |
15:30:48 | Araq | that's not a reason to copy this behaviour |
15:36:55 | * | laas joined #nim |
15:39:37 | FromGitter | <mratsim> If I have `let a = someCostlyObject` and `let b = a` I want both to refer to the same memory location. The expected design is here: https://github.com/mratsim/Arraymancer/issues/157. The reason why is that I expect Tensors to be in the 10+MB to a few GBs in size and memory is scarce and costly. If it's for immutable variables no need to copy it. |
15:40:00 | * | endragor quit (Remote host closed the connection) |
15:40:33 | * | endragor joined #nim |
15:42:32 | laas | Araq: I didn't make a gist, but I made a hastebin: https://hastebin.com/icipunotug.cs |
15:42:38 | laas | My problem: |
15:42:49 | laas | first set of templates don't work, due to a mysterious error about unknown type, while the second ones do |
15:43:05 | FromGitter | <mratsim> Since there is a GC, I won't have the ownership issue / who destroys the object as in C++ / Rust. |
15:43:41 | FromGitter | <alehander42> how can I interpolate into string in a template ? |
15:44:04 | FromGitter | <alehander42> eg `template a(s: string) = "12"`s`""` |
15:44:29 | Araq | mratsim: yes, but you can't just break the language 'var x = y' making a copy and 'let x = y' not making a copy. if you want to avoid copies, use 'ref T' |
15:45:32 | * | endragor quit (Ping timeout: 268 seconds) |
15:49:46 | FromGitter | <mratsim> The issue is that Tensors have metadata (always copied) and data (ideally copy-on-write). And the special behaviour is only for a specific type, I don't change string/seqs. |
15:51:24 | FromGitter | <mratsim> I have the opposite issue with Cuda (and in the future OpenCL) pointers. On let assignment, it's shallow, on var assignment it's also shallow (but I want deep copy) |
15:53:10 | FromGitter | <mratsim> In any case assignment overloading is not working so what I can do now is via TR macros detect if parameters are `let` and/or `var` and call the appropriate version. |
15:53:31 | FromGitter | <andreaferretti> @mratsim I would not do anything too clever |
15:53:37 | FromGitter | <mratsim> Of each of my procs (slice, reshape, etc) |
15:53:52 | FromGitter | <andreaferretti> I think whatever behaviour you choose will turn out ot be surprising in some case |
15:54:01 | FromGitter | <andreaferretti> I'd stick with using ref types |
15:54:12 | FromGitter | <andreaferretti> and explicit cloning when needed |
15:57:45 | FromGitter | <mratsim> @andreaferretti it may be what happens in the end but "let -> shallow" and "var -> deep" is simple, that's what Matlab and R are doing while Python and Julia choose reference semantics. It's even better in Nim because there is the `let` vs `var` distinction. |
16:00:51 | FromGitter | <andreaferretti> I think this would be confusing in the common case where you want to share AND modify something |
16:01:04 | FromGitter | <andreaferretti> like the weights in a RNN |
16:01:10 | FromGitter | <andreaferretti> you want them to be shared |
16:01:18 | FromGitter | <andreaferretti> but also to train them |
16:01:36 | FromGitter | <andreaferretti> I would assume that to have something modifiable I should use a var |
16:01:54 | FromGitter | <andreaferretti> with your design, I would get no sharing inadvertently |
16:03:57 | * | floppydh quit (Quit: WeeChat 1.9.1) |
16:04:11 | * | rbrt joined #nim |
16:05:12 | FromGitter | <mratsim> There is explicit opt-in: `var weight2 = weight1.unsafeView` |
16:06:22 | * | PMunch joined #nim |
16:07:02 | FromGitter | <andreaferretti> ah ok |
16:07:13 | FromGitter | <andreaferretti> I prefer explicit cloning, but that's fine |
16:07:18 | FromGitter | <mratsim> Basically it's a choice between safe by default (copy) and littering the code with "unsafeSlice, unsafeView, unsafeReshape" or being unsafe by default (ref) but having to clone explicitly and also make it harder to debug unexpected mutation. |
16:07:38 | FromGitter | <andreaferretti> yup |
16:07:45 | FromGitter | <mratsim> I'm greedy and I want both ;) |
16:09:14 | FromGitter | <mratsim> i.e. when there is no mutation involved it's fine to have ref semantics. |
16:19:33 | * | rbrt quit (Quit: Oíche mhaith) |
16:23:24 | * | rbrt joined #nim |
16:23:30 | * | gangstacat quit (Quit: Ĝis!) |
16:26:36 | * | gangstacat joined #nim |
16:31:02 | FromGitter | <mratsim> I have found this very relevant thread with a macro that warns about implicit copy. Oh oh a new toy to play with: https://forum.nim-lang.org/t/2480 |
16:33:14 | * | SenasOzys__ quit (Remote host closed the connection) |
16:35:25 | * | miran joined #nim |
16:49:22 | * | PMunch quit (Remote host closed the connection) |
16:51:07 | * | salewski joined #nim |
16:53:14 | salewski | I still have the feeling that Ruby's notation for this statement is better: |
16:53:18 | salewski | w = true if a = 1 and b > 0 |
16:53:53 | salewski | It is only one line, and what happens is at the beginning. |
16:54:22 | salewski | But I assume there is no macro solution in Nim to aloow this notation. |
16:55:22 | salewski | Oh, typo: w = true if a == 1 and b > 0 |
16:59:11 | * | claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com) |
16:59:42 | * | salewski quit (Quit: WeeChat 1.9.1) |
17:00:16 | FromGitter | <andreaferretti> else? |
17:00:32 | FromGitter | <andreaferretti> withouth an else this does not really make sense |
17:00:50 | FromGitter | <andreaferretti> and if you add an else, what happens is not at the beginning any more |
17:01:39 | miran | and then it exists `w = if a==1: true else: false` |
17:02:31 | * | salewski joined #nim |
17:03:08 | salewski | Well, I have used that Ruby notation without an else always. |
17:04:34 | salewski | I can not remember if an else would be allowed at all in Ruby for that notation -- I guess not. |
17:05:20 | * | MJCaley quit (Quit: MJCaley) |
17:05:34 | * | Jesin joined #nim |
17:05:35 | salewski | Ruby has also unless instead of "if not" which is also nice, but does not allow an else. |
17:07:29 | salewski | miran, I think your suggestion is not really easy to read. |
17:07:43 | miran | it is not my suggestion, that's how nim does it :) |
17:08:12 | miran | but i agree it is not the easiest thing to read |
17:08:39 | * | jsgrant quit (Read error: Connection reset by peer) |
17:09:38 | * | jsgrant joined #nim |
17:10:04 | salewski | if a == 1 and b > 0: |
17:10:11 | salewski | w = true |
17:10:33 | salewski | is really not bad, but consumes two lines. |
17:11:02 | miran | well, you can put the second line after :, making it one-liner :) |
17:11:26 | * | TjYoco joined #nim |
17:12:17 | salewski | Yes, but then what happens is not at the beginning. I did that in my early Nim days, but later slipt it alsways to two lines. |
17:12:26 | * | MJCaley joined #nim |
17:12:41 | salewski | if a == 1 and b > 0: w = true |
17:13:32 | salewski | OK, not that important. Bye. |
17:18:17 | * | TjYoco quit (Ping timeout: 255 seconds) |
17:19:33 | * | Trustable joined #nim |
17:19:51 | Araq | Nim's way of doing if expressions is superior because it uses the same syntax for statements and expressions. in fact, the distinction between statements and expression belong to the 90ies, we learned a bit about language design since then |
17:29:59 | FromGitter | <andreaferretti> I agree |
17:30:09 | FromGitter | <andreaferretti> I have never used an if expression without an else |
17:30:18 | FromGitter | <andreaferretti> I don't even know what that would mean |
17:30:32 | FromGitter | <andreaferretti> what gets assigned to the value in the else case |
17:30:33 | FromGitter | <andreaferretti> ? |
17:32:28 | * | TjYoco joined #nim |
17:33:35 | salewski | andreaferretti my uses cases are where a variable has an value, and I have to change it under a condition. |
17:33:56 | salewski | I am using a lot if's without else. |
17:41:04 | subsetpark | i gotta say, 'unless' is the insanest keyword i've ever used |
17:41:49 | FromGitter | <andreaferretti> uh that looks super weird to me |
17:42:00 | FromGitter | <andreaferretti> for me an if expression is a value |
17:42:16 | FromGitter | <andreaferretti> whatever is to the right of `=` has a value BEFORE being assigned |
17:42:25 | FromGitter | <andreaferretti> and you assign this value to the left hand side |
17:42:46 | FromGitter | <andreaferretti> if I want to change it, I would use an if statement |
17:43:08 | FromGitter | <andreaferretti> ```if whatever: ⏎ a = b``` [https://gitter.im/nim-lang/Nim?at=5a1465ab614889d475ab36c0] |
17:43:46 | FromGitter | <andreaferretti> but if I use an if expression, that has to be a value |
17:44:02 | FromGitter | <andreaferretti> I wouldn't use an if expression for side effects |
17:44:36 | subsetpark | but for these examples, you can also just say `w = a == 1 and b > 0` |
17:45:47 | FromGitter | <techate> it isn't an 'if expression'. it's a conditional statement. it's not just for assignment. it reads 'doThis if test', or 'doThis unless test'. |
17:45:47 | * | cspar_ quit (Ping timeout: 268 seconds) |
17:46:12 | FromGitter | <andreaferretti> I understand |
17:46:16 | FromGitter | <andreaferretti> but reading |
17:46:32 | FromGitter | <andreaferretti> ```a = 1 if something``` |
17:46:37 | FromGitter | <andreaferretti> I understand |
17:46:50 | FromGitter | <andreaferretti> ```a = (1 if something)``` |
17:47:02 | FromGitter | <techate> and that isn't what he's talking about. |
17:47:04 | FromGitter | <andreaferretti> which does not really make sense |
17:47:12 | FromGitter | <andreaferretti> yeah, I get it |
17:47:17 | FromGitter | <techate> you keep saying that. |
17:47:24 | FromGitter | <andreaferretti> but still I find the notation completely innatural |
17:47:32 | FromGitter | <andreaferretti> it reads like an if expression |
17:47:34 | FromGitter | <andreaferretti> but it isn't |
17:47:44 | FromGitter | <andreaferretti> it is some sort of inverted control flow |
17:47:51 | FromGitter | <mratsim> You’re mixing statements and expression salewski, basically you want to declare the statement after the modification, right? |
17:48:09 | FromGitter | <techate> it's similar to a thing in Nim. but it, itself, is not in Nim. so that's a source of confusion. this would be an argument against including it in Nim. |
17:48:11 | FromGitter | <andreaferretti> I was just pointing out that what looks natural to someone looks horrifying to other people |
17:48:12 | FromGitter | <mratsim> I prefer to have the condition before. |
17:48:42 | FromGitter | <techate> yes, people with one set of goggles see things differently than other people with other goggles. |
17:49:56 | salewski | andreaferretti: Indeed it is some sort of inverted control flow |
17:50:05 | FromGitter | <techate> anyway, the guy with Ruby goggles like them because there's a leading statement and then whether that statement happens is somewhat deemphasized. |
17:50:31 | salewski | Can be confusing at first, but it is used a lot in Ruby. |
17:50:46 | FromGitter | <techate> I think you could imitate that by putting the statement in a proc, but that it's not worth it. |
17:51:05 | FromGitter | <andreaferretti> The reason I find it confusing is... well, it looks like you are testing the thing too late |
17:51:16 | FromGitter | <andreaferretti> `dropBomb if isEnemy` |
17:51:19 | FromGitter | <andreaferretti> ops |
17:51:25 | FromGitter | <andreaferretti> the bomb is already dropped |
17:52:03 | FromGitter | <andreaferretti> Anyway, gotta go, bye! |
17:52:51 | salewski | Yes, but the fact that the action is at the beginning can sometimes really help reading the code. Not always. |
17:52:55 | FromGitter | <mratsim> “It breaks the law of causality” :P |
17:53:14 | FromGitter | <techate> these kinds of complaints require you to forget that the complaint is expressed in English. |
17:53:33 | * | fvs left #nim ("ERC (IRC client for Emacs 25.3.1)") |
17:53:42 | * | claudiuinberlin joined #nim |
17:56:35 | * | acidx quit (Ping timeout: 240 seconds) |
17:57:49 | salewski | "goToWork unless itIsSunday" vs "if not sunday: goToWork" |
17:58:13 | salewski | Bye. |
17:58:22 | * | nsf quit (Quit: WeeChat 1.9.1) |
17:59:57 | * | salewski quit (Quit: WeeChat 1.9.1) |
18:01:14 | subsetpark | Those types of formulations drive me as crazy in English as in programming: "Ok, take the first door on your right - (uh huh, done) - unless the light is on. Then take the second door on the left!" (dammit!) |
18:02:30 | federico3 | subsetpark: usually the "unless" is 3 paragraphs below |
18:03:07 | subsetpark | It seems that we are discovering that "unless" should be banished from all language, not just Ruby |
18:04:02 | federico3 | banished from on-call runbooks probably |
18:06:09 | * | jjido joined #nim |
18:08:04 | * | MJCaley quit (Quit: MJCaley) |
18:19:48 | * | SenasOzys joined #nim |
18:21:12 | crem | I'm confused about what "0123456789"[2..<4] means. Nimbook suggests it should be "23456" (from 2nd till 4th from the end), but in reality it is "23" (from 2nd till 4-1=3rd) |
18:21:42 | miran | are you sure it is <4 and not ^4? |
18:22:02 | crem | Ah! wow! Yes, I confused it! |
18:22:09 | crem | Amazing. |
18:22:47 | crem | I checked like 3 times with the book and didn't notice I typed it wrong. |
18:25:02 | * | xkapastel quit (Quit: Connection closed for inactivity) |
18:27:35 | * | Arrrr quit (Read error: Connection reset by peer) |
18:30:36 | * | gangstacat quit (Quit: Ĝis!) |
18:33:57 | * | gangstacat joined #nim |
18:41:34 | * | TjYoco quit (Quit: Leaving) |
19:02:24 | * | JappleAck quit (Quit: Leaving) |
19:03:01 | * | d10n-work joined #nim |
19:14:41 | * | MonsterAbyss quit (Ping timeout: 248 seconds) |
19:17:13 | * | MonsterAbyss joined #nim |
19:18:12 | * | jjido quit (Remote host closed the connection) |
19:19:22 | * | jjido joined #nim |
19:22:10 | * | cspar joined #nim |
19:26:52 | FromGitter | <zetashift> @mratsim think I could follow along instead using Nim? I got some free time soon and get better with programming & Nim |
19:29:13 | * | dddddd joined #nim |
19:37:08 | federico3 | !eval var q = @["", "foo", "bar"]; q.del(0); echo q |
19:37:11 | NimBot | @[bar, foo] |
19:39:22 | FromGitter | <matrixbot> `pqflx3` !eval var q = @["", "foo", "bar"]; q.delete(0); echo q |
19:40:16 | FromGitter | <kayabaNerve> !eval echo("test"[0]) |
19:40:17 | * | Trustable quit (Remote host closed the connection) |
19:40:18 | NimBot | t |
19:44:06 | Araq | should we deprecate 'del' and name it something else? |
19:44:14 | federico3 | yep |
19:44:39 | Araq | replaceByLast ? |
19:44:43 | federico3 | I just saw the doc: deletes the item at index i by putting x[high(x)] into position i - the name is misleading indeed |
19:44:50 | Araq | s.replaceByLast(i) |
19:45:35 | federico3 | is that even useful? |
19:45:52 | Araq | huh? I use it all the time when performance is critial |
19:46:12 | Araq | O(1) deletion that is even possible when iterating over the data structure |
19:46:23 | Araq | very useful in Nim's GC |
19:47:14 | federico3 | yes, I'm looking at the implementation - it's the only O(1), and replacing it with a s.replaceWith(x, y) would not be the same) |
19:47:57 | dom96 | huh? |
19:47:58 | dom96 | why? |
19:49:03 | Araq | delUnordered() ? |
19:49:09 | dom96 | Why do you want to deprecate it? |
19:49:27 | Araq | dom96, in order to rename it |
19:49:59 | Araq | but hash tables also use 'del', 'del' is Nim's unordered delete |
19:50:01 | dom96 | ... |
19:50:07 | dom96 | Why do you want to rename it then, omg |
19:50:19 | Araq | dom96, it's error prone for federico3 |
19:50:42 | Araq | but I think 'del' is fine and you need to learn more Nim :P |
19:50:47 | federico3 | it's not even a "delete" in the first place |
19:50:50 | dom96 | context please |
19:50:56 | Araq | it is! |
19:51:05 | Araq | it is a delete, what else |
19:51:25 | Araq | dom96, context: system.del vs system.delete |
19:51:43 | dom96 | *facepalm* |
19:51:47 | federico3 | replace position x with position s.high and delete the last element |
19:51:58 | dom96 | Presumably federico3's issue is described on Github? |
19:52:06 | dom96 | can you link me there? |
19:52:17 | Araq | no, it's "swap position x with s.high and delete s.high" |
19:52:29 | dom96 | I don't see anything in the chat, you just started randomly talking about this. |
19:52:33 | federico3 | that's my point |
19:52:36 | dom96 | So I assume there was some discussion somewhere else? |
19:52:42 | Araq | "effectively deleting x" |
19:52:53 | federico3 | dom96: this: |
19:52:55 | Araq | dom96, the context is federico3's NimBot example |
19:52:55 | federico3 | !eval var q = @["", "foo", "bar"]; q.del(0); echo q |
19:52:58 | NimBot | @[bar, foo] |
19:53:21 | dom96 | I see |
19:54:11 | federico3 | it's just unexpected, given the name "del". I can live with it but I guess it will be surprising to people |
19:56:02 | Araq | https://unix.stackexchange.com/questions/405783/why-does-man-print-gimme-gimme-gimme-at-0030 |
19:56:18 | dom96 | Well, FWIW I like this name. |
19:56:32 | dom96 | And I have a feeling my book describes this difference |
19:56:32 | Araq | I can't come up with a better name and it's consistent with hash tables |
19:56:53 | Araq | sometimes you simply have to read the docs, it sucks, I know |
19:57:08 | federico3 | it does |
19:59:05 | FromGitter | <mratsim> I got tripped by del this weekend too ;) |
19:59:14 | * | jjido quit (Read error: Connection reset by peer) |
19:59:17 | FromGitter | <mratsim> @zetashift follow along? |
20:01:44 | * | rbrt quit (Quit: Oíche mhaith) |
20:02:24 | Araq | dom96, can I rename "showstopper" to "upcoming release" |
20:02:49 | Araq | it sounds better and I'd like to use it for release planning |
20:03:46 | dom96 | you should use milestones for release planning |
20:04:00 | Araq | that didn't work well the last time |
20:04:32 | Araq | tags seem more useful, they automatically move to the "Next release" target |
20:06:33 | * | jjido joined #nim |
20:11:20 | * | rbrt joined #nim |
20:12:26 | dom96 | I do like the current name, but do whatever you wish |
20:12:40 | * | SenasOzys quit (Remote host closed the connection) |
20:12:46 | * | SenasOzys_ joined #nim |
20:16:22 | Araq | well alternatively I can simply introduce a new tag |
20:18:55 | * | jjido quit (Read error: Connection reset by peer) |
20:20:47 | * | arnetheduck quit (Remote host closed the connection) |
20:23:16 | * | jjido joined #nim |
20:26:21 | * | couven92 joined #nim |
20:27:55 | * | jjido quit (Read error: Connection reset by peer) |
21:02:55 | crem | There's no way to ensure that string function parameter will be non-nil, is there? |
21:16:41 | * | laas quit (Ping timeout: 268 seconds) |
21:16:54 | * | ryanhowe quit (Quit: WeeChat 1.4) |
21:19:23 | * | PMunch joined #nim |
21:24:46 | * | vivus joined #nim |
21:26:54 | * | miran quit (Quit: Konversation terminated!) |
21:28:09 | crem | why is there `nim doc` and `nim doc2`? Which to use? |
21:28:31 | dom96 | the second one |
21:28:31 | vivus | crem: whatever is on the sites main page |
21:28:42 | dom96 | they work slightly differently |
21:28:52 | * | vlad1777d joined #nim |
21:29:25 | crem | The only difference I noticed so far is missing * on exported symbols. |
21:30:05 | GitDisc | <treeform> I think i tried doc2 but it does not go down `includes` like doc does, so i stuck with doc. |
21:31:35 | * | Vladar quit (Quit: Leaving) |
21:35:26 | crem | Hm, why it included all fields of a type (object) in the doc. I thought it would only include exported fields. |
21:40:27 | * | vlad1777d quit (Ping timeout: 240 seconds) |
21:49:07 | * | vlad1777d joined #nim |
22:00:39 | FromGitter | <Varriount> Araq: What would the Nim compiler print at midnight? :P |
22:03:29 | * | nsf joined #nim |
22:03:38 | federico3 | helpful and detailed error messages :P |
22:15:00 | * | sendell joined #nim |
22:18:18 | * | marenz joined #nim |
22:25:19 | * | gangstacat quit (Quit: Ĝis!) |
22:26:50 | PMunch | Seeing how this: https://www.reddit.com/r/nim/comments/7dm3le/tutorial_for_types_having_a_hard_time/ got some attention over on Reddit I'm considering writing it up as a proper tutorial format with illustration images and such. Could some one fact check my information there? It's mostly based on my current information about how Nim works, which may or may not be correct :P |
22:29:16 | vivus | PMunch: where is your tutorial link? |
22:29:54 | sendell | i might be interested in reading it. still not 100% sure about seq/string semantics |
22:41:27 | Araq | Varriount: guess what.... "must ... destroy ... unix..." |
22:42:10 | Araq | crem, in 'devel' there is only 'nim doc' |
22:42:33 | Araq | so that's what you should use (in former versions that was 'nim doc2') |
22:45:12 | PMunch | vivus, sendell, haven't written an actual tutorial for it, just that long Reddit comment :P |
22:46:05 | PMunch | sendell, it doesn't really touch that much on seq/string semantics either. That's something I should include if I decide to write a full tutorial |
22:47:59 | crem | Function names are recommended to start from a lowercase letter, right? |
22:48:20 | sendell | something i'm also wondering is how to get a temporary ptr on a fetched value object, if var/let copies them on assigment |
22:48:20 | crem | s/from/with |
22:48:25 | PMunch | Yeah, think so |
22:48:39 | sendell | is it idiomatic to use a "ptr T" variable for such stuff? |
22:49:09 | vivus | no more pointers in nim |
22:49:09 | PMunch | No, ptr is pretty much only used for C binding- |
22:49:31 | PMunch | A ref though can be used |
22:50:09 | sendell | yeah but let's say i have a map of owned objects (not ref objects) |
22:50:25 | * | claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com) |
22:50:48 | sendell | and i want to query it once, then work on it, and it's "safe" since i know i wont touch the map for the time i use it |
22:51:01 | Araq | sendell: use addr/unsafeAddr |
22:51:11 | Araq | to get a "view" on things |
22:51:53 | sendell | "let temp: ptr T" then? |
22:52:04 | Araq | and watch my video about "pointer free programming" that shows how you can model Rust-like "borrowed pointers"... err |
22:52:29 | Araq | that's the type yeah, but usually you can let the compiler infer it |
22:53:16 | sendell | so in that case i guess using ptr (outside of C interfacing) is supposed idiomatic here? |
22:53:30 | sendell | i'll look at the video :) |
22:53:32 | * | PMunch quit (Quit: Leaving) |
22:54:09 | Araq | it doesn't come up often but it's also not sanctioned |
22:54:30 | Araq | it can cause problems with the JS backend though, but simple usages should be fine |
22:55:12 | sendell | why so? |
22:56:09 | Araq | because it's really hard to map to JS |
22:56:22 | Araq | there might be bugs left :-) |
22:56:30 | sendell | i was supposing that ref & ptr were kind of the same thing on js target but never really looked at the generated code until then |
22:56:32 | sendell | hehe ok |
22:56:44 | Araq | they are not |
22:56:51 | sendell | until now* |
22:56:58 | Araq | ref object is mapped to idiomatic JS |
22:57:02 | sendell | yeah |
22:57:08 | Araq | ptr is mapped to an (owner, index) pair |
22:57:09 | sendell | wat about values? |
22:57:31 | Araq | values are mapped to JS objects and copied around |
22:58:02 | sendell | ok as I expected more or less :) |
22:58:30 | sendell | and i guess argument and return values are optimized as for C |
22:58:49 | sendell | i mean avoiding copies when not necessary |
22:59:40 | Araq | yes, argument passing is either const& T or T in C++ speak |
22:59:59 | Araq | depending on the size of T and whether its a blob or not |
23:01:25 | * | elrood quit (Quit: Leaving) |
23:02:53 | * | nsf quit (Quit: WeeChat 1.9.1) |
23:04:28 | sendell | perfect as it's what you end up doing by hand 99% of the time in C++. I found your blog post about "pointer free programming" but no video |
23:18:45 | FromGitter | <nitely> `nim doc2 --help` shows `nim --help` is this a bug? |
23:20:04 | * | MJCaley joined #nim |
23:20:44 | Araq | no. :-) |
23:21:12 | FromGitter | <nitely> mmh then how do I see doc2 params? |
23:21:53 | Araq | https://nim-lang.org/docs/docgen.html |
23:24:32 | FromGitter | <nitely> friction |
23:24:45 | Araq | buzzwords |
23:25:11 | FromGitter | <nitely> context switching |
23:25:19 | FromGitter | <nitely> moar buzzwords |
23:26:00 | FromGitter | <nitely> seriously, I knew about the docs, but I wanted to check from command line |
23:26:19 | FromGitter | <nitely> but if works as intended then ok |
23:28:36 | * | sendell quit (Remote host closed the connection) |
23:29:29 | * | sendell joined #nim |
23:32:40 | * | sendell quit (Remote host closed the connection) |
23:35:24 | * | MJCaley quit (Quit: MJCaley) |
23:36:35 | * | astronav_ joined #nim |
23:39:15 | * | astronav_ quit (Remote host closed the connection) |
23:46:17 | * | rbrt quit (Quit: Oíche mhaith) |
23:50:50 | * | MJCaley joined #nim |