00:07:40 | * | koranza quit (Remote host closed the connection) |
00:09:34 | rayman22201 | Python dictionarys work exactly the same way. You can replicate dom's example almost exactly in python. |
00:10:08 | rayman22201 | I don't think this is a real problem, it's just people on the "immutablity / fp hype train" honestly... |
00:10:51 | rayman22201 | https://stackoverflow.com/a/4348303 |
00:13:18 | * | zyklon joined #nim |
00:21:00 | FromGitter | <Banashek> Hey all. Kicking the tires on nim. Is compile time regex allowed? I seem to get errors when trying and figured I'd ask here. |
00:28:56 | shashlick | use the regex package - nimble install regex |
00:37:12 | * | theelous3 joined #nim |
00:39:51 | FromGitter | <Banashek> I'll give that a shot |
00:44:21 | FromGitter | <Banashek> FYI the RegexMatches page linked in the docs (https://nitely.github.io/nim-regex/regex.html#RegexMatch) 404s |
00:44:37 | FromGitter | <Banashek> Looking at the tests atm to try and see what the usage is supposed to look like |
00:46:45 | rayman22201 | link is broken, but this should be better: https://nitely.github.io/nim-regex/#RegexMatch |
00:49:37 | FromGitter | <kaushalmodi> @Banashek here's a really basic usage: https://scripter.co/notes/nim/#regex-lib |
00:53:51 | FromGitter | <Banashek> Thanks! I've been checking the src docs for usage. Trying to get a couple of capture groups into a record. Looks like something along the lines of : ⏎ ⏎ 1) `match` passing in an out var to store the match (wonder why this is instead of just returning a match object. Could be less overhead in loops?) ⏎ 2) Iterate over the `groups` in the returned match object, using the bounds (groups is a sequence of bounds) to |
00:53:51 | FromGitter | ... slice into the original string [https://gitter.im/nim-lang/Nim?at=5c36979f9289cc7aa74b8b05] |
00:58:39 | * | oculux quit (Quit: blah) |
00:58:57 | * | oculux joined #nim |
01:14:09 | * | xet7 quit (Quit: Leaving) |
01:14:11 | * | shashlick quit (Remote host closed the connection) |
01:14:32 | * | shashlick joined #nim |
01:15:33 | * | zachk quit (Quit: Leaving) |
01:18:49 | oculux | test message |
01:24:53 | * | wildlander quit (Quit: Konversation terminated!) |
01:39:01 | * | theelous3 quit (Ping timeout: 246 seconds) |
01:40:22 | * | leorize quit (Quit: WeeChat 2.3) |
01:44:24 | * | theelous3 joined #nim |
01:49:52 | * | sagax quit (Quit: Konversation terminated!) |
01:54:07 | * | cspar joined #nim |
02:05:37 | * | Tyresc quit (Quit: WeeChat 2.4-dev) |
02:13:13 | FromDiscord_ | <palagno-danil> Sex Dating > http://discord.amazingsexdating.com |
02:14:01 | * | Ven`` quit (Ping timeout: 246 seconds) |
02:14:45 | * | leorize joined #nim |
02:27:07 | * | ng0_ joined #nim |
02:29:33 | * | ng0 quit (Ping timeout: 256 seconds) |
02:31:30 | * | dddddd quit (Remote host closed the connection) |
02:45:00 | FromDiscord_ | <Obstinate> If I have a type alias like |
02:45:10 | FromDiscord_ | <Obstinate> type MySeq = seq[int] |
02:45:20 | FromDiscord_ | <Obstinate> How do I use a function like newSeq with this? |
02:45:29 | FromDiscord_ | <Obstinate> Do I have to write newSeq[int](...)? |
02:45:36 | FromDiscord_ | <Obstinate> Or is there some way to do this referencing my alias? |
02:46:52 | * | seni quit (Quit: Leaving) |
02:46:53 | * | zyklon quit (Read error: Connection reset by peer) |
02:55:41 | FromGitter | <kaushalmodi> I didn't follow |
02:56:02 | FromGitter | <kaushalmodi> `newSeq` needs the type and number of elements |
02:56:11 | FromGitter | <kaushalmodi> you can always do: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c36b44b6a394e2821834157] |
02:56:32 | zestyr | you can make a newMySeq constructor |
02:57:01 | FromGitter | <kaushalmodi> fwiw, `foo = newSeqint (3)` would also work .. `MySeq` is not needed in this case |
03:00:34 | * | banc quit (Quit: Bye) |
03:03:11 | * | zyklon joined #nim |
03:08:02 | * | abm quit (Ping timeout: 244 seconds) |
03:14:02 | * | theelous3 quit (Ping timeout: 268 seconds) |
03:15:56 | * | banc joined #nim |
03:24:03 | FromGitter | <timotheecour> dumb question: how can i get the url of a package using nimble? |
03:25:05 | zestyr | nimble search <pkgname> will list the info including the url |
03:25:49 | FromGitter | <timotheecour> but can i restrict `nimble search foo` to only the package foo? |
03:26:05 | FromGitter | <timotheecour> because search gives other packages based on other search terms |
03:26:10 | FromGitter | <kaushalmodi> @timotheecour https://raw.githubusercontent.com/nim-lang/packages/master/packages.json Ctrl+F :P |
03:26:13 | FromGitter | <kaushalmodi> /sorry |
03:26:14 | FromGitter | <timotheecour> and i’d rather not have to parse |
03:26:42 | FromGitter | <timotheecour> @kaushalmodi it’s for use in tooling (for my PR on nimble wide CI) |
03:27:37 | FromGitter | <timotheecour> i mean it’s not hard to parse `nimble search` output, but we shouldn’t have to; could we at least have `nimble search —json` ? |
03:27:49 | FromGitter | <kaushalmodi> yeah .. |
03:28:07 | FromGitter | <kaushalmodi> was going to suggest just parsing the json |
03:28:44 | FromGitter | <timotheecour> (we shd really embrace json or protobuf everywhere btw, it has human readable modes via jq etc) |
03:53:13 | zestyr | fin |
04:00:49 | * | nsf joined #nim |
04:02:58 | leorize | timotheecour: you can just parse nimblepkg.json directly |
04:03:40 | * | zyklon quit (Read error: Connection reset by peer) |
04:06:37 | * | Snircle_ joined #nim |
04:09:32 | * | Snircle quit (Ping timeout: 268 seconds) |
04:20:13 | * | zyklon joined #nim |
04:36:51 | FromGitter | <kayabaNerve> I am stumped |
04:36:58 | FromGitter | <kayabaNerve> I'm doing a major redo of my code |
04:37:06 | FromGitter | <kayabaNerve> And a part I didn't touch at all no longer compiles |
04:38:47 | FromGitter | <kayabaNerve> Library is https://github.com/EmberCrypto/ec_events. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c36cc572e25e453d759f024] |
04:39:24 | FromGitter | <kayabaNerve> Error is ``` ⏎ MainPersonal.nim(37, 15) template/generic instantiation from here ⏎ ../../../../.nimble/pkgs/ec_events-1.0.0/ec_events.nim(27, 18) Error: type mismatch: got <proc (data: Data): bool{.gcsafe, locks: 0.}> but expected 'proc (data: Data): bool{.locks: <unknown>.}' ⏎ .raise effects differ ⏎ ... [https://gitter.im/nim-lang/Nim?at=5c36cc7c6a394e282183d020] |
04:40:38 | FromGitter | <kayabaNerve> I tried removing the raises pragma. I did add a Lock in this file, but that's just import locks/a global verifyLock: Lock. This proc doesn't touch it at all. |
04:40:56 | FromGitter | <kayabaNerve> Right above it, which works fine, is ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c36ccd866f3433023a311dd] |
04:41:09 | FromGitter | <kayabaNerve> Any ideas? |
04:44:18 | FromGitter | <kayabaNerve> Changing the order doesn't matter. The procedures it calls are mostly the same, with neither using locks. |
04:46:21 | FromGitter | <kayabaNerve> Also, to be clear, removing raises shows the exact same error. |
04:50:51 | FromGitter | <kayabaNerve> It works if I directly pass the sign function |
04:52:04 | FromGitter | <kayabaNerve> ... is this worthy as a GitHub issue? Because I can't replicate it, as shown by the fact I have something I think is identical that isn't a problem, but it's so... nonsensical? |
04:54:29 | leorize | looks like it have something to do with locks |
04:55:09 | FromGitter | <kayabaNerve> Let me remove the lock I added. Check to be sure |
04:55:28 | FromGitter | <kayabaNerve> My main file is huge. I split it up and just include stuff. Imports, Globals... |
04:56:17 | FromGitter | <kayabaNerve> The lock import is at the top, var is a global, but it's only touched inside a function called by MainLattice (each part has its own init function). These events are set in MainPersonal. |
04:58:12 | FromGitter | <kayabaNerve> Still doesn't work if I remove the lock |
04:58:26 | FromGitter | <kayabaNerve> So there's just no locks anywhere in my code now. |
04:58:42 | FromGitter | <kayabaNerve> Not saying the error isn't about locks; I'm saying I don't have any. |
04:59:08 | leorize | some errors are just kinda hard to parse |
04:59:15 | leorize | try bumping the verbosity? |
05:01:58 | FromGitter | <kayabaNerve> Added path, added path, added path |
05:02:13 | FromGitter | <kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c36d1d55aa04d46c5878dfa] |
05:02:19 | FromGitter | <kayabaNerve> So I can't use verbosity 3 |
05:02:35 | FromGitter | <kayabaNerve> Oh. I legit just ran verbosity 3 |
05:02:38 | FromGitter | <kayabaNerve> I'm an idiot |
05:02:39 | FromGitter | <kayabaNerve> One sec |
05:06:31 | FromGitter | <kayabaNerve> leorize: Not GC safe warning due to accessing globals on a thread which is due to the GUI needing to be on the first thread, but that also exists for the others. ⏎ ⏎ 5x template/generic instantiation from here ⏎ ⏎ Same error BUT with `procedure: handler` [https://gitter.im/nim-lang/Nim?at=5c36d2d75aa04d46c5879427] |
05:07:36 | FromGitter | <kayabaNerve> Procedure is of type T which is mapped to the type of whatever procedure was passed in |
05:08:02 | * | leorize quit (Remote host closed the connection) |
05:39:10 | * | leorize joined #nim |
05:47:52 | * | narimiran joined #nim |
05:51:42 | * | rockcavera quit (Remote host closed the connection) |
06:28:37 | * | krux02 joined #nim |
07:42:43 | * | sheerluck joined #nim |
07:43:46 | * | BigEpsilon joined #nim |
07:58:30 | * | krux02 quit (Remote host closed the connection) |
07:59:03 | * | LargeEpsilon joined #nim |
08:12:18 | * | Marumoto quit (Ping timeout: 252 seconds) |
08:15:12 | * | salewski joined #nim |
08:16:48 | salewski | If some of you know something about GTK, MSYS2 and pacman for windows, you may look at issue |
08:17:11 | salewski | https://github.com/StefanSalewski/gintro/issues/33 |
08:17:34 | salewski | I can not really help, sorry. Bye. |
08:18:40 | * | salewski quit (Client Quit) |
08:20:04 | * | Vladar joined #nim |
08:26:17 | * | ng0_ is now known as ng0 |
08:28:01 | * | PMunch joined #nim |
08:34:59 | * | absolutejam joined #nim |
08:40:24 | * | abm joined #nim |
08:55:05 | * | floppydh joined #nim |
08:58:24 | * | salewski joined #nim |
08:58:53 | salewski | miran, concerning your new learning nim page: |
08:59:07 | salewski | You may also consider adding links to |
08:59:39 | salewski | https://scripter.co/notes/nim |
09:00:16 | narimiran | salewski: yes, i'll add that |
09:00:35 | salewski | and to rosetta code page. From rosetta page I learned indeed a bit in early days. |
09:00:36 | * | cspar quit (Ping timeout: 268 seconds) |
09:01:22 | salewski | And note, that search entry in page |
09:01:24 | salewski | https://nim-lang.org/docs/lib.html |
09:01:27 | * | cspar joined #nim |
09:01:37 | salewski | is still not working in firefox. |
09:02:08 | salewski | Other people reported the same, while github copy of that page works fine. |
09:02:30 | Araq | works on my firefox |
09:02:40 | Araq | I typed 'if' and got relevant results |
09:02:45 | narimiran | salewski: it doesn't work for me on Vivaldi either. but when i reported it, nobody else could reproduce it |
09:02:57 | Araq | (not the best results but that's a different issue) |
09:03:25 | salewski | JavaScript error: https://nim-lang.org/docs/lib.html, line 1: ReferenceError: search is not defined |
09:03:36 | salewski | is reported by firefox. |
09:05:21 | salewski | For me nothing happens when I type into search entry. |
09:05:36 | narimiran | same here. and pressing enter does nothing too |
09:06:07 | salewski | https://nim-lang.github.io/Nim/lib.html |
09:06:18 | narimiran | pro: it is not only just me. con: it is not only just me |
09:06:18 | Araq | maybe some onInit bug where we access the object too early |
09:06:40 | salewski | works fine. Maybe you can find the difference. Bye. |
09:08:25 | Zevv | Araq: I hit a [GCASSERT] incRef: interiorPtr, is this likely to be a real GC issue, or can this be triggered by misbehaving code? |
09:08:46 | PMunch | narimiran, it works for me in Vivaldi.. |
09:08:52 | PMunch | Any messages in the console? |
09:09:48 | salewski | JavaScript error: https://nim-lang.org/docs/lib.html, line 1: ReferenceError: search is not defined |
09:10:00 | salewski | That was message from firefox. |
09:10:06 | PMunch | Is that the same for Vivaldi? |
09:10:20 | * | absolutejam quit (Ping timeout: 250 seconds) |
09:10:27 | PMunch | I do get this: [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. |
09:10:39 | PMunch | Might be that Firefox just outrights blocks the script? |
09:10:58 | * | absolutejam joined #nim |
09:11:04 | Araq | no I get the same deprecation and it works fine |
09:11:06 | salewski | It is not only a firefox problem, for epiphany web browser it works not too, but mo message. |
09:11:59 | narimiran | PMunch, salewski: "Uncaught ReferenceError: search is not defined" in Vivaldi |
09:13:54 | PMunch | Hmm, that's strange |
09:14:04 | PMunch | It's a top level function in dochack.js |
09:14:06 | * | zyklon quit (Read error: Connection reset by peer) |
09:16:06 | salewski | Final note: I have no blockers enabled in firefox and cookies enabled. And problem started with release 0.19.2 since year 2019 |
09:16:41 | salewski | Bye. |
09:16:44 | * | salewski quit (Quit: WeeChat 2.3) |
09:16:58 | narimiran | same here |
09:18:37 | PMunch | Hmm, this is really strange |
09:20:22 | PMunch | narimiran, could you "right-click -> Save As", and as the file format choose "Webpage, Complete" then upload that somewhere |
09:20:34 | PMunch | I'm just curious to see if the content you get is actually different |
09:22:41 | narimiran | PMunch: https://gist.githubusercontent.com/narimiran/947c51cb14ef73a14e238d4c1c48e326/raw/7b1724ce74df20653a1da14e70de43be84515b9d/gistfile1.txt |
09:26:56 | PMunch | I meant all the files |
09:27:07 | PMunch | Saving as a complete webpage should create a directory as well |
09:27:27 | narimiran | oh, i didn't see the directory |
09:28:10 | narimiran | in the directory are only two css files, you want that? |
09:29:19 | narimiran | PMunch: https://gist.github.com/narimiran/08c498df6b79317f64773c9f63ef68a2 |
09:29:29 | PMunch | Wait no dochack.js file? |
09:29:48 | narimiran | nope |
09:30:04 | FromGitter | <alehander42> @Araq would code with `move` etc be correctly translated for the javascript backend? (https://github.com/nim-lang/Nim/issues/9674) |
09:30:06 | PMunch | http://ix.io/1xWF/ |
09:30:12 | PMunch | That's what it looks like for me |
09:30:20 | PMunch | I think we just found the issue :P |
09:30:28 | narimiran | i removed /, it's ok |
09:30:39 | narimiran | and no, i don't have dochack.js there |
09:31:04 | * | zyklon joined #nim |
09:32:04 | Araq | alehander42: the JS codegen is missing it but it's not hard to implement |
09:32:12 | PMunch | Oh, interesting |
09:32:23 | absolutejam | nim can be compiled (transpiled?) to js? |
09:32:31 | PMunch | After I do Ctrl+F5 (force refresh, no cache) I get the same issue |
09:32:45 | PMunch | absolutejam, compiled to, and yes |
09:33:07 | PMunch | C, C++, ObjectiveC(?), and JS |
09:33:14 | absolutejam | is transpiling from the same base language? |
09:33:19 | absolutejam | ooh, shiney. |
09:33:22 | narimiran | absolutejam: btw, yesterday i said you came to nim half a day too early. now we have this: |
09:33:30 | narimiran | https://nim-lang.org/learn.html |
09:33:52 | * | theelous3 joined #nim |
09:34:31 | narimiran | i think this should entertain you for quite some time :) |
09:34:34 | PMunch | Well, transpiling is between the same level of abstraction, compiling is going from one level down to another. Since Nim has all it's powerfull macro stuff and compile-time execution, generics, etc. it is compiled to JS |
09:34:45 | PMunch | You can't go back from JS to Nim and end up with the same code |
09:35:16 | absolutejam | righ, makes sense |
09:35:30 | absolutejam | isn't TypeScript transpiled though? |
09:35:33 | absolutejam | -> js |
09:35:37 | PMunch | GET https://nim-lang.org/docs/dochack.js net::ERR_ABORTED 404 |
09:35:42 | absolutejam | I guess js is valid in ts though |
09:35:56 | narimiran | PMunch: something needs to be backported to 0.19.x branch? |
09:36:33 | PMunch | "[...] transcompiles to JavaScript.", I don't think they're completely sure themselves :P |
09:36:40 | PMunch | From the TypeScript wiki page |
09:37:16 | PMunch | But they call it a compiler, and it does offer an abstraction over JavaScript (types specifically, and some other stuff I think) |
09:37:33 | PMunch | narimiran, it looks like the file is just missing.. |
09:37:59 | PMunch | https://nim-lang.org/docs/dochack.js |
09:38:04 | PMunch | That's the file it tries to grab |
09:38:12 | PMunch | And it gives me at least a 404 |
09:38:26 | narimiran | 404 here too |
09:38:28 | absolutejam | thanks for the link narimiran |
09:38:30 | absolutejam | reading now |
09:38:36 | FromGitter | <alehander42> absolutejam basically nim and typescript are both compiled to javascript, the terminology distinction is not very important |
09:38:57 | absolutejam | yeah, fair enough |
09:39:04 | PMunch | Araq, do you know where dochack.js is supposed to be? |
09:39:25 | absolutejam | so, I could write a compiled node program in nim? |
09:39:37 | absolutejam | I mean, compiled from nim -> js |
09:39:41 | PMunch | Yup |
09:39:51 | PMunch | I did that for my test with Electron |
09:39:53 | absolutejam | I never learned js because it gives me bad feelings |
09:39:53 | leorize | PMunch: tools/dochack.nim |
09:39:57 | FromGitter | <alehander42> absolutejam yes, I maintain such a project |
09:40:01 | absolutejam | sweet. |
09:40:12 | PMunch | github.com/PMunch/nim-electron |
09:40:17 | FromGitter | <alehander42> (which uses nim -> node.js for some components) |
09:40:31 | PMunch | (Not supporting electron by the way, it's horrible. Just did it for fun to see if it would work) |
09:40:46 | FromGitter | <alehander42> :D the electron war |
09:41:00 | absolutejam | can't see it going anywhere though |
09:41:12 | Zevv | narimiran: tutorial part ||| is missing in the list at https://nim-lang.org/learn.html |
09:41:23 | narimiran | Zevv: yes, i know :) |
09:41:26 | Zevv | ok |
09:41:34 | narimiran | it will be available when 0.19.4 is released |
09:41:49 | narimiran | Zevv: for now, go to https://nim-lang.github.io/Nim/tut3.html |
09:42:03 | Zevv | yeah, *I* know, but my browser doesn't when I click the link :) |
09:42:03 | PMunch | leorize, I meant the compiled js version for the website |
09:42:13 | absolutejam | if I'm mutating my object, and it returns something, do I have to discard the value? |
09:42:18 | narimiran | (well, it is not missing, it is there, but link doesn't work just yet) |
09:42:57 | Araq | fun fact: "transpilers" used to be called "preprocessors" |
09:43:05 | Zevv | Would a link to https://rosettacode.org/wiki/Category:Nim make sense? |
09:43:22 | PMunch | absolutejam, anything that returns something you don't want has to be discarded |
09:43:42 | narimiran | Zevv: it would. i already added link to it and to Nim Notes. it will be online on the next server refresh |
09:43:50 | absolutejam | okay |
09:43:55 | PMunch | "With Great Power Comes Great Responsibility." -- Spider Man's Uncle |
09:44:02 | PMunch | aka Benjamin Parker.. |
09:44:23 | absolutejam | Uncle Ben, purveyor of fine rice |
09:44:34 | PMunch | Haha :P |
09:47:14 | absolutejam | the 'do' syntax looks quite nice |
09:47:52 | absolutejam | I'm avoiding writing any real code at the minute because I'm trying to figure out how to structure my types |
09:50:15 | narimiran | paralysis by analysis? |
09:50:55 | absolutejam | ^ i like it |
09:51:22 | absolutejam | the opposite is diving in and redoing it every 2 minutes though |
09:51:30 | absolutejam | which is what I was doing when I was writing this in Python |
09:51:40 | narimiran | aaand, there's nothing in between? ;) |
09:51:53 | absolutejam | black or white |
09:52:00 | absolutejam | no grays |
09:52:31 | narimiran | Zevv: if you find any more resources that you think it should be added to the learn nim page, let me know |
09:52:34 | oculux | transpile <- first time i have heard it. my opinion: no one needs more piles |
09:53:27 | absolutejam | does this channel have to be strictly on topic/ |
09:53:43 | * | cspar_ joined #nim |
09:53:46 | oculux | <- has been learning nim for 3 days and is mind blown at where programming has come to... |
09:54:15 | absolutejam | I keep getting blown away by function overloading |
09:54:24 | absolutejam | because I've never really had that |
09:54:34 | PMunch | absolutejam, peterme.net/nim-types-originally-a-reddit-reply.html |
09:54:45 | PMunch | That might be helpful if you're fiddling with types |
09:54:51 | absolutejam | actually, maybe when I dabbled in Visual Basic in college |
09:55:00 | PMunch | You can also click through to the reddit thread and see more information there |
09:55:13 | absolutejam | sweet |
09:56:15 | PMunch | absolutejam, the channel doesn't have to be on-topic. But when someone is actually asking for help or wants to discuss something Nim related we typically head over to #nim-offtopic for the offtopic discussions :) |
09:56:16 | * | cspar quit (Ping timeout: 250 seconds) |
09:56:45 | absolutejam | TIL #nim-offtopic |
09:58:38 | PMunch | There is also #nim-nologs |
09:58:46 | PMunch | But it's not used that much I think |
09:58:57 | Araq | you got to be over 18 for #nim-nologs |
09:59:10 | narimiran | oooh, i didn't know that |
09:59:16 | * | narimiran joins #nim-nologs :P |
09:59:16 | absolutejam | what happens in nologs stays in nologs? |
09:59:24 | FromGitter | <alehander42> wow i didnt know of nologs |
09:59:30 | FromGitter | <alehander42> how many more do we have :D |
09:59:38 | absolutejam | #nim-somelogs |
09:59:41 | PMunch | It's only those three IIRC |
10:00:01 | PMunch | Haha, nim-somelogs, a random number of messages are logged. The rest is discarded |
10:00:15 | Araq | narimiran: I was kidding |
10:00:19 | PMunch | You can possibly get a feel for what was discussed, but no real information |
10:00:19 | narimiran | i know, me too |
10:00:31 | PMunch | Araq, did you see my comment about dochack.js? |
10:00:44 | PMunch | The reason search is broken is because that file 404's |
10:01:00 | PMunch | Ctrl+F5 to do a force refresh and you should see the same |
10:01:28 | Araq | makes sense |
10:07:00 | FromGitter | <timotheecour> @araq any early feedback on https://github.com/nim-lang/Nim/pull/10247 ? |
10:11:07 | narimiran | @timotheecour Araq here is my initial list of the most popular Nimble packages: https://gist.github.com/narimiran/d41f84dd06e9514681bfee7d252b2842 |
10:11:49 | narimiran | please notice that this list needs to be refined, and probably lots of these packages should be discarded, but @timotheecour maybe you can take it as a starting point |
10:12:42 | FromGitter | <timotheecour> @narimiran thx; can u add the script that generated it to somewhere inside `tools/`? then i could call it as a library inside that PR |
10:13:05 | narimiran | the "script" that generated it is speaking to you right now ;) |
10:13:15 | FromGitter | <timotheecour> right now i took 20 packages that I use a lot, but happy to merge w urs |
10:13:48 | FromGitter | <timotheecour> wait what ? was that manual? |
10:14:07 | narimiran | btw, you shouldn't blindly merge. i didn't check if these packages have been recently updated, do they even work anymore, etc |
10:14:13 | FromGitter | <timotheecour> is that list using number of stars on GitHub? or number of downloads? or ? |
10:14:31 | narimiran | number of stars, plus some manual cherry picking |
10:15:07 | Zevv | Not sure if something like spry is really often used? |
10:15:18 | narimiran | it was manual because when i started i thought i'll make that list much much smaller. and once i got going, i realized i already did half of the job and it is faster for me to continue manually |
10:16:03 | narimiran | Zevv: as i said, this list needs to be curated, and probably lots of packages will be removed |
10:16:11 | FromGitter | <timotheecour> one interesting point is if X is very popular and depends on Z (which no-one every installs “explicitly” or even knows about (ie few github starts etc)), shouldn’t Z be treated at least as well as X |
10:16:43 | Zevv | is there a way to get "real" statistics, like number of downloads or nimble installs? I guess these numbers are only available to the owners of the individual packages on github? |
10:17:00 | FromGitter | <timotheecour> but maybe i could take the transitive closure of the N most popular packages to avoid this issue |
10:19:04 | Araq | timotheecour: we already had some logic to do that in testament |
10:19:06 | PMunch | Zevv, one way would be to go by stars and look at imports to propagate stars to libraries |
10:19:16 | Araq | have you looked at it? |
10:19:29 | FromGitter | <alehander42> look at nimble dependencies: imports could be hard to analyze |
10:19:36 | FromGitter | <timotheecour> @araq where |
10:20:45 | Araq | categories.nim, section 'Nimble' |
10:21:25 | Araq | but more importantly, this list of packages is insufficient |
10:21:52 | FromGitter | <timotheecour> i actually didn’t know about that testament nimble target |
10:23:15 | Araq | 1. the list of packages is platform dependent, some easy way to do 'when defined(linux)' would be nice |
10:23:25 | * | dddddd joined #nim |
10:23:37 | Araq | 2. how to test a package is package specific, there can be more to it than just 'nimble test' |
10:24:29 | Araq | 3. we need protection against nimble package updates, probably by picking a specific commit |
10:25:47 | FromGitter | <timotheecour> > there can be more to it than just 'nimble test’ ⏎ ⏎ i’m running both: nimble install,develop,build,test; with `build,test` being the most important ones as far as nim breakages is concerned |
10:26:44 | FromGitter | <timotheecour> 1) platform dependent: yes |
10:28:55 | FromGitter | <timotheecour> > there can be more to it than just 'nimble test’ ⏎ ⏎ see my suggestion of a standardized `nimble testCI` here: https://github.com/nim-lang/Nim/pull/10247#issuecomment-452931965 and its semantics |
10:28:55 | * | zyklon quit (Read error: Connection reset by peer) |
10:29:40 | Araq | but then I need to update all my nimble packages. And I don't want to. |
10:29:55 | FromGitter | <timotheecour> i’ll change the list to be a set of `mypkg:myversion` instead of `mypkg` |
10:30:01 | FromGitter | <timotheecour> no u don't |
10:30:24 | Araq | what are the effects on the build times? |
10:30:29 | FromGitter | <timotheecour> read the description again: if `nimble testCI` is defined, we use it, else we use `nimble test` |
10:31:27 | FromGitter | <timotheecour> > what are the effects on the build times? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c371eff9289cc7aa74ebfdb] |
10:31:47 | Araq | we don't know if it's defined and it's a complex solution for something that is much easier to solve anyway, specialize the code |
10:31:52 | FromGitter | <timotheecour> but that’s running locally (ie, total for 20 pkgs was 112 seconds) |
10:33:21 | FromGitter | <timotheecour> > we don't know if it's defined ⏎ ⏎ Yes we do: `nimble task` tells u exactly that |
10:33:43 | Araq | meh |
10:34:16 | Araq | I don't want it. |
10:34:53 | Araq | in the past we tried to "check" all Nimble packages, got 404s, didn't even run "nimble test" and abandoned it |
10:35:14 | Araq | now we're at "we test selected packages" |
10:35:28 | FromGitter | <timotheecour> don’t want “it” ; it = what? |
10:35:42 | Araq | that's better but since they are selected, we might as well have specialized code for them |
10:35:58 | Araq | instead of a "generic" testCI solution |
10:36:29 | FromGitter | <timotheecour> well, ok. so that’s what i’m doing now anyways |
10:36:43 | Araq | ok |
10:37:34 | Araq | andreaferretti's packages are also worth testing, it's a bit complex because he sometimes uses libBlas or something |
10:37:34 | FromGitter | <timotheecour> but high level is ok in PR? modulo adding (optional) hardcoded versions, and adjusting for per-platform |
10:38:11 | Araq | still thinking about whether this should be in testament, you now have quite some counting and reporting logic |
10:38:32 | FromGitter | <timotheecour> but can’t HE (the pkg author) be responsible for setting everything up so that nim’s CI just call his `nimble test` |
10:39:55 | Araq | eventually maybe, but we should have a convenient start |
10:39:57 | FromGitter | <timotheecour> it sounds a lot easier if each pkg exposes a simple interface that we call to test; so each pkg must make sure their test (or testCI which i had intended for that) is correct |
10:40:28 | FromGitter | <alehander42> i kinda agree, i think that e.g. andrea or the many of the other ppl would gladly take a PR that fixes that for their packages |
10:40:30 | FromGitter | <timotheecour> im’ ok so long the long term plan is to push for `uniform` way |
10:41:00 | Araq | yeah, and every software should respect SOURCE_DATE_EPOCH |
10:41:23 | FromGitter | <alehander42> " standard X is not respected, so let's just not have standards at all" |
10:41:25 | FromGitter | <timotheecour> well that’s what brew is shooting for |
10:41:46 | Araq | alehander42: yes, if it can easily be avoided |
10:42:23 | FromGitter | <alehander42> well, custom code in test tools is even worse |
10:42:35 | FromGitter | <alehander42> i mean, it's ok to have special cases for some libs |
10:42:35 | FromGitter | <timotheecour> yup yup yup |
10:42:39 | FromGitter | <alehander42> but this should be the exception |
10:42:59 | FromGitter | <timotheecour> definitely agree. temporary exception pending upstream PR's |
10:43:42 | Araq | it will always be custom code and here is why, "we broke ABC and ABC shouldn't have compiled to begin with, we'll disable it until ABC is fixed" |
10:44:13 | Araq | there is little difference between a "custom" disable and a custom test command. |
10:44:47 | FromGitter | <alehander42> yes, the first is a boolean flag and the second one is everything expressable in e.g. bash |
10:45:04 | absolutejam | what are you doing with the packages, if you don't mind me asking? |
10:45:07 | Araq | it's both custom code. |
10:45:10 | FromGitter | <alehander42> it should be possible to have a custom command, but it shouldn't be the default |
10:45:15 | FromGitter | <alehander42> thing to do |
10:45:41 | Araq | it doesn't matter, when you add a package you surely tested it manually and hence know the commands already |
10:45:46 | FromGitter | <alehander42> and maintaining test commands is not the langdev team job |
10:46:01 | FromGitter | <mratsim> @timotheecour @araq you don’t need to test nimblas, I use them in Arraymancer so there is already a convenient test for them |
10:46:22 | FromGitter | <alehander42> after all, if a package X breaks down, you can always tell: "we can make sure to not break it if it exposes this command: if it doesn't , well, fix this first" |
10:46:40 | Araq | the maintenance job is largely the same |
10:46:42 | FromGitter | <alehander42> i dont know why you want more work in your own code |
10:46:49 | * | zyklon joined #nim |
10:46:53 | FromGitter | <mratsim> my main issue with @andreaferretti packages is that there are some `*` in the autogenerated doc which crashes nim doc. |
10:47:05 | Araq | it isn't more work, that's why. |
10:48:01 | FromGitter | <alehander42> how is "i have to find the correct commands etc and the way to actually setup this X" the same work as "<known command>" |
10:48:05 | Araq | that's your conjecture, we don't have experience with it and yet the first thing you do is to come up with more rules |
10:48:11 | FromGitter | <alehander42> and this doesnt scale |
10:48:18 | FromGitter | <alehander42> one day, if you have 500 popular packages |
10:48:25 | FromGitter | <alehander42> are you going to maintain commands for all of them |
10:48:40 | Araq | and now we're in buzzword bingo land |
10:49:05 | FromGitter | <alehander42> this "rules/no rules" is so arbitrary, rules simplify life a lot of the time |
10:49:38 | FromGitter | <timotheecour> the single 1 thing that makes this whole thing feasible is nimble has a standardized `nimble test`; so ya, we’ll default to that and allow *temporary* exceptions for important stuff |
10:49:38 | * | krux02 joined #nim |
10:52:10 | FromGitter | <timotheecour> there’s a few more thnigs to iron out (but could be in subsequent PR’s) : ⏎ ⏎ 1) how to get the versions: i suggest we test both master and latest release tag |
10:52:51 | Araq | ^ see. More "custom" knowledge is required. |
10:52:52 | FromGitter | <mratsim> I think it’s fine to have a transition period once we get more popular packages |
10:53:00 | FromGitter | <mratsim> as people said: “rich people problem" |
10:53:10 | FromGitter | <timotheecour> Regressions: we need to store the results in a db so we can query for these (and answer questions like: when did pkg foo break) |
10:54:11 | FromGitter | <timotheecour> > More "custom" knowledge is required ⏎ ⏎ git can tell us latest release tag , a list doesn’t have to be maintained in nimble-wide ci tester |
10:54:29 | Araq | that feature was in testament too, it used a DB. nobody ever used it |
10:54:39 | Araq | including myself who wrote it. |
10:54:57 | FromGitter | <timotheecour> well we can look into reviving it, but in subsequent PR’s, if needed |
10:56:17 | FromGitter | <timotheecour> what’s very useful at least is: what tests passed before a given PR that fail after that PR ; so that db is kinda useful (short of hardcoding in code) |
10:56:49 | Araq | well that's what testament gives you |
10:57:34 | FromGitter | <timotheecour> well testament is centralized though, it’s not quite comparable; testament tests stuff that’s all under its control; here it’s the ‘outside world' |
10:58:27 | FromGitter | <timotheecour> so hardcoding in code what nimble packages pass/fail is uglier, but maybe ok in a first pass |
10:59:58 | Araq | testament is a general command/input/output system, I know you are against specialized "commands" but the URL is "special" to begin with |
11:01:18 | Araq | and we might also want to test 'nim doc' on Nimble packages |
11:01:44 | Araq | because we can also sometimes break the docgen... |
11:01:52 | FromGitter | <timotheecour> Yup, agree |
11:02:20 | Araq | your solution is probably a standard 'nimble docCI' target :P |
11:03:12 | FromGitter | <timotheecour> well, actually, kind of yes |
11:03:51 | Araq | a standard is something that emerges, not something you dream up |
11:04:02 | FromGitter | <timotheecour> it could be: if `nimble docCI` is defined run it, else, best effort: run `nim doc pkg.nim` ⏎ how else would one test that, short of running `nim doc main.dnim |
11:04:23 | FromGitter | <alehander42> but why testCI and docCI |
11:04:28 | FromGitter | <alehander42> instead of just test and doc |
11:04:43 | FromGitter | <timotheecour> theres no `nimble doc` ATM |
11:05:03 | FromGitter | <timotheecour> so ya it’d probably be `nimble doc` |
11:05:24 | Araq | say we test 20 nimble packages, these have different development pacings |
11:05:50 | Araq | sometimes 'master' is what we need to use, sometimes a git tag, sometimes a git commit hash |
11:06:12 | Araq | sometimes 'nimble doc' exists but uses Sphinx which we don't have installed |
11:06:23 | FromGitter | <timotheecour> new idea: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c37272f317e2407cd0c4194] |
11:07:00 | Araq | that is the problem we need to solve. Maybe, yes, we don't want to test for 300 packages in the same style |
11:07:32 | Araq | that's a different problem we can tackle with more experience with the 20 packages that we did test |
11:07:46 | * | troido quit (Ping timeout: 250 seconds) |
11:10:02 | FromGitter | <timotheecour> actually we can do: ⏎ ⏎ ```nim doc —project <inferred_main_pkg>.nim``` ⏎ ⏎ unless package author defined a `nimble doc` task, in which case we run that instead [https://gitter.im/nim-lang/Nim?at=5c37280a83c7e37765483bc7] |
11:11:01 | FromGitter | <mratsim> I defined nimble docgen |
11:14:12 | Araq | ok so instead of 20 lines of evil "custom" commands we're having a "generic" solution involving inferring/guessing and a new Nimble standard -d:ci flag |
11:14:36 | narimiran | KISS, please |
11:15:30 | FromGitter | <timotheecour> the 20 can scale to 1000 though, when running locally for eg |
11:16:25 | Araq | we don't know if we want to scale to 1000 though, maybe the CIs timeout, maybe Nim development becomes more professional |
11:17:14 | FromGitter | <timotheecour> Anyway, the best is to try it out, i’m gonna incorporate some of the stuff discussed above in that PR |
11:17:23 | Araq | not to mention that extracting "most common substrings" out of a list is not something that's particularly hard to do |
11:17:53 | * | stefanos82 joined #nim |
11:17:54 | FromGitter | <timotheecour> Huh? |
11:19:07 | Araq | test "package:v1; nimble test; nimble doc" # 100x, evil, refactoring into: |
11:19:14 | Araq | standardTest "package" |
11:19:35 | Araq | once we have 100x of them |
11:20:01 | Araq | nothing scales better than simple solutions. |
11:20:15 | FromGitter | <timotheecour> well we’re in violent agreement |
11:20:39 | Araq | yay :-) |
11:21:02 | FromGitter | <timotheecour> anyway, will update PR, there was a few good ideas mentioned above |
11:21:41 | Araq | YAGNI and KISS always win |
11:22:32 | FromGitter | <timotheecour> again, i agree |
11:22:43 | FromGitter | <alehander42> nothing scales worse than manual solutions |
11:22:59 | * | theelous3 quit (Ping timeout: 258 seconds) |
11:27:19 | FromGitter | <mratsim> write a macro :P |
11:28:26 | absolutejam | hm, I can't get nim to build my test file on Windows |
11:30:44 | Araq | "Humm, I need to figure out which packages to test regularly, I need to run their tests manually first and look at what state they are in. But hey, at least I don't need to write down the test command I used because I will make the package authors standardize on it." |
11:31:19 | absolutejam | I just need those DLLs, mingw and that's it right? |
11:32:38 | * | theelous3 joined #nim |
11:32:57 | FromGitter | <alehander42> Araq, all right, my point was about "nothing scales better than simple solutions." |
11:33:14 | FromGitter | <alehander42> it's just incorrect logically |
11:33:26 | FromGitter | <alehander42> sometimes what is simpler for <N is not simpler for >=N |
11:33:30 | FromGitter | <timotheecour> well, after PR running their tests is as simple as: ⏎ `nim c -r koch.nim runcipackages` |
11:34:31 | Araq | we are dealing with <N now, the >=N solution might never be required or completely different, as in: we *blacklist* the broken Nimble packages instead |
11:34:37 | narimiran | absolutejam: how did you install nim? |
11:34:59 | narimiran | i'm not on windows, but installation should be "plug and play", from what i remember |
11:35:03 | * | troido joined #nim |
11:35:27 | narimiran | absolutejam: https://nim-lang.org/install_windows.html |
11:35:36 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
11:35:45 | narimiran | "Simply extract the files into the desired installation directory, and run finish.exe." |
11:36:04 | absolutejam | I actually dont remember, haha. THink I may have used chocolatey |
11:36:10 | absolutejam | did it in a haze the other day |
11:36:15 | Araq | :-) |
11:36:17 | absolutejam | I'll download the zip |
11:36:48 | absolutejam | yeah, with chocolatey |
11:37:18 | FromGitter | <alehander42> Araq, yes, we all agreed for <N there would be custom commands, but also nothing wrong with eventually fixing those packages |
11:37:25 | FromGitter | <alehander42> anyway, this is it |
11:40:49 | Araq | thinking about this more, 'nimble install' can end with 'run pacman install foobar' |
11:44:55 | FromGitter | <timotheecour> i don’t think so, it’s handled by nimble; unless u mean `nimble build` |
11:45:18 | FromGitter | <timotheecour> (whcih can be arbitrarily customized by pkg author) |
11:52:45 | * | xet7 joined #nim |
11:54:25 | absolutejam | there's an awsome looking nim package |
11:54:28 | absolutejam | but with no docs :[ |
11:54:36 | absolutejam | baptism by fire time? |
11:58:18 | PMunch | Which package? |
11:58:20 | FromGitter | <kaushalmodi> @timotheecour, Araq: why not have the package .nimble define the CI commands? |
11:58:57 | PMunch | absolutejam, which package? |
11:59:14 | FromGitter | <kaushalmodi> If a package needs to be kind of officially tracked by Nim (which is a good thing), the package author would put the CI fields in their .nimble |
11:59:44 | absolutejam | nim-prompt |
12:00:33 | FromGitter | <kaushalmodi> It already contains the minimum required Nim version in most cases. If not specified, default to the latest stable. And run the CI commands only on those versions. |
12:00:54 | FromGitter | <timotheecour> that’s pretty much what I’ve been suggesting; but to make it more practical, it’d be: first check if there’s a CI task; if not, do a best effort by running custom code |
12:01:08 | FromGitter | <kaushalmodi> Ok |
12:01:09 | FromGitter | <timotheecour> that way, it works from day one |
12:01:30 | FromGitter | <timotheecour> and we promote that best practice |
12:01:34 | FromGitter | <timotheecour> over time |
12:01:36 | FromGitter | <kaushalmodi> We can skip the "best effort" part |
12:01:40 | FromGitter | <timotheecour> No no |
12:02:03 | absolutejam | brb, grabbing a sandwich |
12:02:06 | FromGitter | <kaushalmodi> If the author wants their package to not break by Nim changes, they would specify the CI commands |
12:02:08 | FromGitter | <timotheecour> best effort just runs: nim doc, nimble test, and other commands in a smart way |
12:02:24 | FromGitter | <timotheecour> so we can at least see what’s the state of nimble today, at scale. |
12:02:31 | * | theelous3 quit (Ping timeout: 268 seconds) |
12:02:54 | FromGitter | <kaushalmodi> Understood. 👍 |
12:02:55 | FromGitter | <timotheecour> btw i’m writing the tool so it can also be used locally with customization, so u’ll be able to run it on all nimble packages |
12:42:59 | absolutejam | yay, compiling on Windows |
12:43:11 | FromGitter | <mratsim> rest in peace :P |
12:43:31 | absolutejam | it's my colleagues PC too |
12:43:40 | absolutejam | he's going to come back to Python3, golang and nim installed |
12:51:01 | Araq | a late Christmas present |
12:52:27 | FromGitter | <alehander42> @timotheecour @kaushalmodi there shouldn't be separated "CI" and "normal test" commands, this is not something any normal lib author would like indeed |
12:54:28 | * | nsf quit (Quit: WeeChat 2.3) |
12:56:44 | absolutejam | does nim have an init method? |
12:56:57 | absolutejam | for types |
12:57:00 | PMunch | What do you mean init method? |
12:57:09 | absolutejam | Yeah, that's Python-specific isn't it |
12:57:10 | FromGitter | <alehander42> constructor |
12:57:11 | absolutejam | an initialiser |
12:57:24 | PMunch | Ah right, for your type |
12:57:35 | absolutejam | yeah, sorry. just blurting words out without making sentences |
12:57:43 | FromGitter | <zacharycarter> you write it |
12:58:04 | FromGitter | <alehander42> usually you try to name it `init<Type>(..)` |
12:58:04 | FromGitter | <zacharycarter> objects in Nim are like structs in C |
12:58:05 | absolutejam | it's not implicit though? Like Python's __init__ is called post contructor |
12:58:07 | FromGitter | <zacharycarter> they don't have any constructor |
12:58:09 | FromGitter | <alehander42> or `new<Type(..)` |
12:58:19 | FromGitter | <alehander42> absolutejam, no it's explicit |
12:58:28 | FromGitter | <zacharycarter> `type Foo = object; proc newFoo(): Foo = result; |
12:58:28 | absolutejam | so I'd do a = Foo(); a.init |
12:58:31 | FromGitter | <alehander42> a lot of the time, it's simple to just directly initialize it |
12:58:31 | FromGitter | <zacharycarter> you get the idea |
12:58:38 | FromGitter | <alehander42> no |
12:58:47 | FromGitter | <alehander42> you would either do a = Foo(f: .., e: ..) |
12:58:51 | FromGitter | <alehander42> or a = initFoo(arg, arg) |
12:58:56 | FromGitter | <alehander42> (or newFoo) |
12:59:13 | FromGitter | <zacharycarter> var a: Foo; a = newFoo() |
12:59:27 | FromGitter | <zacharycarter> you're certainly free though to do this however you want |
12:59:28 | absolutejam | what is 'newFoo'? |
12:59:30 | FromGitter | <zacharycarter> you can write your own init routine |
12:59:34 | FromGitter | <zacharycarter> a proc you would define |
12:59:35 | absolutejam | Is that a proc I have to create? |
12:59:38 | absolutejam | ah okay |
12:59:42 | PMunch | We should really get the new/init as typedesc generics.. |
12:59:53 | FromGitter | <alehander42> yeah |
13:00:04 | absolutejam | I've created a type using Foo(a: "something") etc. |
13:00:25 | absolutejam | but if I want to ensure any more logic is run, I have to create the proc and call it right? |
13:00:26 | FromGitter | <alehander42> this is also absolutely ok |
13:00:31 | absolutejam | there's no magic |
13:00:36 | FromGitter | <alehander42> yes, exactly |
13:00:38 | * | zyklon quit (Read error: Connection reset by peer) |
13:00:59 | FromGitter | <alehander42> you just call it with the initializer args |
13:01:40 | absolutejam | what's the idiomatic way? newFoo()? |
13:02:06 | FromGitter | <zacharycarter> yes |
13:02:10 | absolutejam | I just want to ensure the Type is created and all validation methods etc are run as well |
13:02:28 | absolutejam | So, if my type is User, newUser, etc. |
13:02:31 | FromGitter | <zacharycarter> create a `newFoo(...)` pass whatever args to that proc you want |
13:02:33 | FromGitter | <zacharycarter> right |
13:02:34 | FromGitter | <GULPF> newFoo for ref types and initFoo for object types |
13:02:38 | absolutejam | Just thinking what's idiomatit |
13:02:42 | FromGitter | <GULPF> is what the stdlib uses |
13:02:49 | absolutejam | I still don't understand the difference. |
13:02:55 | absolutejam | ref/object types |
13:03:04 | FromGitter | <zacharycarter> I wasn't aware of that distinction - but ogod to know |
13:03:05 | absolutejam | Is one a pointer to an existing object? |
13:03:08 | FromGitter | <zacharycarter> yes |
13:03:20 | FromGitter | <mratsim> ref is a pointer/reference to an object |
13:03:22 | FromGitter | <zacharycarter> ref objects are GC traced pointers to local heap alloations |
13:03:33 | FromGitter | <mratsim> too low level @zacharycarter |
13:03:36 | FromGitter | <zacharycarter> sorry |
13:03:38 | FromGitter | <mratsim> :P |
13:03:41 | absolutejam | gimme a few weeks, haha |
13:03:49 | FromGitter | <mratsim> what’s your background? |
13:03:51 | FromGitter | <zacharycarter> key is ref is a safe ptr |
13:03:53 | FromGitter | <GULPF> ref has alias semantics, that's the important difference. Two ref objects can point to the same memory |
13:03:57 | PMunch | absolutejam, did you read my article/reddit post? |
13:04:00 | absolutejam | Windows sysadmin |
13:04:03 | absolutejam | I started, PMunch :P |
13:04:07 | PMunch | I go into great detail on ref/pointer/object |
13:04:09 | absolutejam | It's still in my open tabs, ready to be read |
13:04:22 | FromGitter | <alehander42> narimiran, what's the RFC workflow now: i see one has to add a new md document, but how is it discussed after that |
13:04:32 | narimiran | "We should really get the new/init as typedesc generics.." yes yes yes!! |
13:04:37 | narimiran | https://github.com/nim-lang/RFCs/issues/48 |
13:04:44 | FromGitter | <mratsim> basically a variable can hold either a value, or a reference to a value (also called pointer). |
13:04:51 | FromGitter | <mratsim> an object is a value |
13:05:05 | FromGitter | <mratsim> a ref object is a reference (address) of a value |
13:05:29 | absolutejam | Yeah, I feel like I get it but I'm not 100%. I think it's just because I've never actually worked with them |
13:05:33 | FromGitter | <mratsim> this is similar to cash vs cheque |
13:05:36 | narimiran | @alehander42 you send PR and then we discuss it below it in the comments. if there are changes to be made, you push the changes and we can easily see what has been changed |
13:05:48 | FromGitter | <mratsim> cash is value, and cheque is a reference to a value :P |
13:06:04 | narimiran | before it was "i changed something in the original post, try to spot the differences while you re-read everything" |
13:06:07 | absolutejam | Not the cheques I write |
13:06:11 | FromGitter | <mratsim> and where to get it :P |
13:06:19 | PMunch | Well, cash is also just a reference to the gold standard. Or in this day and age just a reference to floaty promises :P |
13:06:29 | FromGitter | <mratsim> if you write blank cheque you would not be a good dev ;) |
13:06:57 | FromGitter | <alehander42> @narimiran ok |
13:06:59 | FromGitter | <alehander42> thanks |
13:07:02 | PMunch | If you haven't worked with memory and stack/heap stuff I can understand why ref/object might be confusing |
13:07:16 | FromGitter | <mratsim> anyway, you can search for value vs reference semantics and you will find plenty of articles on the global concepts |
13:07:27 | narimiran | @alehander42 if you write it, you'll be the first, so our test bunny :) |
13:09:08 | FromGitter | <mratsim> at a low-level, an object is a value and a ref object is an address to the actual object |
13:09:12 | absolutejam | byref and byvalue I get |
13:10:29 | absolutejam | And this is an abstraction vs. using pointers in Go, right? |
13:10:32 | absolutejam | or a lower level language |
13:10:39 | PMunch | I recommend clicking through to the reddit thread as well and read the Q/A after my post |
13:10:58 | absolutejam | like, that is what is actually happening, but Nim generally uses 'val' and such in proc definitions instead of referring to pointers? |
13:11:06 | absolutejam | I'll finish the post you linked |
13:11:07 | PMunch | As I say in the article, a reference is a special kind of pointer |
13:11:20 | PMunch | Basically just means it's GC'ed |
13:12:52 | FromGitter | <mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3744d483c7e377654905cc] |
13:13:21 | FromGitter | <mratsim> @absolutejam —> you see that b has an address “ref 0x10e9b8048 --> 10" |
13:14:03 | FromGitter | <mratsim> 0x10e9b8048 (on my machine) means that the actual value is stored at 0x10e9b8048, and at 0x10e9b8048 memory location there is a “10” stored |
13:15:01 | absolutejam | yeah |
13:15:15 | FromGitter | <zacharycarter> we're getting into the weeds now :) |
13:15:30 | absolutejam | and if you alter the value stored at that memory location, and ref objects are 'updated' because they point to the same value |
13:15:35 | FromGitter | <zacharycarter> love it! |
13:15:43 | absolutejam | well, they're not updated, they _are_ the same value |
13:16:03 | PMunch | Yeah, they all "refer" to the same value |
13:16:30 | PMunch | So if you update the thing one refer to, you update what they all refer to |
13:18:14 | * | zyklon joined #nim |
13:19:00 | PMunch | Imagine having 10 drawers, named 0-9. 0-9 is now a reference to a position in the stack of drawers. If I take a piece of paper and write "Hello" on it and place it in drawer 2. Then tell you to read the note in drawer 2 that's like passing you a reference to that note. If you then take another paper and put it in the drawer everyone that I tell to read the note in drawer 2 will now read your note and not mine. |
13:20:02 | PMunch | Conversely if I give you a note that says "Hello" you will read "Hello", if you change the note that doesn't matter to me because it's your copy. I can still give notes to other people that says "Hello" even if you change your note to say something else. |
13:20:30 | PMunch | The cost of this is of course that I need to make a new copy of my "Hello" note to everyone I want to send my greeting. |
13:25:35 | * | Ven`` joined #nim |
13:26:42 | * | kapil____ joined #nim |
13:28:40 | FromGitter | <mratsim> excellent example |
13:29:00 | PMunch | Haha, my years of working as a TA paying off :P |
13:29:08 | FromGitter | <mratsim> actually we should have something like that as many people are not coming from C/C++ |
13:29:17 | FromGitter | <mratsim> in the new “learn” section |
13:29:25 | FromGitter | <alehander42> @narimiran if i think of something, I'll do it (i'll try to not test it with a radical/impossible idea :D) |
13:29:46 | narimiran | yeah, good idea :) |
13:32:58 | absolutejam | yeah, I feel like it'd be a given if I came from a programming background |
13:33:04 | absolutejam | or even played with languages like Go more |
13:33:43 | absolutejam | but I'm coming from Python and I think the best you get is mutable/immutable objects |
13:40:59 | FromGitter | <mratsim> In Python everything is a reference |
13:50:52 | absolutejam | Trying to understand (both nim and) nim-prompt - How do I initialise ` StatusBarItem* = tuple[label: string, content: string]` |
13:51:02 | absolutejam | an instance of* |
13:52:12 | absolutejam | nevermind, I think I found it |
14:00:30 | * | rockcavera joined #nim |
14:02:22 | * | vlad1777d__ joined #nim |
14:02:30 | * | nsf joined #nim |
14:02:44 | * | zyklon quit (Read error: Connection reset by peer) |
14:06:37 | * | cspar joined #nim |
14:06:51 | * | cspar_ quit (Ping timeout: 246 seconds) |
14:07:02 | PMunch | (label: "Hello", content: "World") |
14:20:04 | FromGitter | <kaushalmodi> absolutejam: I have a bunch of tuple initializing examples here that might help: https://scripter.co/notes/nim/#defining-tuples |
14:20:09 | * | zyklon joined #nim |
14:22:08 | * | Ven`` quit (Ping timeout: 245 seconds) |
14:28:03 | FromGitter | <Clyybber> hmm, anyone experiencing problems with github rn? |
14:28:20 | FromGitter | <Clyybber> timesout for me |
14:28:27 | FromGitter | <zacharycarter> I don't think so? |
14:28:32 | FromGitter | <zacharycarter> actually - nevermind |
14:28:38 | FromGitter | <zacharycarter> the build I just ran doesn't depend on github |
14:28:48 | FromGitter | <zacharycarter> I'll try a github build in 2 moments |
14:29:53 | FromGitter | <zacharycarter> might be more than a moment :/ this redis elasticache cluster is taking a while to provision |
14:30:24 | FromGitter | <Clyybber> does the web interface work for you? |
14:30:52 | FromGitter | <zacharycarter> yes - I just logged in and poked around some repos |
14:31:00 | * | vlad1777d__ quit (Ping timeout: 250 seconds) |
14:31:02 | FromGitter | <Clyybber> huh, weird |
14:31:10 | FromGitter | <Clyybber> im getting timeouts |
14:31:19 | FromGitter | <Clyybber> same with reddit |
14:31:28 | FromGitter | <Clyybber> nvrmind reddit just loaded up |
14:31:39 | FromGitter | <Clyybber> but github doesn't :/ |
14:32:33 | FromGitter | <zacharycarter> weird - maybe proxy or firewall or connectivity issues? |
14:32:37 | FromGitter | <Clyybber> restarted firefox, works now |
14:32:57 | FromGitter | <Clyybber> but my aurhelper couldnt connect either |
14:40:03 | FromGitter | <zacharycarter> hmm |
14:43:19 | FromDiscord_ | <Obstinate> If I have |
14:43:19 | FromDiscord_ | <Obstinate> |
14:43:19 | FromDiscord_ | <Obstinate> var myMap = initTable[int, ref seq[int]]() |
14:43:19 | FromDiscord_ | <Obstinate> |
14:43:20 | FromDiscord_ | <Obstinate> , and I know the seq size needs to be 60, What's the best way to initialize new keys? What I'm doing now: |
14:43:20 | FromDiscord_ | <Obstinate> |
14:43:22 | FromDiscord_ | <Obstinate> if not myMap.hasKey k: |
14:43:23 | FromDiscord_ | <Obstinate> var s: ref seq[int] |
14:43:23 | FromDiscord_ | <Obstinate> s.new |
14:43:25 | FromDiscord_ | <Obstinate> s.newSeq(60) |
14:43:26 | FromDiscord_ | <Obstinate> myMap.add(id, s) |
14:43:27 | FromDiscord_ | <Obstinate> |
14:43:29 | FromDiscord_ | <Obstinate> I feel like this is super verbose though. In Python, I'd probably just write: |
14:43:31 | FromDiscord_ | <Obstinate> |
14:43:32 | FromDiscord_ | <Obstinate> if k not in myMap: |
14:43:34 | FromDiscord_ | <Obstinate> myMap[k] = [0]*60 |
14:43:35 | FromDiscord_ | <Obstinate> Is there a better way to do it in nim than what I'm doing? |
14:45:32 | Zevv | myMap = repeat(0, 60) |
14:45:41 | Zevv | and, please use a pastbin for snippets |
14:47:58 | FromDiscord_ | <Obstinate> type mismatch: got (Table[system.int, ref seq[int]], int, seq[int]) |
14:48:30 | FromDiscord_ | <Obstinate> I think it's wanting a ref seq[int] for the final argument |
14:50:15 | FromGitter | <mratsim> there is no `*` operator at the moment, but it’s discussed from time to time and we have a rfc iirc |
14:50:21 | Zevv | new myMap[k] |
14:50:21 | Zevv | myMap[k][] = repeat(0, 60) |
14:50:23 | Zevv | might work |
14:50:50 | Zevv | the [] dereferences the ref |
14:51:07 | FromDiscord_ | <Obstinate> OK. Thanks. |
14:51:44 | * | Ven`` joined #nim |
14:51:49 | FromDiscord_ | <Obstinate> Is there a set of functions like max, min, etc.? |
14:52:02 | FromDiscord_ | <Obstinate> over collections I mean |
14:52:11 | FromDiscord_ | <Obstinate> so like max(@[1, 2, 3]) => 3 |
14:52:12 | FromDiscord_ | <Obstinate> ? |
14:52:13 | Araq | don't use 'ref seq' |
14:53:16 | absolutejam | Anyone know about the nim-prompt package? |
14:54:28 | Zevv | Araq: I was wondering, is there a reason why the async macro does not transform the proc return value to a Future? I added two lines to asyncSingleProc to put prc.params[0] into a Future bracketexpr if it is an ident, and this seems to work just right for me. |
14:54:56 | Araq | Zevv: we thought it adds clarity |
14:55:24 | Araq | and about your interiorPtr problem, this can be caused by your code |
14:55:53 | absolutejam | holy shit, there's a Discord too |
14:56:00 | Araq | !eval echo max(@[1, 2, 3]) |
14:56:00 | NimBot | Compile failed: <no output> |
14:56:10 | Araq | !eval echo max([1, 2, 3]) |
14:56:10 | NimBot | Compile failed: <no output> |
14:56:14 | Zevv | It does add clarity, but the {.async.} is a dead giveway about what's happening here. |
14:56:16 | Araq | !eval echo max(1, 2, 3) |
14:56:16 | NimBot | Compile failed: <no output> |
14:56:29 | Araq | !eval echo "test" |
14:56:30 | NimBot | Compile failed: <no output> |
14:56:40 | Araq | !eval "test" |
14:56:40 | NimBot | Compile failed: <no output> |
14:56:43 | Zevv | Would something like this be acceptable? http://paste.debian.net/1059559/ |
14:56:47 | Araq | Nimbot is broken |
14:57:47 | Araq | Zevv: seems arbitrary, why should e.g. system.int not be wrapped in the Future[]? |
14:58:19 | Zevv | "something" like this :) |
14:58:33 | Zevv | More like "if it is not a future, then wrap it anyway" |
14:59:10 | absolutejam | Obstinate: There's the inim package for a repl |
15:00:16 | FromGitter | <zacharycarter> it's not a true repl - just letting you know |
15:00:19 | FromGitter | <zacharycarter> not that it isn't a neat project |
15:00:19 | FromGitter | <mratsim> @Araq there are some ref seq in the stdlib |
15:00:28 | * | Ven`` quit (Ping timeout: 250 seconds) |
15:00:45 | FromGitter | <zacharycarter> apparently the HCR stuff is usable now - so someone could start experimenting it with it to create a repl |
15:00:46 | absolutejam | well yeah, but it allows you to echo(max(@[2, 10, 5])) |
15:00:50 | absolutejam | because I wanted to know too haha |
15:00:55 | absolutejam | HCR? |
15:01:04 | FromGitter | <zacharycarter> I'm going to play around with it this weekend - see if I can tie it into my game engine I'm working on |
15:01:08 | FromGitter | <zacharycarter> hot code reloading, for the C target |
15:01:11 | FromGitter | <zacharycarter> the JS target already has such a feature |
15:01:18 | Araq | mratsim: maybe but it's typically a beginner's mistake |
15:01:27 | FromGitter | <zacharycarter> iNim re-compiles the code on every change |
15:01:36 | FromGitter | <mratsim> I asked you about why you didn’t use {.shallow.} in Iember whch collection |
15:02:10 | FromGitter | <zacharycarter> absolutejam: see - https://github.com/nim-lang/Nim/issues/8927 |
15:03:14 | FromGitter | <mratsim> I don’t remember which collection* |
15:03:27 | Zevv | Araq: does it make sense to make a RFC issue for this, or shouldn't I even bother? Also I do not really agree on the clarity. The proc says it returns a Future[T], but result is actually T. That bit me when I first looked into async. |
15:03:52 | * | zyklon quit (Read error: Connection reset by peer) |
15:04:09 | Araq | mratsim: packedjson |
15:04:18 | FromGitter | <mratsim> oh right |
15:04:59 | FromGitter | <mratsim> I guess Araq from November 2018 was a beginner then ;) |
15:05:16 | FromGitter | <zacharycarter> the last comment in that issue thread is interesting |
15:05:19 | FromGitter | <zacharycarter> about LLVM |
15:05:42 | Araq | Zevv: RFC is ok with me, note that we have an RFC repo now |
15:06:32 | FromGitter | <kaushalmodi> absolutejam: From https://github.com/search?utf8=%E2%9C%93&q=prompt+extension%3Animble&type=Code I see only one package using the "prompt" nimble package |
15:06:41 | Araq | mratsim: don't mock me, when I use 'ref seq' it's because I have multiple owners and when others use 'ref seq' it's because they are beginners |
15:06:41 | FromGitter | <kaushalmodi> So looks like it's fairly new. |
15:07:21 | FromGitter | <kaushalmodi> absolutejam: you can find its use in https://github.com/status-im/nim-chronicles-tail/blob/master/ctail.nim. Search for `Prompt.init` |
15:07:45 | FromGitter | <mratsim> That was said in jest. |
15:08:11 | Araq | quod licet iovi non licet bovi. |
15:09:33 | narimiran | Zevv: for writing a RFC: https://github.com/nim-lang/RFCs |
15:14:42 | FromDiscord_ | <Obstinate> If I have a function that's going to do an operation on a hashtable created in a parent function, do I need to do anything in the signature to make sure that the table isn't copied? For example, if I write proc f(h: Table[int, int]), is that going to copy the table? |
15:15:11 | Araq | no |
15:17:05 | FromDiscord_ | <Obstinate> interesting . . . does this apply to all non-primitive types? I kind of expected that I would have to write "ptr Table[int,int]" to make this work. I assume primitive types are copied when used as proc arguments? Or maybe that's not defined since you can't assign to proc arguments unless they have var in front of them? |
15:18:09 | leorize | it's undefined in the spec |
15:18:34 | leorize | currently the compiler copies if the type is smaller or equal to a pointer iirc |
15:19:29 | * | zyklon joined #nim |
15:19:43 | FromDiscord_ | <Obstinate> I see. But from the perspective of the mental model of thinking about proc arguments, the argument is the same entity as the one that was passed, not a copy of it. That's helpful. I assume that taking the address of such an argument would be inadvisable at best? |
15:19:46 | FromGitter | <mratsim> smaller than 3x pointer size |
15:20:24 | FromGitter | <mratsim> think in terms of mutability, if you need to mutate, pass a var Table, if you don’t need to, pass a Table |
15:20:40 | FromGitter | <mratsim> if you need ref semantics, your type should be a ref object |
15:21:19 | FromDiscord_ | <Obstinate> Where by "need ref semantics," you mean, "need to persist a reference to the passed object"? |
15:21:33 | FromDiscord_ | <Obstinate> I'm coming from C++ where you need reference semantics if you don't want to take a copy |
15:21:48 | FromDiscord_ | <Obstinate> But that doesn't seem to apply in nim |
15:22:18 | FromGitter | <alehander42> Zevv, do you want to change `proc e(a: int): int` to `proc e(a: int): Future[int]` ? |
15:22:21 | FromGitter | <alehander42> please, don't do that |
15:22:29 | FromGitter | <mratsim> The cases where you probably need ref semantics are: ⏎ ⏎ 1) your object holds a handler to a non-copiable resource like memory, network connection, database connection ⏎ 2) you need polymorphism [https://gitter.im/nim-lang/Nim?at=5c376335dfe13328202ba9be] |
15:23:11 | absolutejam | thanks kaushalmodi |
15:23:24 | absolutejam | I'm getting it to work somewhat, but there are features like auto complete that I'm tryin to get working |
15:23:40 | absolutejam | I'll happily PR some documentation and examples if I can get it to work |
15:23:41 | FromGitter | <mratsim> Nim will optimize parameter passing for value types if they are big and you don’t need to mutate them |
15:24:02 | FromGitter | <mratsim> i.e. copy if smaller than 3x pointer size, and passing by const reference otherwise |
15:24:09 | FromGitter | <kaushalmodi> absolutejam: 👍 |
15:26:06 | FromDiscord_ | <Obstinate> Does it do the same thing for e.g. let? |
15:26:37 | FromDiscord_ | <Obstinate> For example if I do let x = table[foo] |
15:26:50 | FromDiscord_ | <Obstinate> is x a copy of the value at table[foo]? |
15:27:09 | FromDiscord_ | <Obstinate> Or is it a reference to that value? |
15:30:04 | absolutejam | ohhhh damn this is pretty now that it's working |
15:31:03 | absolutejam | if I import a module that has an import within it, will the imported module do that work for me? |
15:31:11 | absolutejam | at least for its namespace |
15:31:17 | absolutejam | I need to read up on how the imports work I guess |
15:31:40 | absolutejam | So, module a imports module b for internal use. Is importing module a enough? |
15:31:59 | FromGitter | <mratsim> @obstinate, let copies at the moment, until we have destructors+ move semantics implemented |
15:32:02 | FromGitter | <kaushalmodi> absolutejam: what do you mean by "enough"? |
15:32:15 | FromGitter | <alehander42> absoluejam: yes ⏎ ⏎ but if you want to access directly a name defined in b, you need to import it again |
15:32:21 | FromGitter | <alehander42> otherwise you just import a |
15:32:28 | FromGitter | <mratsim> though there are some (buggy) optimisations to avoid copy in certain case for seq and strings. |
15:32:56 | FromGitter | <mratsim> obviously if “table” is a reference type it copies the reference |
15:33:58 | FromDiscord_ | <Obstinate> I see. I guess I could use ptr to take the address of the value to avoid the copy . . . but that doesn't work if the table I'm working with is passed as a parameter |
15:34:05 | FromGitter | <kaushalmodi> absolutejam: I am not understanding the problem completely |
15:34:26 | FromGitter | <kaushalmodi> let's say you are in a.nim where you import b, and in b.nim, you import c |
15:34:31 | FromDiscord_ | <Obstinate> (What I'm trying to do is iterate over a seq in a map without looking it up a bunch of times) |
15:34:33 | FromGitter | <mratsim> @Obstinate, if you’re using a stdlib Table you won’t have a copy. |
15:34:36 | FromGitter | <kaushalmodi> then you cannot access stuff from c in a.nim |
15:34:40 | * | mbomba joined #nim |
15:34:46 | FromGitter | <mratsim> and you can use a TableRef if you want to be sure |
15:35:06 | FromGitter | <kaushalmodi> absolutejam: you need to either import c in a.nim as well, or *export* c in b.nim |
15:35:09 | FromDiscord_ | <Obstinate> @mratsim Nice! Is this a special optimization for the stdlib table? |
15:35:20 | absolutejam | basically, if I import module a |
15:35:25 | absolutejam | which imports module b within itself |
15:35:32 | absolutejam | that is done automatically right? |
15:35:42 | absolutejam | I assume it would be, but I just had a bad example |
15:35:48 | absolutejam | let me check |
15:35:54 | * | sheerluck quit (Quit: Leaving) |
15:36:00 | FromGitter | <kaushalmodi> absolutejam: https://nim-lang.github.io/Nim/manual.html#modules-export-statement |
15:36:04 | absolutejam | I imported a module that required me to then import another module for it to work |
15:36:17 | FromGitter | <kaushalmodi> hehe, the manual uses the same a b c example; very likely I got it from there :) |
15:36:20 | absolutejam | but I wonder if the imported module just missed the import |
15:36:24 | FromGitter | <mratsim> no, it’s just that in general, parameter passing doesn’t copy in Nim |
15:36:46 | FromGitter | <mratsim> only primitive, cheap types are copied |
15:37:20 | FromDiscord_ | <Obstinate> Right, but the let will copy, right? Is there a way to introduce an alias for the sequence in the map, so that I can iterate over it without repeated lookups? |
15:37:21 | FromGitter | <mratsim> you can always inspect the C/C++ code generated, it in your ~/.cache/nim folder |
15:37:29 | FromGitter | <kaushalmodi> absolutejam: you can look at one of my projects: https://github.com/kaushalmodi/ntodo/blob/master/src/ntodopkg/core.nim |
15:37:30 | * | absolutejam_phon joined #nim |
15:37:52 | FromGitter | <kaushalmodi> notice this in that core.nim: ⏎ ⏎ ```import ./globals ⏎ export globals``` [https://gitter.im/nim-lang/Nim?at=5c3766d054d8bb07cccb4783] |
15:38:11 | FromGitter | <kaushalmodi> I do that so that wherever I `import core`, I also get stuff from `global` for free |
15:38:29 | FromGitter | <mratsim> @obstinate, 2 ways: use a pointer: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/data_structure.nim#L196-L201 ⏎ ⏎ Or a shallow copy: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/data_structure.nim#L104-L107 |
15:38:50 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
15:40:27 | * | floppydh quit (Quit: WeeChat 2.3) |
15:40:47 | FromGitter | <mratsim> what I would do is `let seqAdr = table[myIndex].addr` and `for i in seqAdr[]: foo()` |
15:41:32 | FromGitter | <mratsim> but this would not look uple time either: ⏎ ⏎ `for i in table[myIndex]: foo()` |
15:41:59 | FromGitter | <mratsim> and if you want to mutate in place, use mget: https://nim-lang.org/docs/tables.html#mget%2CTable%5BA%2CB%5D%2CA |
15:42:11 | Zevv | Yay, RFC 0001 :) |
15:42:47 | FromDiscord_ | <Obstinate> I see. Hrm. |
15:43:05 | FromDiscord_ | <Obstinate> So the addr approach works if it's a map I can take an address of |
15:43:08 | FromGitter | <kaushalmodi> Zevv: ? |
15:43:15 | FromGitter | <mratsim> yes |
15:43:17 | FromGitter | <kaushalmodi> there are already 80 RFCs there |
15:43:17 | FromDiscord_ | <Obstinate> But I can't take the address of a table passed as a parameter |
15:43:23 | FromGitter | <mratsim> unsafeAddr |
15:43:37 | Zevv | Yeah but mine seems to be the first one in the new RFC repo |
15:43:42 | Zevv | https://github.com/nim-lang/RFCs |
15:43:53 | Zevv | So I took the liberty to prefix the name with "0001" :) |
15:43:55 | FromDiscord_ | <Obstinate> Sure, I meant safely. Although the operation I'm doing is actually safe |
15:44:01 | FromGitter | <kaushalmodi> Zevv: ah, I see :) |
15:44:52 | FromGitter | <mratsim> @Obstinate, if you have some pseudocode I can show you the Nim way and efficient way as well. |
15:45:10 | FromGitter | <mratsim> There is probably no need to work at the address level but I would have to see the code first |
15:45:25 | FromDiscord_ | <Obstinate> I'll put the whole thing I'm doing in a gist. |
15:46:09 | FromDiscord_ | <Obstinate> https://gist.github.com/jaguilar/b62fd28830a67ff2ae9176e36665ceb8 |
15:46:41 | FromDiscord_ | <Obstinate> efficiency is not *actually* important here. I'm just trying to understand what Nim is actually doing |
15:47:01 | FromGitter | <mratsim> GuardSchedule is a seq of int? |
15:47:11 | Zevv | Ah, picking up on your AoC, right :) |
15:47:25 | * | s3govesus joined #nim |
15:47:38 | * | absolutejam_phon joined #nim |
15:48:04 | narimiran | Zevv: congrats on being our first :D |
15:48:07 | FromGitter | <mratsim> Nim won't copy the "guards: Table" |
15:48:23 | Zevv | thanks. I hope it makes any sense, though. |
15:48:43 | FromDiscord_ | <Obstinate> Yeah I'm on paternity leave and I've been wanting to check nim out |
15:48:44 | FromGitter | <alehander42> Zevv: congrats for the RFC |
15:48:59 | FromGitter | <mratsim> let bestGuardSchedule = guards[bestGuard] <— this copies the seq though. |
15:49:01 | FromGitter | <alehander42> :D 0001 is nice, you leave digits for quite a few more |
15:49:06 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
15:49:10 | FromDiscord_ | <Obstinate> Yeah, that's the particular thing I want to understand how to do better |
15:49:32 | FromDiscord_ | <Obstinate> In most other languages I know how to make that not be a copy, but I don't know how in nim |
15:49:50 | FromGitter | <alehander42> Zevv: there was a similar idea in the tracker 1 or 2 years ago, but i couldn't find a link |
15:50:17 | FromGitter | <mratsim> in Nim basically: parameter passing only copies cheap primitive types |
15:50:50 | FromGitter | <kaushalmodi> Zevv: Are you used to creating git patch files and submitting via email? |
15:51:05 | FromGitter | <mratsim> `let` always copy the shallow level (if ref type it copies the reference, if pointer it copies the pointer) |
15:51:20 | FromGitter | <mratsim> only exception is for strings and seq builtin types where copy is deep. |
15:51:31 | FromGitter | <mratsim> (i.e. they have value semantics) |
15:51:35 | Zevv | Obstinate: I must admit this is one of my issues with Nim still. In other languages I often like to make 'convenience' references to avoid a lot of code repetition if I'm doing stuff in a deep type, like "guards[0].state.sleep.time = 1; guards[0].state.awake.time = 3". You can't just say "let s = guards[0].state" and then mutate things in "s". And I'm still not sure if there is a good idiom for this in Nim. |
15:52:01 | FromGitter | <mratsim> template s = guards[0].state |
15:52:08 | Zevv | you say |
15:52:10 | Zevv | no |
15:52:17 | Zevv | *grin* |
15:52:33 | FromDiscord_ | <Obstinate> mratsim: really? |
15:52:35 | FromGitter | <alehander42> haha, crafty |
15:52:36 | * | Zevv is off to refactor tons of code |
15:52:50 | FromGitter | <mratsim> yeah really :P template is code substitution |
15:52:58 | FromGitter | <kaushalmodi> Zevv: ok, thought so, because https://git-scm.com/docs/git-format-patch (search for `0001-`) |
15:53:01 | Araq | both template and 'addr' is ok for this |
15:53:02 | FromGitter | <mratsim> maybe you need template s: untyped = foo, but yeah |
15:53:30 | FromDiscord_ | <Obstinate> OK. Interesting. But if it's just code substitution, doesn't that induce the lookup on each access? |
15:53:37 | Araq | I usually use helper procs though that take a 'var T' parameter |
15:53:43 | FromGitter | <mratsim> compile-time code substitution |
15:53:44 | FromDiscord_ | <Obstinate> Meaning I 'm doing 60 hashtable lookups? |
15:53:56 | Araq | yeah you do |
15:53:59 | FromGitter | <mratsim> tdress in hat case |
15:54:04 | FromGitter | <mratsim> take the address* |
15:54:08 | FromGitter | <mratsim> my keyboard ... |
15:54:09 | FromDiscord_ | <Obstinate> And address doesn't work unless I pass a var parameter |
15:54:11 | FromDiscord_ | <Obstinate> Right? |
15:54:16 | FromGitter | <mratsim> unsafeAddr |
15:54:21 | Zevv | kaushalmodi: sorry? |
15:54:25 | Araq | unsafeAddr always works |
15:54:27 | FromDiscord_ | <Obstinate> Right, I'm trying to restrict myself to the safe part of the language |
15:54:47 | FromDiscord_ | <Obstinate> (I assume that's a best practice since otherwise it wouldn't be called unsafe) |
15:54:49 | FromDiscord_ | <Obstinate> ? |
15:54:54 | Araq | an 'alias' instruction would be nice to have |
15:54:57 | FromGitter | <kaushalmodi> Zevv: Nevermind, I just thought that you might be familiar with the git format patch flow as you have your RFC prefixed with 0001-, that's all |
15:54:59 | FromGitter | <kaushalmodi> :) |
15:55:11 | FromGitter | <mratsim> addr is not allowed for non-var to prevent people escaping or mutating an immutable let variable |
15:55:19 | Araq | but hey, some things need to be left for Nim v2 |
15:55:30 | FromDiscord_ | <Obstinate> Araq: true true |
15:55:36 | FromGitter | <kaushalmodi> Zevv: emailing git formatted patch files is grandfather of GitHub PR's and all |
15:56:04 | Araq | Zevv: a helper proc that takes a 'var T' is safe and can be hidden in a template/macro |
15:56:14 | FromGitter | <mratsim> I’d love an alias, but that’s what template are for, it’s just that template is a bit long to type. |
15:56:21 | Zevv | Ah yes of course. There should be some of my code in the linux kernel somewhere, but that was only a single patch, so no prefixes there |
15:56:26 | FromGitter | <kaushalmodi> Zevv: taking your PR as example, a patch file looks like this: https://patch-diff.githubusercontent.com/raw/nim-lang/RFCs/pull/83.patch :) |
15:56:32 | Zevv | Araq: true, thanks for that |
15:56:37 | Araq | but if you hide it you might as well use an unsafeAddr |
15:56:40 | FromGitter | <mratsim> Can we have `tpl` as a keyword :P |
15:56:48 | * | absolutejam_phon joined #nim |
15:57:31 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
15:58:37 | Araq | mratim: Zahary wants to allow var x: var T = expression instead but IMO that's ugly ;-) |
15:58:52 | FromGitter | <mratsim> ugh yeah |
15:59:11 | FromGitter | <zah> ugly, but useful :P |
15:59:27 | FromGitter | <mratsim> welcome to Rust ? ;) |
15:59:37 | Araq | alias x = expression ? full builtin, new keyword even |
15:59:46 | FromGitter | <kaushalmodi> narimiran: Why are some pages on the Nim website written almost in HTML? |
15:59:59 | FromGitter | <mratsim> maybe nim rst2html? |
16:00:12 | narimiran | i have no idea why, i just inherited it the way it is :) |
16:00:25 | FromGitter | <kaushalmodi> no, they are a blend of some Jekyll templating and HTML and *gasp* content |
16:00:33 | FromGitter | <mratsim> composition > inheritance @narimiran ;) |
16:00:46 | FromGitter | <zah> Araq, sometimes, I'm going to use it like this: ⏎ ⏎ ```var x: forwardType(foo()) = foo() ⏎ ``` [https://gitter.im/nim-lang/Nim?at=5c376c2def78da1bcedcd014] |
16:00:58 | narimiran | btw, for you who weren't here this morning — we have a new page with learning resources: https://nim-lang.org/learn.html |
16:01:10 | FromGitter | <Clyybber> what would var x: var T mean? |
16:01:15 | narimiran | if you think that something needs to be added, let me know |
16:01:33 | narimiran | (nim notes, and rosetta code were already mentioned, and will be included) |
16:02:02 | Araq | Clyybber: it takes the 'var T' parameter type and applies consistently to a 'var'iable |
16:02:05 | FromGitter | <kaushalmodi> narimiran: yay! thanks. I thought the notes didn't meet the bar |
16:02:15 | FromGitter | <zah> code like the above would be harder to write if there is a new required keyword. there might be a new alternative syntax though |
16:02:34 | FromGitter | <mratsim> btw regarding aliases, for types: do we want to allow “let”, currently we have type and const - https://github.com/nim-lang/Nim/issues/10004 |
16:02:49 | FromGitter | <mratsim> ^ easy issue to close if it’s not allowed |
16:02:51 | narimiran | @kaushalmodi no, it is that there are lots of things *somewhere*, and i just forgot all the places i need to look for |
16:05:03 | FromGitter | <kaushalmodi> narimiran: Do you know if Jekyll allows data files? |
16:05:04 | * | zyklon quit (Read error: Connection reset by peer) |
16:05:12 | narimiran | no idea, sorry |
16:05:26 | * | cspar_ joined #nim |
16:05:34 | FromGitter | <kaushalmodi> ok |
16:05:35 | FromGitter | <Clyybber> @Araq > applies consistently to a 'var'iable ⏎ Does that mean I could define types that could only be used for 'var'iables? |
16:05:46 | * | mbomba left #nim ("WeeChat 1.4") |
16:05:50 | Araq | no. |
16:06:05 | Araq | it's just more of T& if you know C++ |
16:06:57 | * | cspar quit (Ping timeout: 252 seconds) |
16:07:00 | FromGitter | <kaushalmodi> Just in case anyone knows Jekyll well, the learn page's content should probably be moved to a separate "data" file like this: https://github.com/kaushalmodi/ox-hugo/blob/master/doc/data/users.toml (could be TOML/JSON/CSV/..) and have the template file just loop through it |
16:07:16 | FromGitter | <kaushalmodi> I use that data file to generate https://ox-hugo.scripter.co/doc/examples/ using Hugo |
16:08:25 | Araq | we don't use Jekyll well, we replaced the .tmpl Nim based website with Jekyll because of reasons |
16:08:26 | FromGitter | <mratsim> A static web site generator in Nim similar to Hugo, Gatsby, Jekyll would be nice |
16:08:48 | Araq | we had it, it got butchered. |
16:09:06 | FromGitter | <Clyybber> @Araq Any examples of what use cases would it enable? ⏎ I can't really follow tbh :D |
16:10:04 | FromGitter | <kaushalmodi> @mratsim I have heard of https://github.com/h3rald/hastysite |
16:10:41 | FromGitter | <kaushalmodi> But seriously I just Hugo as one of the best static site gens. It has a single statically built binary that Just Works (TM). |
16:11:00 | FromGitter | <kaushalmodi> I now see it as a common CLI utility along the likes of diff, cp, etc |
16:11:31 | FromGitter | <kaushalmodi> s/I just/I see |
16:12:14 | Araq | Clyybber: basically a variant of Delphi's 'with' statement |
16:12:32 | Araq | Javascript also has it iirc |
16:13:23 | * | absolutejam_phon joined #nim |
16:13:38 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
16:14:03 | FromGitter | <mratsim> Excel too :P |
16:14:23 | Araq | right, VB also has it |
16:14:26 | * | absolutejam_phon joined #nim |
16:14:54 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
16:15:02 | FromGitter | <mratsim> @kaushalmodi seems like I heard about it because I have it starred, but I completely forgot about it :D |
16:15:45 | FromGitter | <mratsim> https://github.com/segmentio/metalsmith is also very short for a static webpage comiler |
16:15:46 | Araq | hmm so Pascal had a typesafe borrowing mechanism in 1980. I'm not surprised |
16:16:29 | Araq | you don't need any new tool at all, use the Nim .tmpl template file mechanism |
16:16:32 | * | PMunch quit (Remote host closed the connection) |
16:16:45 | FromGitter | <Clyybber> Isn't Delhi's with statement more like `using` in Nim, a syntactic sugar? I have a feeling I'm thinking of the wrong thing. |
16:17:10 | * | absolutejam quit (Ping timeout: 250 seconds) |
16:19:01 | Araq | Modula 2 also had it, https://www.modula2.org/reference/withstatements.php |
16:19:09 | * | cspar_ quit (Ping timeout: 246 seconds) |
16:20:43 | Araq | Clyybber: in a way it's "evaluate once" sugar |
16:21:18 | * | zyklon joined #nim |
16:21:48 | * | vegax87 quit (Ping timeout: 252 seconds) |
16:23:14 | FromGitter | <Clyybber> How is `var x: var T = expression` similar to that though? |
16:23:52 | Araq | with expression: field = 4 |
16:24:03 | Araq | var x: var T = expression; x.field = 4 |
16:25:00 | FromGitter | <Clyybber> Ah, ok got it. I feel so dumb now... |
16:25:24 | FromGitter | <Clyybber> But I agree that an alias keyword is a bit more beautiful |
16:25:34 | Araq | what is not named cannot escape its stack frame. |
16:25:44 | Araq | these constructs are only similar. |
16:26:05 | Araq | the Pascal variant sucks in readability but you don't need a borrow checker |
16:30:03 | * | cspar joined #nim |
16:41:06 | Araq | (of course, it also helps that Pascal lacks growable arrays) |
16:43:48 | * | narimiran quit (Ping timeout: 245 seconds) |
16:44:53 | * | absolutejam_phon joined #nim |
16:45:20 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
16:56:43 | * | cspar quit (Ping timeout: 246 seconds) |
16:56:50 | * | cspar joined #nim |
16:57:12 | * | vegax87 joined #nim |
17:02:28 | * | nsf quit (Quit: WeeChat 2.3) |
17:05:38 | FromGitter | <Clyybber> @Araq Is there a difference between `var x: var T = ...` and `var x: T = ...` ? |
17:07:06 | * | ng0 joined #nim |
17:08:50 | * | rockcavera quit (Remote host closed the connection) |
17:10:07 | Araq | yes |
17:11:39 | * | Trustable joined #nim |
17:12:39 | Araq | var x: T = f() produces a copy/move, it's not a view into the data |
17:13:26 | * | darithorn joined #nim |
17:14:55 | * | absolutejam_phon joined #nim |
17:15:16 | * | shpx joined #nim |
17:16:05 | FromGitter | <Clyybber> Neat |
17:17:50 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
17:25:24 | * | kapil____ quit (Quit: Connection closed for inactivity) |
17:26:20 | * | absolutejam_phon joined #nim |
17:26:38 | * | lritter joined #nim |
17:26:38 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
17:39:15 | * | Tyresc joined #nim |
17:40:12 | FromGitter | <Clyybber> @Araq Regarding https://github.com/nim-lang/Nim/pull/9150 , what new ambiguities could it lead to? |
17:40:35 | FromGitter | <Clyybber> The PR enables really cool features, don't you agree? |
17:42:53 | FromGitter | <skellock> hello! was wondering if anyone else is experiencing a `nimble update` ssl error on `devel` on osx 10.14.2 ( libressl 2.6.5). `stable` works great, just not `devel`. i can dig in, but wanted to yell down the rabbit hole first before jumping. |
17:44:45 | FromGitter | <kaushalmodi> @skellock wild guess .. may be related to https://github.com/nim-lang/Nim/commit/3ed833198b95e74de29d2b0905247ead52478aa3 and https://github.com/nim-lang/Nim/commit/21078798ead6f6ba107102913cd26970ef957e9d ? |
17:45:07 | FromGitter | <kaushalmodi> .. or may be not |
17:45:14 | FromGitter | <kaushalmodi> you are dealing with `nimble update` right? |
17:45:31 | FromGitter | <skellock> correct, and thx for those links! |
17:50:19 | FromGitter | <Clyybber> @narimiran https://github.com/nim-lang/Nim/issues/5645 seems to be fixed |
17:58:46 | * | absolutejam_phon joined #nim |
17:59:06 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
17:59:43 | * | Marumoto joined #nim |
18:01:01 | * | absolutejam_phon joined #nim |
18:01:04 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
18:03:48 | * | absolutejam_phon joined #nim |
18:03:57 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
18:04:20 | Araq | Clyybber: it would require an RFC and a spec update first |
18:04:52 | Araq | "enables cool features" doesn't cut it anymore |
18:07:20 | * | zyklon quit (Read error: Connection reset by peer) |
18:08:02 | FromGitter | <Clyybber> Sadly Lemonboy seems to have disappeared, so he can't write an RFC. |
18:08:41 | Araq | yeah he is missed |
18:11:44 | FromGitter | <skellock> @kaushalmodi definitely a linking issue on my env ... i had libressl installed (due to playing with the pony lang) and was some how a problem. i removed libressl and `choosenim update devel` and everything works. thx again. |
18:17:35 | FromGitter | <Clyybber> Hmm, the move to an RFC repo seems to have backfired, since the purpose of RFC is to receive comments/discussion, but the RFC repo is really unknown to most people it seems. |
18:19:58 | Araq | we need to announce it again |
18:20:13 | Araq | and link to it from everywhere else |
18:21:44 | FromGitter | <kaushalmodi> Won't it be tedious to update the RFC md file? |
18:21:59 | FromGitter | <kaushalmodi> so the comments on that RFC .md file will live in the Issues? |
18:22:09 | FromGitter | <alehander42> github has web ui for that |
18:22:15 | FromGitter | <alehander42> not harder than an issue |
18:22:40 | FromGitter | <kaushalmodi> you mean just comment inline on specific line numbers on the md file? |
18:23:00 | FromGitter | <alehander42> you can edit files directly on github |
18:23:11 | FromGitter | <alehander42> (about update) |
18:23:15 | FromGitter | <kaushalmodi> but you need commit rights |
18:23:28 | FromGitter | <kaushalmodi> else each comment will be a new PR |
18:23:38 | FromGitter | <alehander42> but you update the file in your PR technically |
18:24:23 | FromGitter | <kaushalmodi> ok, can you edit your own PR from GitHub webui (never tried that) |
18:24:34 | * | zyklon joined #nim |
18:24:36 | FromGitter | <alehander42> i guess so :D |
18:24:39 | FromGitter | <alehander42> not too sure |
18:24:54 | FromGitter | <kaushalmodi> still.. this physical md file idea looks convoluted |
18:25:06 | FromGitter | <kaushalmodi> you cannot quickly edit/review your changes as you do in issues |
18:25:27 | FromGitter | <kaushalmodi> Not that I have filed any RFCs till date, but this flow seems too convoluted |
18:25:30 | FromGitter | <Clyybber> I agree, especially since github has a feature now, where you can view the edit history of an issue |
18:25:46 | FromGitter | <kaushalmodi> like the version of Sharepoint/Confluence from corporate entering this project :P |
18:25:54 | FromGitter | <alehander42> so, you think that having the rfc-s directly as issues would be better? |
18:25:59 | FromGitter | <kaushalmodi> yep |
18:26:06 | FromGitter | <Clyybber> @kaushalmodi Look at ponyc for an example how the sytem can fail |
18:26:09 | FromGitter | <alehander42> and eventually saving them as documents when they are accepted |
18:26:33 | Araq | previously this "I updated the RFC, please have a look" was a minor problem |
18:26:34 | FromGitter | <kaushalmodi> @Clyybber which system are you referring to? |
18:26:48 | Zevv | Well, as the proud author of RFC #0001, I can say I like the process. Authoring a small document instead of just jotting something down in a form forces you to sit on your hands and hink before you type. |
18:26:52 | Araq | which hints that these things should be version conrtolled |
18:27:01 | * | xet7 quit (Quit: Leaving) |
18:27:08 | FromGitter | <Clyybber> @kaushalmodi https://github.com/ponylang/rfcs |
18:27:12 | Araq | ^ what Zevv said was also our intention |
18:27:15 | Zevv | And with updates to the document the history is preserved |
18:27:31 | FromGitter | <Clyybber> @Zevv Yeah thats a real advantage |
18:27:41 | Araq | note that RFC != feature request |
18:27:57 | Araq | some feature requests are simple and don't require a full RFC |
18:28:36 | FromGitter | <Clyybber> Hmm, what makes https://github.com/nim-lang/Nim/pull/9150 require an RFC? |
18:28:51 | * | xet7 joined #nim |
18:28:58 | FromGitter | <kaushalmodi> @Clyybber why do the discussions happen on the ponylang RFCs? |
18:29:05 | FromGitter | <kaushalmodi> s/why/where |
18:29:11 | FromGitter | <alehander42> Araq, thanks for the membership (kind hard to see in github: i am not sure it sends notifications at all) |
18:29:34 | FromGitter | <alehander42> otherwise RFC-s should take a bit of work indeed |
18:29:38 | Araq | there is a spec dealing with overloading, subtyping etc. pull/9150 doesn't address anything of that |
18:30:15 | Araq | and yes, the implementation has bugs and the spec is often much too terse |
18:30:49 | Araq | but that cannot justify to just add more undocumented typing rules |
18:30:54 | FromGitter | <alehander42> i imagine them to describe bigger / impactful changes which will require a nontrivial amount of compiler work, so they need to "pay" a min price in being well described/clear/detailed |
18:30:55 | FromGitter | <Clyybber> Ok, makes sense |
18:32:07 | FromGitter | <Clyybber> @kaushalmodi They comment on the PR's which are the RFC's. They use the issues of that repo to request RFC's, which is very weirdly convoluted IMO. |
18:32:14 | Araq | besides, I can argue that this form of overloading is against the purpose of overloading. |
18:32:36 | Araq | bbl |
18:32:40 | FromGitter | <Clyybber> bb |
18:32:47 | FromGitter | <kaushalmodi> @Clyybber So a PR getting merged means the RFC got accepted? |
18:32:52 | FromGitter | <Clyybber> Yeah |
18:33:08 | FromGitter | <kaushalmodi> OK, that makes sense |
18:33:11 | FromGitter | <kaushalmodi> thanks |
18:33:16 | FromGitter | <Clyybber> But that doesn't mean it gets implemented. |
18:33:56 | FromGitter | <Clyybber> The coordination between RFC and Implementation does not go hand in hand there. |
18:34:11 | FromGitter | <Clyybber> I feel like thats the biggest problem with such a RFC system |
18:36:26 | * | xet7 quit (Quit: Leaving) |
18:36:47 | * | absolutejam joined #nim |
18:50:08 | * | wildlander joined #nim |
18:51:44 | * | krux02 quit (Remote host closed the connection) |
18:52:28 | absolutejam | https://github.com/nim-lang/RFCs/issues/48 looks nice from what I was asking earlier |
18:52:46 | absolutejam | opened the tab earlier but didn't get chance to read |
18:53:55 | absolutejam | is there a way to list an object's properties? |
18:54:01 | absolutejam | like dir() in Python |
18:56:57 | Zevv | fields() |
18:58:08 | Zevv | or fieldPairs() |
18:58:29 | absolutejam | ooh ty, I'll test in a min |
18:58:30 | absolutejam | brb |
18:58:31 | Zevv | http://paste.debian.net/1059590/ |
18:58:46 | Zevv | nevermind the imports in that snippet, I just happened to have that file open |
19:00:59 | * | nsf joined #nim |
19:01:11 | * | narimiran joined #nim |
19:04:50 | * | rockcavera joined #nim |
19:17:02 | narimiran | "What should be in the Python standard library?" https://lwn.net/SubscriberLink/776239/9abcd828e0178429/ |
19:17:02 | * | zyklon quit (Read error: Connection reset by peer) |
19:21:46 | * | absolutejam quit (Ping timeout: 250 seconds) |
19:23:40 | * | absolutejam_phon joined #nim |
19:23:59 | Zevv | good question |
19:24:03 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
19:25:03 | Zevv | " No firm conclusions were drawn in the discussion, but part of the underlying problem seems to be a lack of clarity on what the purpose of the standard library is." |
19:25:06 | Zevv | haha |
19:27:30 | * | absolutejam_phon joined #nim |
19:27:51 | * | absolutejam_phon quit (Read error: Connection reset by peer) |
19:28:02 | * | xet7 joined #nim |
19:31:36 | * | absolutejam joined #nim |
19:33:47 | * | zyklon joined #nim |
19:38:21 | absolutejam | is `foo=`(bar: MyType) really the best syntax for a 'setter' :[ |
19:39:08 | Zevv | I don't know, what would you like instead? |
19:39:11 | narimiran | absolutejam: a better way is to not use getters and setters ;) and even better than that: don't use OOP ;) |
19:40:39 | absolutejam | I just think the backticks make it a little cumbersome *shrug* |
19:41:16 | absolutejam | I know they have to be there for it to be valid |
19:42:54 | * | nsf quit (Quit: WeeChat 2.3) |
19:43:48 | * | cspar quit (Ping timeout: 245 seconds) |
19:49:26 | absolutejam | can I compile static assets into my binary? |
19:50:32 | FromDiscord_ | <exelotl> absolutejam: hah I spent a lot of time trying to figure this out :') |
19:53:17 | Zevv | absolutejam: You mean like assets from disk? |
19:53:28 | absolutejam | yeah, json files |
19:53:45 | Zevv | no problem |
19:53:55 | Zevv | you can just readFile into a const |
19:54:02 | zestyr | you can also use this https://github.com/xmonader/nimassets |
19:54:09 | Zevv | http://paste.debian.net/1059604/ |
19:54:31 | FromDiscord_ | <exelotl> there's also staticRead: https://nim-lang.org/docs/system.html#staticRead%2Cstring |
19:55:18 | Zevv | how is staticread different from readfile? |
19:55:25 | * | cspar joined #nim |
19:56:33 | zestyr | is it just me, or did the search feature on the nim docs stop working? tried with two different browsers |
19:57:02 | FromDiscord_ | <exelotl> Zevv: one difference is that it doesn't depend on the OS, which happens to be useful in my case |
19:57:20 | FromDiscord_ | <exelotl> as in you can staticRead with --os:standalone |
20:07:33 | Zevv | ok |
20:08:45 | * | BigEpsilon quit (Quit: WeeChat 2.3) |
20:12:15 | * | LargeEpsilon quit (Ping timeout: 252 seconds) |
20:16:12 | * | Baba2 joined #nim |
20:16:34 | * | Marumoto quit (Remote host closed the connection) |
20:28:26 | * | baba3 joined #nim |
20:29:01 | * | Baba2 quit (Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org) |
20:31:16 | * | Ven`` joined #nim |
20:36:20 | FromDiscord_ | <moerm> hello |
20:42:19 | * | Marumoto joined #nim |
20:42:52 | FromDiscord_ | <exelotl> yo |
20:49:54 | absolutejam | hey |
20:51:32 | FromGitter | <dom96> Zevv: you can't readFile into a constant. You need to use staticRead |
20:52:23 | * | zyklon quit (Read error: Connection reset by peer) |
20:57:14 | Zevv | ehm. I can |
20:57:25 | Zevv | works just fine? |
21:00:27 | * | Ven`` quit (Ping timeout: 240 seconds) |
21:00:29 | * | tiorock joined #nim |
21:00:29 | * | rockcavera quit (Killed (hitchcock.freenode.net (Nickname regained by services))) |
21:00:29 | * | tiorock is now known as rockcavera |
21:00:34 | * | baba3 quit (Ping timeout: 250 seconds) |
21:01:57 | rayman22201 | I see the conspiracy now! @narimiran makes a cool new learn page on the website, and secretly removes dochack.js because he dislikes my doc search code so much :-P |
21:02:27 | dom96 | Zevv: Really? Can you show me the code? |
21:03:01 | Zevv | http://paste.debian.net/1059604/ |
21:03:02 | Zevv | :) |
21:04:16 | rayman22201 | The problem with dochack.js is that the path is wrong. It's set to "https://nim-lang.org/docs/dochack.js" and it should be "https://nim-lang.org/dochack.js" |
21:04:38 | rayman22201 | This feels like deja vu... somehow |
21:05:14 | dom96 | Araq: Why does readFile now work with const? |
21:05:22 | rayman22201 | I think @kaushalmodi fixed it last time. I'm not sure |
21:06:04 | Zevv | fcb5cdcc May 24 2016: "Add ``readFile`` implementation for nimvm" |
21:07:44 | narimiran | rayman22201: shit, you got me :P |
21:08:14 | narimiran | btw, thanks! (i'll take 'cool' as the compliment :)) |
21:08:28 | dom96 | Okay, so having it at compile-time does make sense |
21:08:43 | rayman22201 | definitely is a compliment @narimiran! |
21:09:01 | dom96 | Nice to see new people around here, welcome everyone :) |
21:09:10 | * | zyklon joined #nim |
21:09:18 | narimiran | dom96: it worked even year ago |
21:09:31 | narimiran | i remember using it like that for AoC 2017 |
21:09:46 | dom96 | narimiran: yes, zevv posted the commit above |
21:09:54 | FromGitter | <kaushalmodi> rayman22201: Yes, I had moved dochack.js at the site root |
21:10:02 | FromGitter | <kaushalmodi> it's still at https://nim-lang.github.io/Nim/dochack.js in devel docs |
21:10:24 | narimiran | @kaushalmodi that broke our searches |
21:10:33 | oculux | @dom96; thank you for the warm welcome :) |
21:10:42 | FromGitter | <kaushalmodi> narimiran: ? |
21:10:47 | FromGitter | <kaushalmodi> the search is working too |
21:10:51 | narimiran | it is not |
21:10:53 | rayman22201 | not on the main site |
21:10:55 | narimiran | clear your cache |
21:11:15 | narimiran | it is working for dev docs, but not for 0.19.2 docs |
21:11:46 | FromGitter | <kaushalmodi> the location of that .js is correct |
21:11:51 | Zevv | https://nim-lang.org/docs/manual.html is not working indeed |
21:12:01 | FromGitter | <kaushalmodi> whatever is generating the .js link reference needs to be fixed |
21:12:09 | FromGitter | <kaushalmodi> *digging up that issue ATM* |
21:12:17 | * | absolutejam quit (Quit: WeeChat 1.9.1) |
21:12:18 | rayman22201 | The location is fine, but the nim-lang.org version of the site generated an incorrect link path. |
21:12:29 | narimiran | maybe it is fixed in devel but it needs to be backported to 0.19 branch? |
21:12:34 | Zevv | speaking of the search - I feel that since the fuzzy algorithm the search results are very noise. Is that just me? |
21:12:40 | Zevv | s/noisy/ |
21:13:23 | rayman22201 | I know. I had started work with @timotheecour a few months ago to make it better. But the scope got big and I didn't have enough free time to finish it over the holidays. |
21:13:24 | FromGitter | <kaushalmodi> rayman22201: yes |
21:13:32 | FromGitter | <kaushalmodi> the referenced issue: https://github.com/nim-lang/Nim/issues/9104#issuecomment-425508998 |
21:14:00 | FromGitter | <kaushalmodi> Earlier the dochack reference link was `<script type="text/javascript" src="../dochack.js"></script>` |
21:14:17 | FromGitter | <kaushalmodi> but https://nim-lang.github.io/Nim/ is the root of devel docs |
21:14:25 | FromGitter | <kaushalmodi> so no `../` reference is possible from there |
21:14:59 | Zevv | rayman22201: thats how these things go. I think it would be great if there was a clear disticnction between literal matches and fuzzy matches. If I type "sett" I now get stuff with set[T] in the argument list... |
21:15:38 | narimiran | Zevv: typing sett and getting set[T] is great! i had some veeery weird results |
21:15:47 | Zevv | hehe |
21:15:51 | rayman22201 | @kuashalmodi, so maybe your fix just needs to be backported? |
21:16:12 | FromGitter | <kaushalmodi> @narimiran the thing to debug and fix is that if https://nim-lang.github.io/Nim/dochack.js exists, why doesn't https://nim-lang.org/docs/dochack.js ? |
21:16:39 | FromGitter | <kaushalmodi> some script should be copying the dochack.js to https://nim-lang.org/docs/ when deploying |
21:16:42 | rayman22201 | dochack.js exists, but it got put in the root directory |
21:16:53 | rayman22201 | https://nim-lang.org/dochack.js |
21:17:03 | narimiran | @kaushalmodi (oh, rayman22201 was quicker) |
21:17:05 | FromGitter | <kaushalmodi> hmm understood |
21:17:57 | FromGitter | <kaushalmodi> so on devel docs, the landing page index.html and dochack.js are in the same dir |
21:18:17 | narimiran | @kaushalmodi, since you made your changes, can you make a PR to *version-0-19* branch which will fix this? |
21:18:26 | rayman22201 | @zevv the results were designed to be a bit more noisy on purpose, since it was designed to help newbies who didn't know exactly what they wanted. But, doing that brought up more fundamental issues with how the search is currently implemented, thus the weird unexpected results. |
21:19:29 | narimiran | rayman22201: make it less noisy please :) now it is bad for newbies and not-so-newbies :P |
21:19:37 | Zevv | No problem. I mostly Ctrl-F myself through the index these days. |
21:19:40 | FromGitter | <kaushalmodi> narimiran: the issue is with the nim-lang.org deployment |
21:20:01 | rayman22201 | Here is the issue where the fix was being discussed: https://github.com/nim-lang/Nim/issues/9462 |
21:20:02 | FromGitter | <kaushalmodi> some script is moving all the doc HTML files to the `docs/` subdir, except the dochack.js |
21:21:00 | FromGitter | <kaushalmodi> narimiran: can you point me to the website deployment script? |
21:22:51 | * | zyklon quit (Read error: Connection reset by peer) |
21:23:14 | narimiran | @kaushalmodi i'm *guessing* tools/kochdocs :/ |
21:23:33 | FromGitter | <kaushalmodi> narimiran: If you do `koch docs` locally and open any html file from `doc/html/`, the search will work |
21:24:11 | Zevv | oh that's good to know, handy for working offline |
21:24:38 | narimiran | so basically we just need to move dochack.js on the server to a correct subdir? |
21:25:09 | FromGitter | <kaushalmodi> narimiran: yes |
21:25:19 | FromGitter | <kaushalmodi> I don't think that script is in the Nim repo |
21:25:32 | FromGitter | <kaushalmodi> Araq would know which script is doing the actual site deployment |
21:25:44 | narimiran | maybe dom96 can do that manually so this is promptly resolved? |
21:25:53 | FromGitter | <kaushalmodi> because the dochack.js is in the same dir as other html pages (1) locally (2) devel docs |
21:26:05 | FromGitter | <kaushalmodi> but something different is happening for nim-lang.org, which I don't know |
21:26:31 | narimiran | dom96: if you didn't read the above discussion, dochack.js needs to be moved from https://nim-lang.org/dochack.js to https://nim-lang.org/docs/dochack.js |
21:26:45 | rayman22201 | It definitely appears that something different is happing on nim-lang.org. I just built locally and it works fine. |
21:27:35 | FromGitter | <kaushalmodi> rayman22201: of course! |
21:27:46 | FromGitter | <kaushalmodi> one of the reasons for my PR was the search wasn't working locally :P |
21:28:04 | FromGitter | <kaushalmodi> because it looked for dochack.js in `../` where there was nothing |
21:28:04 | dom96 | I'm willing to be that's an old dochack.js file |
21:28:28 | dom96 | Someone needs to make a PR to ensure dochack.js gets put in the right place when docs are generated |
21:28:51 | FromGitter | <kaushalmodi> dom96: it *is* in the right place |
21:28:53 | FromGitter | <kaushalmodi> see https://nim-lang.github.io/Nim/dochack.js |
21:28:55 | rayman22201 | lol. fair enough @kuashalmodi. I just wanted to sanity check. |
21:29:01 | narimiran | dom96: it seems that's already the case, but just on server it isn't |
21:29:07 | FromGitter | <kaushalmodi> but that .js disappears on nim-lang.org |
21:29:30 | FromGitter | <kaushalmodi> for now, @dom96 can you copy https://nim-lang.github.io/Nim/dochack.js to https://nim-lang.org/docs/dochack.js ? |
21:29:38 | narimiran | @kaushalmodi hmmm, maybe https://github.com/nim-lang/Nim/pull/9110 needs to be backported? |
21:30:04 | dom96 | I'm so confused |
21:30:08 | dom96 | How is it in the right place? |
21:30:19 | narimiran | @kaushalmodi can you try to build docs from 0.19 branch and see if it is correct or not? |
21:30:36 | FromGitter | <kaushalmodi> dom96: that PR is backported, looking at `view-source:https://nim-lang.org/docs/tut1.html` |
21:30:51 | FromGitter | <kaushalmodi> the dochack.js reference has the `../` removed |
21:31:24 | FromGitter | <kaushalmodi> wrong mention above, meant to ping narimiran |
21:32:05 | narimiran | yeah, true |
21:32:30 | dom96 | okay, I think I get the problem |
21:32:57 | rayman22201 | the script link just has no path at all, which defaults to the current directory. |
21:33:01 | dom96 | should be fixed |
21:33:28 | narimiran | wooohooo, fixed!! |
21:33:40 | rayman22201 | the question is, how can we make sure the deploy script puts dochack.js in the right spot automatically from now on, so we don'thave deja vu again? |
21:33:40 | FromGitter | <kaushalmodi> I didn't get it |
21:33:46 | FromGitter | <kaushalmodi> then how does devel docs work? |
21:34:46 | FromGitter | <kaushalmodi> looking at https://github.com/nim-lang/Nim/blob/version-0-19/tools/kochdocs.nim#L334-L352, the dochack.js file copying change is also backported |
21:35:07 | narimiran | dom96: so you have an idea why it was in the wrong place? |
21:35:13 | rayman22201 | still not working for me, but it might take a minute to propogate through the interwebs |
21:35:36 | dom96 | narimiran: guessing the location changed via some commit but where the file is generated didn't get changed? |
21:36:32 | FromGitter | <kaushalmodi> https://nim-lang.org/docs/dochack.js exists now, thanks |
21:36:45 | FromGitter | <kaushalmodi> *but still not sure why that file didn't get copied earlier* |
21:36:52 | FromGitter | <kaushalmodi> so this issue is bound to repeat :) |
21:37:26 | FromGitter | <kaushalmodi> @dom96 So the stable docs are at https://nim-lang.org/docs/ |
21:37:47 | FromGitter | <kaushalmodi> so some script is copying the docs to that `docs/` subdir; `kochdocs.nim` is not doing that |
21:37:50 | FromGitter | <kaushalmodi> so who is? |
21:37:54 | * | Trustable quit (Remote host closed the connection) |
21:38:06 | dom96 | yes, so that's why I said somebody needs to fix this using a PR :P |
21:38:07 | FromGitter | <kaushalmodi> that script is probably copying just `*.html` files and leaving out the `*.js`? |
21:38:17 | FromGitter | <kaushalmodi> dom96: where is that script? |
21:38:57 | dom96 | it's koch IIRC |
21:39:04 | dom96 | see what `koch docs` does |
21:39:06 | FromGitter | <kaushalmodi> `buildDocs` proc in `tools/kochdocs.nim` is doing the right thing because the devel docs and local docs work fine |
21:40:26 | narimiran | i'm off to bed. hopefully you guys will figure out the details. bye |
21:41:00 | * | zyklon joined #nim |
21:41:06 | rayman22201 | gn |
21:41:21 | FromGitter | <kaushalmodi> @dom96 koch docs is saving the html and js files to `doc/html`. See https://github.com/nim-lang/Nim/blob/ab425d793af1a5c0b221bfbeab382b4781479c63/tools/kochdocs.nim#L10 |
21:41:54 | FromGitter | <kaushalmodi> some other script that I cannot find is then moving stuff to the "docs" subdir on nim-lang.org |
21:43:15 | FromGitter | <kaushalmodi> @dom96, Araq: In short how is nim-lang.org/docs updated? which script do you use? |
21:43:24 | FromGitter | <kaushalmodi> once we look at that script, this issue will be solved |
21:45:10 | dom96 | I don't think there is any script |
21:45:14 | dom96 | it's just uploaded manually |
21:45:35 | * | narimiran quit (Ping timeout: 244 seconds) |
21:46:47 | FromGitter | <kaushalmodi> then may be only html files were uploaded and the .js was left out |
21:53:08 | * | absolutejam joined #nim |
21:53:17 | absolutejam | can I use a variable as the value of an enum |
21:53:24 | absolutejam | + ? |
21:53:24 | * | zyklon quit (Read error: Connection reset by peer) |
21:53:27 | absolutejam | forgot the almight mark |
21:54:05 | absolutejam | if I wanted an instance of a type as the value of an enum, do I have to define it in the enum - enumVal: MyType(...) |
21:59:27 | absolutejam | more importantly, can I have an instance of a type as the value of an enum? |
21:59:41 | absolutejam | maybe I'm overcomplicating this, haha |
22:07:03 | FromGitter | <zetashift> @absolutejam could you explain what you're using the enum for? This also might help: https://nim-by-example.github.io/types/enums/ |
22:07:07 | dom96 | what are you trying to do? |
22:09:47 | absolutejam | I have a custom type and I want to limit one of the property's types one of 8 types |
22:09:55 | absolutejam | uh, my brain isn't working right now |
22:10:17 | absolutejam | Just reading about generics |
22:11:14 | * | zyklon joined #nim |
22:11:44 | FromGitter | <dandevelo> I am running Nim with: nim c --embedsrc --compileonly --nimcache:src main.nim. I use embedsrc to embed the source in the generated C file but the source is not written in the generated C file. What could be the cause? |
22:12:02 | absolutejam | if I have type MealTime and I want to limit the types of property Food to one of 5 types, how would I go about that? |
22:12:04 | absolutejam | pretty much |
22:12:39 | absolutejam | that was an awful example |
22:15:57 | dom96 | Food = enum; Pizza, Salad, Chicken? |
22:16:08 | absolutejam | I think I'm overcomplicating it big time |
22:16:16 | absolutejam | I'm past it tonight, be back tomorrow |
22:16:18 | absolutejam | peace |
22:16:32 | * | absolutejam quit (Quit: WeeChat 1.9.1) |
22:19:03 | FromGitter | <dandevelo> Guess I will just file an issue for the bug regarding embedsrc |
22:25:19 | * | Vladar quit (Remote host closed the connection) |
22:28:29 | FromGitter | <dandevelo> Here it is https://github.com/nim-lang/Nim/issues/10263 Anyone else experiencing this? |
22:30:36 | dom96 | Guessing not that many of us use this flag |
22:30:47 | rayman22201 | I don't normally use embedsrc, but that sure looks like a bug to me lol. Yeah, probably not a well tested feature. |
22:33:04 | FromGitter | <dandevelo> I find it useful when debugging |
23:09:54 | * | shpx quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:12:35 | FromDiscord_ | <exelotl> I have a question... |
23:12:51 | FromDiscord_ | <exelotl> why are slurp and gorge aliases for staticRead and staticExec? |
23:13:14 | Araq | I was drunk when I wrote them |
23:13:42 | FromDiscord_ | <exelotl> amazing |
23:14:24 | Araq | the real reason is that I wanted to copy one single thing from the PL I disliked the most back then |
23:14:28 | * | skelett quit (Read error: Connection reset by peer) |
23:14:34 | Araq | (Perl) |
23:18:43 | * | skelett joined #nim |
23:21:13 | * | shpx joined #nim |
23:29:47 | * | stefanos82 quit (Remote host closed the connection) |
23:33:41 | FromDiscord_ | <moerm> Haha |
23:34:00 | FromDiscord_ | <moerm> I always call Perl a trouble ticket generator *g |
23:54:27 | * | leorize quit (Ping timeout: 252 seconds) |
23:55:53 | * | ng0 quit (Ping timeout: 256 seconds) |
23:55:54 | * | zyklon quit (Read error: Connection reset by peer) |
23:59:05 | * | ng0 joined #nim |