00:02:34 | FromDiscord | <TryAngle> In reply to @Elegantbeef "I mean yes it": I agree, working together is better than reinventing the wheel, I just didn't consider it because it looks to be specificially made for opengl but looking through the source code I agree it's not much |
00:07:04 | FromDiscord | <voidwalker> I am trying to write a proc that takes any csv file and imports it into a db, as it is, same columns. I tried something like this to start with: ` dbsql.exec(sql"INSERT OR REPLACE INTO ? (?) VALUES (?,?,?)", fileName, tsv.headers, id, votes, rating)` |
00:07:39 | FromDiscord | <voidwalker> getting `Error: cannot convert seq[string] to varargs[string]` |
00:08:17 | FromDiscord | <Elegantbeef> one of your arguments seems to be a `seq[string]` |
00:08:35 | FromDiscord | <voidwalker> yes, tsv.headers, which holds the column names, that i want as the db column names |
00:08:59 | FromDiscord | <Elegantbeef> `fileName & tsv.headers & [id, votes, rating]` |
00:09:04 | FromDiscord | <Elegantbeef> It's not ideal but yea |
00:10:56 | FromDiscord | <TryAngle> In reply to @TryAngle "I agree, working together": otherwise windy looks reallly solid, the easy polling ofbuttons looks really nice to use and not depending on GLFW is also a huge plus |
00:12:35 | * | noeontheend joined #nim |
00:13:44 | FromDiscord | <voidwalker> ` dbsql.exec(sql"INSERT OR REPLACE INTO ? (?) VALUES (?,?)", fileName & tsv.headers & [id, votes])` like this ? |
00:13:57 | FromDiscord | <Elegantbeef> Might need `[filename]` |
00:14:24 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44iv |
00:14:29 | FromDiscord | <Elegantbeef> I guess `@[]` |
00:14:30 | FromDiscord | <voidwalker> for `dbsql.exec(sql"INSERT OR REPLACE INTO ? (?) VALUES (?,?)", [fileName] & tsv.headers & [id, votes])` |
00:14:49 | FromDiscord | <Elegantbeef> Point is you need to pass either strings or a single collection |
00:15:23 | FromDiscord | <voidwalker> doesn't work :[ |
00:15:43 | FromDiscord | <Elegantbeef> `@[fileName] & tsv.headers & @[id, votes]`? |
00:16:02 | FromDiscord | <voidwalker> ` dbsql.exec(sql"INSERT OR REPLACE INTO ? (?) VALUES (?,?)", @[fileName] & tsv.headers & @[id, votes])` |
00:16:21 | FromDiscord | <Elegantbeef> are they all strings? |
00:16:24 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44iw |
00:16:31 | FromDiscord | <Elegantbeef> You need strings |
00:16:37 | FromDiscord | <Elegantbeef> so it should be `$id` and `$votes` |
00:18:59 | FromDiscord | <voidwalker> if I want the query separate, so I can debug easier: ` let sqlq = sql"INSERT OR REPLACE INTO ? (?) VALUES (?,?)", @[fileName] & tsv.headers & @[id, votes]` I get ` Error: invalid indentation` |
00:19:26 | FromDiscord | <voidwalker> Hm if I wrap it in () it works |
00:19:54 | FromDiscord | <Elegantbeef> Yea i know nothing of sql so have fun |
00:26:55 | FromDiscord | <voidwalker> I need a db enthusiast :\ |
00:30:23 | FromDiscord | <!Patitotective> doesnt phil use sql |
00:33:39 | FromDiscord | <voidwalker> hah lol.. i just realised what i did, wrapping it in (), made it a tuple |
00:33:44 | FromDiscord | <voidwalker> Error: type mismatch: got <DbConn, (SqlQuery, string, seq[string], seq[string])> |
00:36:28 | FromDiscord | <voidwalker> `let sqlString = "INSERT OR REPLACE INTO ? (?) VALUES (?,?,?)", fileName,` ... the ? value replacement does not work for strings.. right ? |
00:36:31 | FromDiscord | <voidwalker> `All db_ modules support the same form of parameter substitution. That is, using the ? (question mark) to signify the place where a value should be placed. For example:` |
00:37:38 | FromDiscord | <Elegantbeef> the value replacement is due to the `exec` |
00:37:56 | FromDiscord | <Elegantbeef> `exec(mySqlStr, replacements)` |
00:38:21 | FromDiscord | <Elegantbeef> so it should be `exec(yourSqlString, @[fileName] & tsv.headers & @[$id, $votes])` |
00:38:30 | FromDiscord | <voidwalker> oh, so I cannot prepare an sqlQuery type with the substution , before exec ? |
00:38:57 | FromDiscord | <Elegantbeef> Cause of how Nim's varargs work you either need to pass them all as a collection or all as single entries |
00:39:04 | FromDiscord | <Elegantbeef> So you just need to make a seq of the values you want |
00:40:44 | FromDiscord | <voidwalker> oh so the sqlQuery type is just a special string |
00:40:55 | FromDiscord | <voidwalker> distinct string |
00:41:01 | FromDiscord | <Elegantbeef> Yes |
00:42:01 | FromDiscord | <voidwalker> and the exec has the varargs thing.. so no way I can prepare it before exec right ? |
00:42:13 | FromDiscord | <Elegantbeef> You can prepare the args before |
00:42:22 | FromDiscord | <Elegantbeef> you can do `var args = @[fileName] & tsv.headers & @[$id, $votes]` |
00:42:46 | FromDiscord | <voidwalker> the sqlQuery I mean, in one line |
00:43:03 | FromDiscord | <Elegantbeef> No fucking clue |
00:45:16 | FromDiscord | <voidwalker> is there no better (easier) 3rd party wrapper for db access I wonder |
00:45:51 | FromDiscord | <Elegantbeef> I mean this is quite easy |
00:52:54 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=44iD if you really want to skip the manual creation |
00:56:00 | FromDiscord | <whee> @voidwalker you can construct it like any other string and then convert it to the sql type before exec |
00:56:30 | FromDiscord | <voidwalker> yeah but there is no value substitution defining possible before exec |
00:56:33 | FromDiscord | <voidwalker> that's what I meant |
00:56:46 | FromDiscord | <voidwalker> so you can prepare the string, and the varargs: string |
00:56:48 | FromDiscord | <whee> you mean the ? handling? |
00:56:51 | FromDiscord | <voidwalker> yes |
00:57:05 | FromDiscord | <whee> that part should get handled by the sql exec because it needs to be a prepared statement |
00:57:21 | FromDiscord | <Elegantbeef> Does the sql string just get formatted if so you could look at strutils `%` |
00:57:49 | FromDiscord | <Elegantbeef> But i'm fairly certain that's an unsafe operation |
00:58:14 | FromDiscord | <whee> you'd have to count the arguments and produce a string of "?" of the correct count, then the sql exec will do the substitution safely |
01:00:01 | FromDiscord | <voidwalker> Guess I should start with the table schema string generation first |
01:00:51 | FromDiscord | <voidwalker> I mean something like this could be of use somewhere in the libs, I am sure it's a common operation. csv/tsv/structured text -> sqlX |
01:08:22 | FromDiscord | <whee> everything I've done with CSV to sqlite hasn't been a generic solution, I don't think I found a nice generic one. I ended up hardcoding the columns |
01:15:50 | * | noeontheend quit (Ping timeout: 240 seconds) |
01:29:59 | * | noeontheend joined #nim |
01:34:56 | FromDiscord | <mattrb> sent a long message, see http://ix.io/44iJ |
01:39:41 | FromDiscord | <Elegantbeef> II get a `cannot open file `easywave\` |
01:41:58 | FromDiscord | <Elegantbeef> @mattrb |
01:42:13 | FromDiscord | <mattrb> Ah, maybe need a nimble install |
01:42:41 | FromDiscord | <mattrb> I added a couple dependencies for the meantime while resampling is broken |
01:43:05 | FromDiscord | <mattrb> Using that one to write the samples to a wav file |
01:43:10 | FromDiscord | <Elegantbeef> Also any follow up conversation about those bitsets 😛 |
01:45:31 | FromDiscord | <mattrb> I'm leaning towards leaving the bitfields since I still need them in most places. I prefer keeping it consistent over updating just a couple. I really appreciate your suggestions though!! |
01:45:42 | FromDiscord | <Elegantbeef> Even for input?! |
01:45:48 | FromDiscord | <Elegantbeef> Did you see my followup comment for input |
01:46:17 | FromDiscord | <TryAngle> In reply to @Elegantbeef "Also any follow up": do u mean set[T] vs bits in int |
01:47:09 | FromDiscord | <Generic> I feel like I plugged this already a dozen times, but I'm using my own bitfield macro in my emulator |
01:47:26 | FromDiscord | <Generic> which is a lot more flexible than C bitfields |
01:48:07 | FromDiscord | <Generic> it allows things like overlapping and parameterised fields |
01:48:30 | FromDiscord | <Generic> it also allows tagging members so they can be set at once from one value |
01:48:33 | FromDiscord | <mattrb> In reply to @Elegantbeef "Did you see my": Ah I didn't see that. That definitely could be a nice abstraction when I add remappable keys |
01:48:41 | FromDiscord | <Generic> it's a bit hard to describe, but super useful in emulators |
01:49:05 | FromDiscord | <Generic> https://github.com/RSDuck/hocuspocube/blob/master/hocuspocube/dsp/dsp.nim#L32-L45 |
01:49:16 | FromDiscord | <mattrb> @Generic I'll have to take a look! I think I saw them briefly earlier when I looked up your gc emulator |
01:49:30 | FromDiscord | <Generic> e.g. in this register a lot of fields are tagged mutable |
01:49:59 | FromDiscord | <Generic> https://github.com/RSDuck/hocuspocube/blob/master/hocuspocube/dsp/dsp.nim#L372 |
01:50:53 | FromDiscord | <Generic> so with `field.mutable = value` you can do a masked write into all these members |
01:51:06 | FromDiscord | <Generic> from a packed value |
01:52:44 | FromDiscord | <TryAngle> `eventLoop.run(proc(event: Event, target: EventLoopWindowTarget, controlFlow: var ControlFlow) = discard)`↵can I make this `run` proc somehow into a template so I don't have to write the proc but still have access to the parameters? |
01:53:29 | FromDiscord | <Generic> yes, though it might not be a good idea, if run is a larger proc |
01:53:59 | FromDiscord | <Elegantbeef> It's odd matt even `bus.read(gba.bus, ...)` doesnt work |
01:54:00 | FromDiscord | <Generic> or if what you're currently passing as a function is called more than once |
01:54:26 | FromDiscord | <TryAngle> the anonymous proc is repeatitly called |
01:54:51 | FromDiscord | <TryAngle> run is slightly bigger yes but I can still keep it as a proc and call it "from the template" no? |
01:55:24 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=44iR |
01:55:45 | FromDiscord | <mattrb> In reply to @Elegantbeef "It's odd matt even": I'm glad this also seems kinda weird to you.. I'm over here feeling like I don't know anything about nim imports lol |
01:56:10 | FromDiscord | <Generic> (edit) "https://play.nim-lang.org/#ix=44iR" => "https://paste.rs/WU3" |
01:56:25 | FromDiscord | <Generic> (edit) "https://play.nim-lang.org/#ix=44iU" => "https://play.nim-lang.org/#ix=44iT" |
01:57:11 | FromDiscord | <Generic> In reply to @TryAngle "run is slightly bigger": yeah something like this is totally doable |
01:57:28 | FromDiscord | <TryAngle> How does that work with nesting? |
01:57:28 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=44iV |
01:57:47 | FromDiscord | <TryAngle> (edit) "How does that work with nesting?" => "what is the beahaviour if I do scroping?" |
01:58:04 | FromDiscord | <Elegantbeef> Oh wait |
01:58:30 | FromDiscord | <Generic> In reply to @TryAngle "ah ok so if": yes, see https://nim-lang.org/docs/manual.html#templates-hygiene-in-templates |
01:58:32 | FromDiscord | <Elegantbeef> Nope `bind` didnt solve it |
01:59:16 | FromDiscord | <Elegantbeef> Oh recursive dep issue |
01:59:34 | FromDiscord | <Elegantbeef> bus -\> mmio -\>apu -\>dma |
02:00:55 | FromDiscord | <mattrb> Bus needs to access the apu and dma controllers, and the apu needs to trigger dma when it runs out of samples |
02:01:16 | FromDiscord | <Elegantbeef> Welcome to cyclical hell |
02:01:26 | FromDiscord | <mattrb> Every time I have a recursive dep issue I get one step closer to putting everything in a single file lol |
02:01:29 | FromDiscord | <Generic> welcome from me too |
02:01:38 | FromDiscord | <Generic> it's only pain from here on |
02:01:44 | FromDiscord | <Arathanis> i know this probably doesnt help |
02:02:12 | FromDiscord | <Arathanis> but nearly every time I have encountered a circular dependency issue, in any language, its been indicative of a design flaw |
02:02:28 | FromDiscord | <Arathanis> and I have to go back and do big refactoring |
02:02:40 | FromDiscord | <Generic> some things are just inherently circular |
02:02:46 | FromDiscord | <Arathanis> > nearly |
02:02:48 | FromDiscord | <Arathanis> 😉 |
02:03:01 | FromDiscord | <Generic> the problem with emulators is that we don't make the rules |
02:03:21 | FromDiscord | <Elegantbeef> Nims inability of handling cyclical dependencies is most annoying with gamedev |
02:03:47 | FromDiscord | <Elegantbeef> X and Y talk to eachother but there is no way to do it without some weird import/control |
02:04:03 | FromDiscord | <Generic> if everything is connected to the same bus in almost every system |
02:04:26 | FromDiscord | <mattrb> Any suggestion for my specific case, beef? Any idea why it works without that one line in dma.nim? That's what seems especially weird to me.. |
02:05:10 | FromDiscord | <Elegantbeef> Cause it's a generic proc |
02:05:29 | FromDiscord | <Elegantbeef> Generic procedures are not fully semantically checked until instantiation |
02:05:53 | FromDiscord | <Elegantbeef> I mean you can do delayed imports |
02:06:00 | FromDiscord | <Elegantbeef> But it's a complex thing |
02:06:22 | FromDiscord | <Elegantbeef> I've explained this before but Nim's cyclical imports work "predictibly" |
02:06:34 | FromDiscord | <Elegantbeef> In that you have access to everything in a module until an import statement |
02:06:59 | FromDiscord | <Arathanis> oh, is it like python? |
02:07:19 | FromDiscord | <Elegantbeef> How would I know |
02:07:20 | FromDiscord | <mattrb> You've helped me fix a cyclic import before, and I tried to recreate it here to no avail. I figure I just don't actually understand the behavior |
02:07:45 | FromDiscord | <Arathanis> In reply to @Elegantbeef "How would I know": in python as long as the circular import comes after the other modules deps its fine |
02:07:51 | FromDiscord | <Arathanis> so you can import later in the file and it works |
02:08:00 | FromDiscord | <Elegantbeef> Then sure |
02:08:38 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=44j0 |
02:08:52 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=44j1 |
02:09:01 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=44j1" => "https://play.nim-lang.org/#ix=44j2" |
02:09:10 | FromDiscord | <Generic> yeah it's kind of like that in Nim too |
02:09:16 | FromDiscord | <Arathanis> it works |
02:09:19 | FromDiscord | <Arathanis> and makes you feel dirty |
02:09:21 | FromDiscord | <Arathanis> at the same time! |
02:09:24 | FromDiscord | <TryAngle> ah nvm it doesn't work |
02:09:26 | FromDiscord | <TryAngle> XD |
02:10:01 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=44j3 |
02:10:01 | FromDiscord | <Generic> var cannot be captured? |
02:10:29 | FromDiscord | <Generic> ah no, I think you misunderstood me or I wasn't clear enough |
02:10:53 | FromDiscord | <Generic> the function pointer is to be replaced completely by the template |
02:11:05 | FromDiscord | <TryAngle> In reply to @Generic "ah no, I think": nah my run method just doesn't work like that, I'm not passing the injectables into it |
02:11:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44j4 |
02:11:42 | FromDiscord | <Generic> yeah I'm doing that |
02:11:45 | FromDiscord | <Elegantbeef> Though i ran into a bug i think where it thinks the `bus.[]=` is delayed |
02:12:02 | FromDiscord | <Generic> though I've come to a point where the Nim compiler started emitting invalid C code |
02:12:19 | FromDiscord | <Generic> so I'm using importc/exportc in a few cases now |
02:13:22 | FromDiscord | <Elegantbeef> I did have a swanky error from a silly macro |
02:14:17 | FromDiscord | <Elegantbeef> Nothing crazy though |
02:15:40 | FromDiscord | <mattrb> In reply to @Elegantbeef "You might be able": Looks like this specifically doesn't work, but I'll play around with it a bit to see what works.. |
02:15:48 | FromDiscord | <Elegantbeef> It helps |
02:16:05 | FromDiscord | <Elegantbeef> you then can forward declare inside of bus |
02:16:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44j5 |
02:16:22 | FromDiscord | <Elegantbeef> It then compiles in Nim but in cgen it dies |
02:17:20 | FromDiscord | <mattrb> Oh, that's a neat error haha |
02:18:22 | FromDiscord | <mattrb> I gotta go cook dinner. When I get back, maybe I should just write a program to rearrange all of my imports and procs randomly until it compiles |
02:18:30 | FromDiscord | <Elegantbeef> Lol |
02:18:43 | FromDiscord | <Elegantbeef> I'm going to use a debug compiler to see what the problem actually is |
02:18:59 | FromDiscord | <mattrb> Sweet, thanks so much. Really appreciate the hel |
02:19:00 | FromDiscord | <mattrb> (edit) "hel" => "help" |
02:19:01 | FromDiscord | <Elegantbeef> Might be able to make a PR to make it atleast compile in devel |
02:25:36 | FromDiscord | <Elegantbeef> I'm thinking the the forward declare + delayed import in this just creates a proper endless loop and it doesnt get to the `[]=` procedure's definition |
02:31:18 | * | xet7 quit (Ping timeout: 240 seconds) |
02:48:10 | * | noeontheend quit (Ping timeout: 260 seconds) |
03:45:15 | * | noeontheend joined #nim |
04:20:49 | FromDiscord | <ripluke> sent a code paste, see https://play.nim-lang.org/#ix=44jk |
04:22:40 | * | noeontheend quit (Ping timeout: 260 seconds) |
04:22:43 | FromDiscord | <Elegantbeef> No |
04:22:51 | FromDiscord | <ripluke> Lol why not |
04:22:51 | FromDiscord | <Elegantbeef> You need a macro to do this |
04:22:56 | FromDiscord | <ripluke> Ah |
04:23:00 | FromDiscord | <Elegantbeef> Import must be a top level statement |
04:23:52 | FromDiscord | <ripluke> Ah |
04:23:59 | FromDiscord | <ripluke> A safety thing? |
04:24:13 | FromDiscord | <Elegantbeef> No a language requirement |
04:24:42 | FromDiscord | <ripluke> Oh |
04:25:08 | FromDiscord | <ripluke> And I suspect I can’t just use a for loop in a macro XD |
04:26:31 | FromDiscord | <Elegantbeef> An ugly reference |
04:26:32 | FromDiscord | <Elegantbeef> https://github.com/GaryMcWhorter/GDGW-Maverick-Bot/blob/master/src/nimcordbot/utils.nim#L1-L21 |
04:27:54 | FromDiscord | <ripluke> Ah ok thx for the help |
04:54:58 | * | arkurious quit (Quit: Leaving) |
05:00:25 | * | CyberTailor joined #nim |
05:02:30 | * | rockcavera quit (Read error: Connection reset by peer) |
05:04:01 | * | rockcavera joined #nim |
05:04:01 | * | rockcavera quit (Changing host) |
05:04:01 | * | rockcavera joined #nim |
05:07:50 | FromDiscord | <xflywind> shallowCopy doesn't work in the global scope? |
05:08:03 | FromDiscord | <xflywind> sent a long message, see http://ix.io/44jq |
05:08:40 | FromDiscord | <xflywind> sent a long message, see http://ix.io/44jr |
05:19:02 | FromDiscord | <Rika> Eval doesn’t work with line breaks |
05:20:55 | * | wallabra quit (Ping timeout: 244 seconds) |
05:24:21 | FromDiscord | <xflywind> !eval var x = "1234"; var y: string; shallowCopy(y, x); y[0] = 'Q'; doAssert x == "Q234"; doAssert y == "Q234" |
05:24:25 | NimBot | /usercode/in.nim(1) in↵/playground/nim/lib/system/assertions.nim(38) failedAssertImpl↵/playground/nim/lib/system/assertions.nim(28) raiseAssert↵/playground/nim/lib/system/fatal.nim(53) sysFatal↵Error: unhandled exception: /usercode/in.nim(1, 72) `x == "Q234"` [AssertionDefect] |
05:26:04 | * | wallabra joined #nim |
05:38:28 | * | rockcavera quit (Read error: Connection reset by peer) |
05:38:52 | * | rockcavera joined #nim |
05:38:52 | * | rockcavera quit (Changing host) |
05:38:52 | * | rockcavera joined #nim |
06:14:26 | * | _________ quit (*.net *.split) |
06:14:26 | * | Goodbye_Vincent quit (*.net *.split) |
06:14:26 | * | tanami quit (*.net *.split) |
06:14:26 | * | rwb quit (*.net *.split) |
06:14:26 | * | genpaku quit (*.net *.split) |
06:14:26 | * | djanatyn1 quit (*.net *.split) |
06:14:26 | * | termer quit (*.net *.split) |
06:14:27 | * | joast quit (*.net *.split) |
06:14:27 | * | mal`` quit (*.net *.split) |
06:15:48 | FromDiscord | <dain> sent a long message, see http://ix.io/44jz |
06:17:42 | * | _________ joined #nim |
06:17:42 | * | Goodbye_Vincent joined #nim |
06:17:42 | * | tanami joined #nim |
06:17:42 | * | rwb joined #nim |
06:17:42 | * | genpaku joined #nim |
06:17:42 | * | djanatyn1 joined #nim |
06:17:42 | * | termer joined #nim |
06:17:42 | * | joast joined #nim |
06:17:42 | * | mal`` joined #nim |
06:18:22 | * | rwb quit (Max SendQ exceeded) |
06:18:22 | * | _________ quit (Max SendQ exceeded) |
06:18:41 | * | _________ joined #nim |
06:19:09 | * | rwb joined #nim |
06:19:15 | FromDiscord | <Elegantbeef> No cause nims templates are hygenic by default |
06:19:45 | FromDiscord | <xflywind> In reply to @dain "im a little confused": No, templates by default will generate a unique symbol for varaibles within it like ``result`gensym1``, ``result`gensym2 ``. |
06:19:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44jA |
06:20:22 | FromDiscord | <xflywind> (edit) removed "a" | "symbol" => "symbols" |
06:24:38 | FromDiscord | <dain> ah okay |
06:25:10 | FromDiscord | <dain> also what does the `typeof(items(seq1), typeOfIter)` mean? as in the second argument |
06:25:27 | FromDiscord | <dain> i know that we need to get the type of the items of the seq but what is `typeofIter` doing |
06:26:12 | FromDiscord | <Rika> !eval typeof(items(@[1])) |
06:26:15 | NimBot | Compile failed: /usercode/in.nim(1, 7) Error: expression 'typeof(items(@[1]))' is of type 'typedesc[int]' and has to be used (or discarded) |
06:26:16 | FromDiscord | <Rika> Fuck |
06:26:23 | FromDiscord | <Rika> !eval echo typeof(items(@[1])) |
06:26:27 | NimBot | int |
06:26:34 | FromDiscord | <Rika> Not sure I forgot |
06:26:59 | FromDiscord | <Elegantbeef> It probably is just to tell the compiler "consider iterators" |
06:27:14 | FromDiscord | <Elegantbeef> Yep that's what it is |
06:27:39 | FromDiscord | <Elegantbeef> Cause iterators are specialised you need to tell the compiler "i want the iterator call type" |
06:28:15 | FromDiscord | <Rika> Why does it work normally without |
06:28:26 | FromDiscord | <Elegantbeef> Default parameter is iterator |
06:28:45 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#typeof%2Cuntyped |
06:29:19 | FromDiscord | <Elegantbeef> I assume the reason is "Well duh most people want the `typeof` to return the result of iterators and procs alike" |
06:29:33 | FromDiscord | <demotomohiro> !eval echo typeof(1..2, typeOfIter); echo typeof(1..2, typeOfProc) |
06:29:36 | FromDiscord | <Elegantbeef> The downside is this prefers iterators so if you have a proc that returns a `seq[T]` and a iterator that returns `T` you get an issue |
06:29:37 | NimBot | int↵HSlice[system.int, system.int] |
06:29:48 | FromDiscord | <Elegantbeef> There we go demo putting in work 😛 |
06:30:30 | FromDiscord | <demotomohiro> That is why typeof needs 2nd argument. |
06:38:20 | FromDiscord | <Rika> I knew about it but I thought proc was default |
06:52:03 | FromDiscord | <dain> what should be my mental model for understanding when the `=>` sugar will work and when it won't |
06:52:10 | FromDiscord | <dain> i try to use it in places, sometimes it works, sometimes the compiler can't figure out the types, and i never know ahead of time which it will be |
07:15:00 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=44jE |
07:15:30 | FromDiscord | <dain> (edit) "https://play.nim-lang.org/#ix=44jE" => "https://play.nim-lang.org/#ix=44jF" |
07:15:57 | FromDiscord | <Elegantbeef> Why are you using a template here? |
07:16:26 | FromDiscord | <dain> because i want to? |
07:16:32 | FromDiscord | <dain> idk i thought it needed to |
07:16:39 | FromDiscord | <Elegantbeef> No you dont need it |
07:16:55 | FromDiscord | <dain> bc i thought i need to get the type of the pairs |
07:17:02 | FromDiscord | <dain> so it has to be a metaprogramming not a proc |
07:17:18 | FromDiscord | <Elegantbeef> No it can be inside a generic |
07:17:30 | FromDiscord | <dain> im doing it by analogy to this https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/algorithm.nim#L476 |
07:17:35 | FromDiscord | <dain> it uses a template |
07:18:00 | FromDiscord | <Elegantbeef> It uses a template for the `it` syntax |
07:18:31 | FromDiscord | <dain> oh |
07:19:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44jI |
07:19:04 | FromDiscord | <enthus1ast> I think every time `auto` is valid as well https://github.com/nim-lang/Nim/blob/9508b06513b170ffbe91cfcfcd7ca09fa9b675cc/lib/pure/sugar.nim#L55↵(@dain) |
07:22:23 | FromDiscord | <enthus1ast> You could check with \`expandMacros\` how the macros is expanded to nim code |
07:25:20 | FromDiscord | <dain> i can't get it to work with generics |
07:25:40 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=44jK |
07:25:45 | FromDiscord | <Elegantbeef> I just showed you it with generics! 😛 |
07:26:04 | FromDiscord | <dain> oh |
07:26:09 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=44jM |
07:26:15 | FromDiscord | <dain> i didnt know you could use typeof in a proc signature |
07:26:22 | FromDiscord | <Elegantbeef> `: Orderable` |
07:26:22 | FromDiscord | <dain> why won't my version work |
07:26:42 | FromDiscord | <Elegantbeef> Lefout `var` and you had `Orderable` |
07:26:50 | FromDiscord | <dain> same thing happens if i change Orderable to int |
07:26:58 | FromDiscord | <Rika> You still need the car |
07:27:02 | FromDiscord | <Rika> Var part |
07:27:04 | FromDiscord | <Elegantbeef> It needs to be a `var OrderdTable` |
07:27:39 | FromDiscord | <Elegantbeef> But you can see why i used the lazy generic, it was easier |
07:28:01 | FromDiscord | <dain> omg omg it works thankyou |
07:28:44 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=44jN |
07:31:03 | FromDiscord | <dain> i had no idea you could use typeof like that |
07:31:36 | FromDiscord | <dain> when is it best to use that vs the generics syntax with the square brackets |
07:31:39 | FromDiscord | <Elegantbeef> Of course you can generic procedures are generic |
07:31:48 | FromDiscord | <Elegantbeef> When you want to be more explicit |
07:32:24 | FromDiscord | <Elegantbeef> If you're lazy the autos and generic typeclass is the way t ogo |
07:32:44 | FromDiscord | <Elegantbeef> When you have heavily generic procedures the typeclass and autos are nice |
07:33:01 | FromDiscord | <dain> well it wasnt obvious to me 😆 |
07:41:32 | FromDiscord | <dain> does `->` not work for generic types? |
07:41:34 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=44jO |
07:41:56 | FromDiscord | <Elegantbeef> No clue |
07:42:07 | FromDiscord | <Elegantbeef> I use type aliases over `->` |
07:42:30 | FromDiscord | <Elegantbeef> So i'd do `type SortProc[T, U] = proc(t: T, u: U): Orderable` |
07:42:44 | FromDiscord | <Elegantbeef> then `f: SortProc[T, U]` |
07:50:58 | FromDiscord | <dain> oh wait a minute, the `->` does work, I just forgot that it takes a single parameter that is a 2-tuple, not two parameters |
07:51:40 | FromDiscord | <dain> `((T, U)) -> Orderable` works |
07:55:22 | * | rockcavera quit (Remote host closed the connection) |
07:59:58 | FromDiscord | <Tuatarian> How does one create a cust allocator? |
08:00:20 | FromDiscord | <Elegantbeef> https://forum.nim-lang.org/t/7588 |
08:01:13 | FromDiscord | <Tuatarian> That was an incredible combination of mistype and autocorrect lmao |
08:01:22 | FromDiscord | <Tuatarian> Meant custom operator |
08:01:50 | FromDiscord | <Tuatarian> If I just wrap proc name in backticks I can't seem to use it as an infix operator |
08:01:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44jT |
08:02:05 | FromDiscord | <Tuatarian> That doesn't work for words |
08:02:14 | FromDiscord | <Elegantbeef> Of course not you cannot make word operators |
08:02:20 | FromDiscord | <Tuatarian> Only symbols or overloads of existing word.operators |
08:02:26 | FromDiscord | <Tuatarian> That's unfortunate |
08:03:00 | FromDiscord | <Elegantbeef> we have command syntax for unary and we have method call for binary |
08:03:20 | FromDiscord | <Tuatarian> Words are often better than inscrutable symbols imo, eg % vs sgnmod for signed modulo |
08:03:24 | FromDiscord | <Elegantbeef> So you pretty much only have at most an `.` |
08:03:50 | FromDiscord | <Tuatarian> Makes sense I guess |
08:04:16 | FromDiscord | <Tuatarian> Is it possible to make this functionality with macro/pragma? |
08:04:54 | FromDiscord | <Elegantbeef> kinda but you'd need a block above the code that has the "operator" |
08:05:14 | FromDiscord | <Tuatarian> Yeah that's not better |
08:05:30 | FromDiscord | <Elegantbeef> Just use method call and command syntax |
08:05:37 | FromDiscord | <Elegantbeef> Like what's the operator you're wanting to implement? |
08:05:41 | FromDiscord | <Tuatarian> Could you somehow make it into a pragma you can annotate a "custom operator" proc with? |
08:05:49 | FromDiscord | <Elegantbeef> No |
08:05:56 | FromDiscord | <Tuatarian> sgnmod |
08:05:59 | FromDiscord | <Tuatarian> That's unfortunate |
08:06:04 | FromDiscord | <Tuatarian> Signed modulo |
08:06:48 | FromDiscord | <Tuatarian> How do keyword operators like `mod ` `in` etc work? |
08:06:59 | FromDiscord | <Elegantbeef> They're apart of the language |
08:07:04 | FromDiscord | <Elegantbeef> So they're hard coded to be binary operators |
08:07:25 | FromDiscord | <Tuatarian> That's what I thought from looking at docs, but that's unfortunate |
08:07:36 | FromDiscord | <kraptor> Hi all, here David from SUSE: we made an statement from openSUSE regarding Nim, feel free to share 🙂 https://news.opensuse.org/2022/07/14/os-reaches-first-class-support-for-nim/ |
08:07:44 | FromDiscord | <Elegantbeef> Actually we can use macros to hack this in |
08:07:45 | FromDiscord | <Elegantbeef> Maybe |
08:07:55 | FromDiscord | <Elegantbeef> Might be wrong |
08:09:53 | FromDiscord | <Elegantbeef> Yea i was 100% wrong |
08:10:21 | FromDiscord | <Elegantbeef> congrats on getting Nim there 😄 |
08:10:33 | FromDiscord | <alehander42> the Araq quote |
08:10:33 | FromDiscord | <soundmodel> In reply to @kraptor "Hi all, here David": I wonder what's Ubuntu's or something's take on this? Would switch back to Suse, if this means that it will be a solid experience for Nim |
08:10:46 | FromDiscord | <alehander42> seems like something from a satirical site 😄 |
08:10:59 | FromDiscord | <Elegantbeef> I mean why the hell are you developing using your software rep's version of a language |
08:11:19 | FromDiscord | <Elegantbeef> Atleast when it comes to languages that arent design by standard that just feels off |
08:11:19 | FromDiscord | <soundmodel> tbh I'm not even sure what first class support means |
08:11:24 | FromDiscord | <Elegantbeef> design by comittee |
08:11:24 | FromDiscord | <alehander42> otherwise nice |
08:11:29 | FromDiscord | <soundmodel> FreeBSD had bad support from repos |
08:11:33 | FromDiscord | <soundmodel> but nothing preventing from using choosenim |
08:11:37 | FromDiscord | <Elegantbeef> It means they have nim packages on all their released arch versions |
08:12:06 | FromDiscord | <alehander42> (edit) "seems like something from a satirical site 😄 ... " added "in a good way" |
08:12:41 | NimEventer | New post on r/nim by thindil: openSUSE Reaches First-Class Support for Nim Language, see https://reddit.com/r/nim/comments/vyqlwg/opensuse_reaches_firstclass_support_for_nim/ |
08:13:53 | FromDiscord | <soundmodel> does it mean that they're also tested so that e.g. choosenim would not break? |
08:14:05 | FromDiscord | <soundmodel> (edit) "does it mean that they're also tested so that e.g. ... choosenimwould?" added "they will not break, when" | "would not break?" => "would?" |
08:14:09 | FromDiscord | <Elegantbeef> I mean Choosenim isnt apart of Nim-lang |
08:14:33 | FromDiscord | <soundmodel> but I mean there's some reason why e.g. FreeBSD repo didn't carry choosenm |
08:14:40 | FromDiscord | <Tuatarian> Araq is hilariously straightforward, I love it |
08:14:41 | FromDiscord | <soundmodel> (edit) "choosenm" => "choosenim" |
08:14:55 | FromDiscord | <Elegantbeef> Does choosenim even work on BSD? |
08:15:01 | FromDiscord | <soundmodel> yes |
08:15:09 | FromDiscord | <kraptor> Having Nim properly packaged means we can provide software based on Nim and package it, fix security issues on old Nim versions (CVEs, etc.) and have a baseline version to compile any other depedan package (think about gcc or any other compiler in the same way). Basically, we say: we are ready to ship packages based on Nim. |
08:15:13 | FromDiscord | <Elegantbeef> I mean most repos dont carry choosenim |
08:15:28 | FromDiscord | <elcritch> In reply to @kraptor "Hi all, here David": that's pretty cool! I'm running OpenSuse at work. This is actually pretty cool! |
08:15:31 | FromDiscord | <soundmodel> but I like the idea of "tiered" languages, which I was asking at the FreeBSD community as well |
08:15:39 | FromDiscord | <Elegantbeef> Do you have LTS and stable?↵(@kraptor) |
08:15:40 | FromDiscord | <elcritch> (edit) removed "This is actually pretty cool!" |
08:15:44 | FromDiscord | <soundmodel> because it's nice to have an OS "enforce" app languages |
08:16:12 | FromDiscord | <soundmodel> like on Android |
08:16:12 | FromDiscord | <kraptor> In reply to @soundmodel "does it mean that": I use both the package and choosenim, should work for you too. Any issue, just create a bug on bugzilla.opensuse.org and I will take care of it and work with you to fix it. |
08:16:18 | FromDiscord | <soundmodel> it leads to consistency benefits |
08:16:33 | FromDiscord | <soundmodel> "okay now all Android code is just Java/Kotlin, no surprises" |
08:16:34 | FromDiscord | <Tuatarian> For users yes, for devs eh |
08:16:40 | FromDiscord | <Elegantbeef> Except the issue with android is it's awful to write code for if you dont want to use the forced languages |
08:16:52 | FromDiscord | <Elegantbeef> Like it's not open which is the exact issue |
08:16:58 | FromDiscord | <Tuatarian> I like the freedom to choose what language/tooling/etc without having to deal with massive pita |
08:17:44 | FromDiscord | <Tuatarian> Especially since java (not sure on kotlin) itself enforces really strong architectural and stylistic features which may not be best for a project |
08:18:00 | FromDiscord | <soundmodel> In reply to @Elegantbeef "Except the issue with": yes this is a drawback, but then you trust the OS devs to do the right thing |
08:18:05 | FromDiscord | <kraptor> @ElegantBeef LTS versions of SUSE SLE ship Nim 1.2.x, we aim to package 2.0 version once ready and, in the meantime, make the current 1.6.6 version stable and fix anything new we find before committing to a new version for LTS |
08:18:13 | FromDiscord | <soundmodel> I've debated this issue quite long, because I also thought that Java is stupid |
08:18:19 | FromDiscord | <Tuatarian> If a language has to be first class for whatever reason it should.imo be C |
08:18:26 | FromDiscord | <soundmodel> but if you read the motives of Android devs, you would understand that they do the right thing |
08:18:38 | FromDiscord | <soundmodel> so it just takes "being informed" to make those decisions |
08:18:59 | FromDiscord | <Tuatarian> I understand their motive and it's worked pretty well, but it's restrictive for devs in a way that I don't think is suitable for a desktop os |
08:19:08 | FromDiscord | <Elegantbeef> Here i'm going just wanting to not have to fight to run my own software on a device i purchase |
08:19:25 | FromDiscord | <soundmodel> well I would for example disallow the usage of C++ |
08:19:35 | FromDiscord | <Tuatarian> Why? |
08:19:39 | FromDiscord | <Tuatarian> C++ is not horrible |
08:19:48 | FromDiscord | <Elegantbeef> Citation needed |
08:19:49 | FromDiscord | <soundmodel> because it's hard to use from other languages due to complicated sense of ABI stability |
08:19:53 | FromDiscord | <Tuatarian> Controversial opinion I know |
08:20:08 | FromDiscord | <soundmodel> or to make this better |
08:20:18 | FromDiscord | <soundmodel> we'd say that "you cannot use C++ for libraries, only for apps" |
08:20:31 | FromDiscord | <soundmodel> "C for libs, C++ only for apps, not libs" |
08:21:26 | FromDiscord | <soundmodel> then you could direct it more like: "Java is only for apps of this type" |
08:21:38 | FromDiscord | <soundmodel> so that people would not write scientific software in Java |
08:21:52 | FromDiscord | <Elegantbeef> "python is only for software you can point at and laugh" |
08:22:32 | FromDiscord | <soundmodel> "python is only for proof-of-concepts and 'small apps'" |
08:22:47 | FromDiscord | <soundmodel> which would prohibit people from writing serious software into Python libs |
08:22:51 | FromDiscord | <soundmodel> like it's now with SciPy etc. |
08:24:25 | FromDiscord | <soundmodel> because then it ends up "oh so much markov models in Python, but not in C" |
08:30:46 | FromDiscord | <soundmodel> I think some other OSes used to also promote some languages? |
08:30:54 | FromDiscord | <soundmodel> OSX, Windows |
08:31:13 | FromDiscord | <soundmodel> it's just odd that Linuxes don't have the idea of Objective-C or C# |
08:31:18 | * | toluene3 joined #nim |
08:31:26 | * | toluene quit (Ping timeout: 255 seconds) |
08:31:27 | * | toluene3 is now known as toluene |
08:31:29 | FromDiscord | <Elegantbeef> It's kinda the epitome of linux |
08:31:36 | FromDiscord | <Elegantbeef> It's open and you can do what you want |
08:32:08 | FromDiscord | <soundmodel> nice but I think it comes at the cost of lack of uniformity |
08:32:25 | FromDiscord | <soundmodel> OSX dev is pretty nice, because all the libs are always in the same langs and libraries |
08:32:42 | FromDiscord | <soundmodel> (edit) "OSX dev is pretty nice, because all the libs are always ... inusing" added "predominantly" | "predominantlyin the same langs and ... libraries" added "using the same" |
08:32:46 | FromDiscord | <Elegantbeef> Sure but that doesnt solve the problem if you dont like the language the house is made out of |
08:32:57 | FromDiscord | <soundmodel> then you trust the OS devs |
08:33:00 | FromDiscord | <Elegantbeef> If you dont like swift you're in the small corner of mac development |
08:33:04 | FromDiscord | <soundmodel> to make the right choices |
08:33:18 | FromDiscord | <Elegantbeef> Is swift the right choice? |
08:33:20 | FromDiscord | <Elegantbeef> Who knows |
08:33:29 | FromDiscord | <soundmodel> or "you don't like" means that you haven't studied all the things that the OS devs did |
08:33:30 | FromDiscord | <Elegantbeef> Might be for you, might not be for me |
08:33:34 | FromDiscord | <soundmodel> in order to select the best tools |
08:33:55 | FromDiscord | <soundmodel> and the idea is not to prohibit other tools |
08:33:56 | FromDiscord | <Elegantbeef> If you dislike a language and it's design it doesnt matter how much you use the language you wont like it |
08:34:00 | FromDiscord | <soundmodel> but give first class support for some |
08:34:07 | FromDiscord | <soundmodel> and then those langs are the ones that are "most robust" |
08:34:27 | FromDiscord | <soundmodel> (edit) "and then those langs are the ones that are "most robust" ... " added "on a given platform" |
08:34:35 | FromDiscord | <soundmodel> (edit) ""most robust"" => "most robust" |
08:35:46 | FromDiscord | <soundmodel> In reply to @Elegantbeef "If you dislike a": not necessarily, I hate Java |
08:35:57 | FromDiscord | <soundmodel> but having so much libraries for it mitigates for that fact |
08:37:04 | FromDiscord | <soundmodel> also judging by Rust |
08:37:25 | FromDiscord | <soundmodel> it's possible that the main method to make a language popular is to have some sort of backing |
08:37:34 | FromDiscord | <soundmodel> it's not enough to have a good technology |
08:37:58 | FromDiscord | <soundmodel> now people want to use Rust, because Mozilla endorses it |
08:50:18 | FromDiscord | <kcnaiamh> sent a long message, see http://ix.io/44k2 |
08:51:10 | FromDiscord | <Elegantbeef> Well this is cursed 😄 |
08:51:55 | FromDiscord | <Elegantbeef> You're hiding something though |
08:52:09 | FromDiscord | <soundmodel> also I'm not sure if you considered that the free choice in langs does not seem to promote survival of the fittest |
08:52:17 | FromDiscord | <soundmodel> or why do we have JavaScript etc.? |
08:52:28 | FromDiscord | <Elegantbeef> You're on an ancient nim |
08:52:43 | FromDiscord | <Elegantbeef> It's suggested to remove nim from apt then use choosenim |
08:52:55 | FromDiscord | <soundmodel> possible other negative outcome of freedom: then uninformed people make uninformed choices |
08:53:02 | FromDiscord | <soundmodel> and write software in uninformed ways |
08:53:30 | FromDiscord | <soundmodel> (edit) "possible other negative outcome of freedom: then uninformed people make uninformed choices ... " added "(?)" |
08:54:49 | FromDiscord | <Elegantbeef> What does `nim -v` say if you've not uninstalled it yet↵(@kcnaiamh) |
08:56:30 | FromDiscord | <kcnaiamh> In reply to @Elegantbeef "It's suggested to remove": damn! -2019! :3 https://media.discordapp.net/attachments/371759389889003532/997064032412520498/unknown.png |
09:02:35 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=44k5 |
09:09:46 | FromDiscord | <konsumlamm> @ElegantBeef i have to tell you, "apart" is not the same as "a part", in fact they're almost opposites |
09:11:58 | FromDiscord | <Elegantbeef> Oh i know |
09:14:11 | FromDiscord | <Elegantbeef> phonetic typos aren't worth addressing |
09:16:24 | FromDiscord | <creikey> It seems like the nim compiler is very complicated and slow developing because of a lack of full time contributors (no money to the project), causing compiler bugs and slow development of features, is this an accurate assessment or am I being overly negative? Can I rely on weird edge cases of nim like nim async server code to be used in production? |
09:20:34 | FromDiscord | <konsumlamm> ime you can't realy on on weird edge cases to work, but i wouldn't call async a weird edge case |
09:21:50 | FromDiscord | <konsumlamm> the lack of contributors doesn't really cause the bugs, it just means they aren't fixed that fast |
09:23:07 | FromDiscord | <kcnaiamh> sent a code paste, see https://play.nim-lang.org/#ix=44kb |
09:23:11 | FromDiscord | <konsumlamm> i can't speak about the complexity of the compiler itself, but i know that it accumulated a decent amount of cruft and there are people that think it should be (partly) rewritten |
09:23:11 | FromDiscord | <mratsim> In reply to @creikey "It seems like the": Seldom-tested features cause bugs.↵Most of Nim bugs are compile-time, so if it compiles you're fine.↵↵Async is well tested, otherwise Chronos is battle-tested and in production in a multi-billion industry |
09:23:38 | FromDiscord | <creikey> In reply to @konsumlamm "i can't speak about": yeah I saw nimskull but the language in it is written really weirdly |
09:23:41 | FromDiscord | <creikey> like the english |
09:23:42 | FromDiscord | <creikey> I don't really get it |
09:23:59 | FromDiscord | <Elegantbeef> Uh oh you've summoned someone |
09:24:00 | FromDiscord | <kraptor> @creikey I'd say that Nim is actually really fast-paced on new features and fixes (compared to other langs) given the "few" people involved... Actually, I struggle to follow everything being done 🙂 |
09:24:27 | FromDiscord | <Elegantbeef> The biggest issues in my view with Nim and bugs is generics |
09:24:45 | FromDiscord | <Elegantbeef> Nim's generics generally work if you dont fly close to the sun |
09:24:57 | FromDiscord | <Elegantbeef> But if you do complex generic things they wither |
09:25:07 | FromDiscord | <konsumlamm> idk if money actually is a problem (probably best to ask Araq for that), but more full time contributors would definitely help a lot |
09:25:10 | FromDiscord | <creikey> In reply to @kraptor "<@180866243819995136> I'd say that": I definitely think it's fast paced but all of the new features are flags because they're unstable right |
09:25:24 | FromDiscord | <Elegantbeef> Well not all |
09:25:29 | FromDiscord | <creikey> In reply to @konsumlamm "idk if money actually": there's a lot of unsolved open issues on the compiler |
09:25:35 | FromDiscord | <creikey> which is what worries me |
09:25:38 | FromDiscord | <creikey> and when I look at the source of the compiler |
09:25:43 | FromDiscord | <creikey> it seems crazy |
09:26:04 | FromDiscord | <konsumlamm> In reply to @kraptor "<@180866243819995136> I'd say that": meanwhile i'm still waitong for concepts and view types lol |
09:26:07 | FromDiscord | <Elegantbeef> Eh many bugs are caused by semi-simple things |
09:26:07 | FromDiscord | <creikey> that and araq said it was designed for ref gc not orc so it would be too slow on orc(??) that sounds like a red flag to me but I'm not experienced enough with orc to know |
09:26:20 | FromDiscord | <konsumlamm> (in a usable state that is) |
09:26:22 | FromDiscord | <creikey> In reply to @Elegantbeef "Eh many bugs are": yeah I'm familiar with this from other open source projects |
09:26:33 | FromDiscord | <creikey> I come from godot and have fixed issues like that it's just an accumulation of them that causes problems |
09:26:52 | FromDiscord | <haxscramper> nobody knows how compiler works really |
09:27:04 | NimEventer | New thread by Drkameleon: Weird error on Ubuntu 2x.04, see https://forum.nim-lang.org/t/9303 |
09:27:08 | FromDiscord | <haxscramper> it just does stuff most of the time |
09:27:09 | FromDiscord | <haxscramper> in the code I mean |
09:27:12 | FromDiscord | <konsumlamm> In reply to @creikey "there's a lot of": yes, and? |
09:27:15 | FromDiscord | <creikey> In reply to @mratsim "Seldom-tested features cause bugs.": pretty cool actually |
09:27:16 | FromDiscord | <kraptor> @creikey seems crazy because it's too abstract and it's been developed for 17 years now 😛 |
09:27:19 | FromDiscord | <haxscramper> like AI from the meme |
09:27:23 | FromDiscord | <haxscramper> you open it up |
09:27:24 | FromDiscord | <creikey> In reply to @kraptor "<@180866243819995136> seems crazy because": yeah I can't even imagine |
09:27:29 | FromDiscord | <creikey> In reply to @haxscramper "nobody knows how compiler": looool |
09:27:34 | FromDiscord | <kcnaiamh> In reply to @kcnaiamh "Still no luck 😦": can anyone help?↵why its showing seg fault |
09:27:34 | FromDiscord | <haxscramper> and there are 10E9 `if` statements in there |
09:27:41 | FromDiscord | <creikey> In reply to @haxscramper "and there are 10E9": oh my god |
09:28:11 | FromDiscord | <xflywind> In reply to @creikey "that and araq said": where? |
09:28:48 | FromDiscord | <Elegantbeef> I've never seen a segfault from stock compiler↵(@kcnaiamh) |
09:28:51 | FromDiscord | <creikey> In reply to @flywind "where?": https://media.discordapp.net/attachments/371759389889003532/997072171576868864/unknown.png |
09:28:52 | FromDiscord | <Elegantbeef> That's an impressive feat |
09:29:20 | FromDiscord | <Elegantbeef> It doesnt say it's slower |
09:29:25 | FromDiscord | <creikey> yeah I remembered wrong |
09:29:44 | FromDiscord | <creikey> lol this guy has a real life nim crown https://media.discordapp.net/attachments/371759389889003532/997072395774996531/unknown.png |
09:29:49 | FromDiscord | <creikey> that's so cool |
09:30:05 | FromDiscord | <xflywind> In reply to @creikey "": The info is outdated, it is not actually related to seq implementation. |
09:30:23 | FromDiscord | <Elegantbeef> Anyway point is if you stay away from the edges you |
09:30:24 | FromDiscord | <Elegantbeef> 're probably fine |
09:30:38 | FromDiscord | <creikey> that's good news because when I looked at rust the situation was even worse |
09:30:42 | FromDiscord | <Elegantbeef> If you do complex things you'll almost certainly hit pitfalls of edge cases |
09:30:46 | FromDiscord | <creikey> there's like no good websockets server implemention there |
09:30:49 | FromDiscord | <Elegantbeef> Well rust's async is a real joke |
09:30:50 | FromDiscord | <creikey> (edit) "implemention" => "implementation" |
09:30:53 | FromDiscord | <creikey> yeah it's sooo frustrating |
09:31:07 | FromDiscord | <creikey> in golang the main websockets server is literally just unmaintained |
09:31:09 | FromDiscord | <Elegantbeef> There are so many issues with it's async and i know atleast 1 person that wishes they did the Nim thing of async in macros |
09:31:19 | FromDiscord | <creikey> at least with nim it's treeform and I can read the code, it's simple, and probably used in one of his projects |
09:31:40 | FromDiscord | <xflywind> In reply to @creikey "": see https://github.com/nim-lang/Nim/pull/19989 the memory usage has already dropped from 1.2 gib to 800 mib |
09:31:53 | FromDiscord | <creikey> In reply to @flywind "see https://github.com/nim-lang/Nim/pull/19989 the ": that much memory is bananas???? wtf is going on in that compiler |
09:32:00 | FromDiscord | <creikey> what's the size of all the text code of the compiler |
09:32:02 | FromDiscord | <creikey> (edit) "what's the size of all the text code of the compiler ... " added "source" |
09:32:08 | FromDiscord | <haxscramper> compile the compiler |
09:32:11 | FromDiscord | <haxscramper> 800mb |
09:32:16 | FromDiscord | <Elegantbeef> Compiling 100k lines of code is a lot of memory |
09:32:23 | FromDiscord | <creikey> In reply to @Elegantbeef "Compiling 100k lines of": it's 100k lines? |
09:32:24 | FromDiscord | <creikey> wow |
09:32:25 | FromDiscord | <haxscramper> well, if you look at how much token object takes up in memory |
09:32:27 | FromDiscord | <haxscramper> or PNode |
09:32:41 | FromDiscord | <creikey> In reply to @Elegantbeef "Compiling 100k lines of": honestly less than I thought it would be |
09:32:44 | FromDiscord | <creikey> 100k lines is like |
09:32:45 | FromDiscord | <haxscramper> token is just insanely huge |
09:32:48 | FromDiscord | <creikey> not bananas bananas |
09:33:01 | FromDiscord | <creikey> In reply to @haxscramper "token is just insanely": yeah I like the look of zig but it's not 1.0 and the syntax around arrays and lists is really weird |
09:33:04 | FromDiscord | <Elegantbeef> Oh i know this too well given my dumb PR to make templates/macros show unexpanded code |
09:33:22 | FromDiscord | <Elegantbeef> A lot of zig i'd say is weird |
09:33:25 | FromDiscord | <Elegantbeef> But solid compiler |
09:33:34 | FromDiscord | <creikey> In reply to @Elegantbeef "But solid compiler": yeah the look of the new self hosted is very promising to me |
09:33:42 | FromDiscord | <creikey> my biggest gripe with nim is too many allocations |
09:33:44 | FromDiscord | <creikey> that you can't see |
09:33:54 | FromDiscord | <Elegantbeef> Uhhh |
09:33:55 | FromDiscord | <creikey> but honestly it's so much faster and easier to use than every other language I don't really care in the end |
09:34:00 | FromDiscord | <xflywind> Even refc occpies more than 600 Mib memory and it is reasonable for orc to use more memories since it has more optimizations. |
09:34:22 | FromDiscord | <creikey> In reply to @flywind "Even refc occpies more": oh that's right orc does autofree reasoning |
09:34:25 | FromDiscord | <creikey> (edit) "In reply to @flywind "Even refc occpies more": oh that's right orc does autofree reasoning ... " added "righ" |
09:34:27 | FromDiscord | <creikey> (edit) "righ" => "right" |
09:34:34 | FromDiscord | <Elegantbeef> Does Nim really have many hidden allocations? |
09:34:41 | FromDiscord | <Elegantbeef> I'm trying to think of them aside |
09:34:50 | FromDiscord | <Elegantbeef> from exception handling |
09:34:54 | FromDiscord | <creikey> I know strings do a lot |
09:35:01 | FromDiscord | <Elegantbeef> They're not hidden |
09:35:10 | FromDiscord | <creikey> by hidden allocation I mean you don't pass an allocator or memory handle to std |
09:35:15 | FromDiscord | <creikey> or some other library |
09:35:18 | FromDiscord | <Elegantbeef> That's not hidden to me |
09:35:19 | FromDiscord | <xflywind> See also https://github.com/nim-lang/Nim/pull/19995 which intends to improve the performance of the move analyser |
09:35:20 | FromDiscord | <creikey> like it's assumed that other code will be doing some allocation |
09:35:25 | FromDiscord | <creikey> that you can't control/don't know about |
09:35:35 | FromDiscord | <Elegantbeef> Hidden is an allocation that happens from no input from the programmer |
09:35:53 | FromDiscord | <Elegantbeef> Yea that's not what i'd define as hidden but my definition is probably wrong |
09:35:55 | FromDiscord | <xflywind> I also have a simple Github Action to track the memory usage => https://github.com/nim-lang/Nim/pull/20020#issuecomment-1183315970 |
09:35:58 | FromDiscord | <creikey> In reply to @Elegantbeef "Yea that's not what": so is mine |
09:36:20 | FromDiscord | <Elegantbeef> If there is programmer input i dont feel it's a hidden allocation 😄 |
09:36:30 | FromDiscord | <Elegantbeef> The most hidden allocation i can think of is the type information on types |
09:36:30 | FromDiscord | <creikey> In reply to @flywind "See also https://github.com/nim-lang/Nim/pull/19995": it seems like most commits to the compiler are more green than red which is why it's 100k lines now |
09:36:56 | FromDiscord | <creikey> In reply to @Elegantbeef "If there is programmer": yeah I just want things to be reasonable with memory |
09:37:06 | FromDiscord | <Elegantbeef> I mean Nim is reasonable on memory |
09:37:09 | FromDiscord | <creikey> not 100 mallocs for one function and I don't know about it |
09:37:20 | FromDiscord | <creikey> when it could be like 2 at the start and I pass a fixed buffer |
09:37:26 | FromDiscord | <creikey> malloc is so expensive |
09:37:34 | FromDiscord | <Elegantbeef> On windows\ |
09:37:34 | FromDiscord | <konsumlamm> In reply to @Elegantbeef "Anyway point is if": sadly those edges also includes stuff like using 64 bit integers on the JS backend, not just crazy generics |
09:38:00 | FromDiscord | <Elegantbeef> I mean `var openArray[T]` exists so make PRs and be happy with it |
09:38:25 | FromDiscord | <Elegantbeef> Nim has mechanisms for encouraging memory reuse and not allocating |
09:38:30 | FromDiscord | <creikey> In reply to @Elegantbeef "Nim has mechanisms for": like what? |
09:38:38 | FromDiscord | <konsumlamm> In reply to @creikey "that's good news because": what situation? at least i've never seen a compiler bug in Rust (outside of nightly features, but those are nightly for a reason) |
09:38:39 | FromDiscord | <creikey> In reply to @Elegantbeef "I mean `var openArray[T]`": yeah openArray is cool |
09:38:55 | FromDiscord | <creikey> In reply to @konsumlamm "what situation? at least": not compiler bugs, but how much it suits what I'm trying to do |
09:38:58 | FromDiscord | <Elegantbeef> reference passing, open arrays, preallocating collections |
09:39:04 | FromDiscord | <creikey> I have spent an hour shopping for stacks instead of actually working on the thing |
09:39:12 | FromDiscord | <creikey> I'm close to just using nim and movingon |
09:39:13 | FromDiscord | <creikey> (edit) "movingon" => "moving on" |
09:39:40 | FromDiscord | <creikey> In reply to @konsumlamm "what situation? at least": how do I do a websocket server in rust without 8 billion new syntax functional functoids? |
09:40:09 | FromDiscord | <Elegantbeef> Also i'd consider iterators over procedures that return `seq[T]` a mechanism to reduce memory usage |
09:40:17 | FromDiscord | <Elegantbeef> Iterators can always have a helper proc that emits a sequence |
09:40:46 | FromDiscord | <creikey> like what is this?? https://media.discordapp.net/attachments/371759389889003532/997075172400037999/unknown.png |
09:40:58 | FromDiscord | <Elegantbeef> Me going to sleep |
09:41:03 | FromDiscord | <konsumlamm> In reply to @creikey "how do I do": idk, never tried to use websockets |
09:41:12 | FromDiscord | <creikey> I know what it is and I get that the extra syntax are because rust provides certain safety guarantees and you handle the error cases by describing your program like this |
09:41:52 | FromDiscord | <creikey> but like you need 8 billion imports to ech oback https://media.discordapp.net/attachments/371759389889003532/997075450016837682/unknown.png |
09:41:54 | FromDiscord | <creikey> (edit) "ech oback" => "echo back" |
09:42:15 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=44kf |
09:42:27 | FromDiscord | <konsumlamm> i find it perfectly readable ¯\\_(ツ)\_/¯ |
09:42:28 | FromDiscord | <creikey> all of this to send like one message |
09:42:43 | FromDiscord | <creikey> In reply to @konsumlamm "i find it perfectly": maybe my aversion to code like this is irrational |
09:42:48 | FromDiscord | <creikey> I've been using rust for years |
09:42:54 | FromDiscord | <creikey> and I still just like |
09:43:00 | FromDiscord | <creikey> don't like how it looks |
09:43:15 | FromDiscord | <creikey> https://github.com/creikey/rust-pong/blob/main/relay-server/src/main.rs like I wrote similar code for this |
09:43:54 | FromDiscord | <kcnaiamh> I pulled nimlang/nim container and nim works find there |
09:44:05 | FromDiscord | <kcnaiamh> don't know what is the problem on my local machine |
09:58:51 | FromDiscord | <planetis> I tried to write a sso strings library and the biggest bottleneck was this line: if long: s.long.data[i] else: s.short.data[i]. string allocations were meaningless at least on linux |
10:00:14 | FromDiscord | <planetis> There is a benchmark with 10k allocations with half short half long strings and performance was the same with std/strings |
10:01:23 | FromDiscord | <planetis> but accessing data with this pattern made 2s->6s increase which is crazy |
10:03:17 | FromDiscord | <planetis> Also I find rust is awful, it sucks the fun out of programming, for safety's sake. |
10:09:34 | FromDiscord | <dom96> sent a code paste, see https://play.nim-lang.org/#ix=44kn |
10:09:42 | FromDiscord | <dom96> for some that is a trade off worth having |
10:17:28 | FromDiscord | <xflywind> Does goto exception change the behaiour of IndexDefect> |
10:17:33 | FromDiscord | <xflywind> (edit) "IndexDefect>" => "IndexDefect?" |
10:17:49 | FromDiscord | <xflywind> sent a code paste, see https://play.nim-lang.org/#ix=44ko |
10:18:27 | FromDiscord | <xflywind> doAssertRaises can no longer catch IndexDefect. |
10:18:42 | FromDiscord | <xflywind> sent a code paste, see https://play.nim-lang.org/#ix=44kp |
10:22:36 | FromDiscord | <creikey> In reply to @dom96 "most of that verbosity": there's no error handling in that snippet though? |
10:22:59 | FromDiscord | <creikey> well like it is handling an error |
10:23:04 | FromDiscord | <dom96> lol |
10:23:17 | FromDiscord | <creikey> I didn't mean it's bad that errors have to be handled or unwrapped or whatever |
10:23:21 | FromDiscord | <dom96> it is indeed literally handling an error, ergo there is error handling :) |
10:23:30 | FromDiscord | <creikey> but why in this`tokio::task::spawn(client_rcv.forward(client_ws_sender).map(` is it reaching across tokio and task and forward and map |
10:23:45 | FromDiscord | <creikey> there's 7 words on this one line just to send some text to a client |
10:24:21 | FromDiscord | <dom96> also I'm pretty sure you can write `.expect("Error sending websocket")` instead of the whole `map`. |
10:24:43 | FromDiscord | <dom96> spawn is probably because you don't want to await it |
10:25:49 | FromDiscord | <dom96> and you could get rid of the `tokio::task::` as well with a correct `use` |
10:26:20 | FromDiscord | <soundmodel> it's a bit sad to read about "I have written Python programs for 10 years" kinds of posts |
10:27:23 | FromDiscord | <soundmodel> (edit) "posts" => "posts, when it's possible the something Nim is around the corner" |
10:27:35 | FromDiscord | <soundmodel> (edit) "the" => "that" |
10:27:41 | FromDiscord | <soundmodel> (edit) "it's a bit sad to read about "I have written Python programs for 10 years" kinds of posts, when it's possible that something ... Nim" added "like" |
10:28:38 | FromDiscord | <laker31> I installed Nim via choosenim on an M1, but for some reason it installed the amd64 version (that's what nim -v says).↵Does anybody know how to actually get the arm64 version with choosenim? |
10:29:36 | FromDiscord | <dom96> You can't right now, there is a pending PR to add support for this |
10:29:59 | FromDiscord | <dom96> Which reminds me, I need to review it |
10:30:17 | * | toluene0 joined #nim |
10:30:24 | * | toluene quit (Ping timeout: 244 seconds) |
10:30:24 | * | toluene0 is now known as toluene |
10:31:10 | FromDiscord | <dom96> if you'd like you can grab this patch https://github.com/dom96/choosenim/pull/301, build it yourself and replace the `choosenim` in ~/.nimble/bin with it |
10:32:18 | FromDiscord | <laker31> Thank you! And once the PR is merged, would the fix be included next time I update choosenim? |
10:33:50 | FromDiscord | <dom96> In reply to @creikey "It seems like the": Nim async is used in prod because we eat our own dogfood and that is why we eat our own dogfood. Some people really dislike that but it's the only reason async and a lot of web frameworks are where they are at in Nim. |
10:34:12 | FromDiscord | <creikey> In reply to @dom96 "Nim async is used": this is nice |
10:35:54 | FromDiscord | <alehander42> In reply to @dom96 "most of that verbosity": This is good |
10:36:29 | FromDiscord | <dom96> choosenim is also an example of dogfooding and while sometimes it's painful for newcomers to run into bugs they usually indicate something a percentage of them would run into anyway |
10:36:46 | FromDiscord | <dom96> great example of this is OpenSSL v3 |
10:36:57 | FromDiscord | <dom96> sadly the fix is tough for this |
10:37:50 | FromDiscord | <creikey> In reply to @dom96 "choosenim is also an": oh yeah I ran into the openssl thing |
10:38:17 | FromDiscord | <creikey> yeah I fixed it with this https://media.discordapp.net/attachments/371759389889003532/997089647756841010/unknown.png |
10:38:42 | FromDiscord | <dom96> the latest choosenim shouldn't have this issue anymore |
10:38:54 | FromDiscord | <dom96> it was released a few days ago though so maybe you missed it |
10:39:03 | FromDiscord | <creikey> no that was a couple months ago |
10:39:13 | FromDiscord | <creikey> ok honestly now that I actually read the rust websockets code |
10:39:14 | FromDiscord | <creikey> it's not that crazy |
10:39:18 | FromDiscord | <creikey> like slowly |
10:44:33 | FromDiscord | <dom96> Yeah, it definitely requires thinking a little differently and even still Rust is far more verbose than Nim I'd say. |
10:44:48 | FromDiscord | <enthus1ast> maybe choosenim on windows should use the winapi for downloading |
10:44:50 | FromDiscord | <dom96> I finally used it properly just this last month to write a web app and it was a bit of a slog |
10:44:57 | FromDiscord | <dom96> In reply to @enthus1ast "maybe choosenim on windows": it already does |
10:45:07 | FromDiscord | <enthus1ast> ah this was the fix? |
10:45:17 | FromDiscord | <dom96> it has done so for a long time now |
10:45:17 | NimEventer | New thread by Miran: OpenSUSE Reaches First-Class Support for Nim Language, see https://forum.nim-lang.org/t/9304 |
10:45:22 | FromDiscord | <dom96> it uses puppy on Windows |
10:46:25 | FromDiscord | <deeuu> In reply to @dom96 "I finally used it": How come, just to experiment? ps how did you get on with the move? |
10:56:10 | FromDiscord | <TryAngle> In reply to @dom96 "I finally used it": What web framework did u use? At this point rust has soo many lol |
10:57:14 | FromDiscord | <dom96> In reply to @deeuu "How come, just to": A combination of various things: I've been wanting to give Rust a proper go for a big project for a while (best way to learn it), I'm personally not happy with how some things are going in Nim-land so I think having another systems language under my toolbelt is a good idea plus you've got to remember that I've been using only Nim for personal projects for the past 12 years now (that's a long time!). |
10:57:30 | FromDiscord | <dom96> In reply to @TryAngle "What web framework did": Actix + Diesel |
10:57:35 | FromDiscord | <dom96> (edit) "In reply to @TryAngle "What web framework did": Actix + Diesel ... " added "(for the ORM)" |
10:57:41 | FromDiscord | <TryAngle> In reply to @dom96 "Actix + Diesel (for": 💀 |
10:58:06 | FromDiscord | <dom96> Here is what I built in case you're curious: https://mousetrack.co.uk/ |
10:58:06 | FromDiscord | <TryAngle> Ok ye this is a bit of a verbosity |
10:58:52 | FromDiscord | <dom96> Getting Disney fans to visit isn't easy lol |
10:59:38 | FromDiscord | <deeuu> Wasn't expecting that..nice app though |
10:59:42 | FromDiscord | <laker31> In reply to @dom96 "Here is what I": Looks so nice! Is the frontend also done in Nim? |
10:59:50 | FromDiscord | <dom96> Nothing is done in Nim lol |
10:59:58 | FromDiscord | <laker31> Nvm it's Rust haha |
10:59:59 | FromDiscord | <dom96> Front end is react + typescript |
11:00:00 | FromDiscord | <TryAngle> May u do a rant blog post what u don't like about nim-land 🥺 |
11:00:09 | FromDiscord | <laker31> Ah okay |
11:00:54 | FromDiscord | <dom96> In reply to @TryAngle "May u do a": Maybe. It would probably create too much drama. |
11:01:01 | FromDiscord | <dom96> But I am considering it. |
11:01:49 | FromDiscord | <dom96> Typescript is pretty nice too btw |
11:02:07 | FromDiscord | <TryAngle> :nim1:↵💀 |
11:02:50 | FromDiscord | <dom96> In particular I forgot how nice good auto completion/IDE hints are |
11:02:59 | FromDiscord | <dom96> Typescript is second to none from what I've seen so far |
11:03:48 | FromDiscord | <TryAngle> In reply to @dom96 "Typescript is pretty nice": I feel same but with rust actix diesel react u really chose the most boilerplate / vebose stack u could chose 😂 |
11:03:55 | FromDiscord | <planetis> nice website looks like it uses tailwind for CSS? |
11:04:28 | FromDiscord | <dom96> In reply to @TryAngle "I feel same but": rust definitely verbose. React not so much |
11:04:37 | FromDiscord | <dom96> In reply to @planetis "nice website looks like": Yep, first time using tailwind as well :D |
11:04:57 | FromDiscord | <planetis> that I like |
11:05:12 | FromDiscord | <dom96> And I used Figma to put together a design first too - highly recommend doing that because fiddling with design while writing CSS leads to poor design |
11:05:18 | FromDiscord | <TryAngle> In reply to @dom96 "rust definitely verbose. React": U should have a look at Tokio's Axum + sqlx or SeaORM |
11:05:41 | FromDiscord | <dom96> In reply to @TryAngle "U should have a": will do |
11:06:31 | FromDiscord | <TryAngle> It's really really new (like this year?) but It's from Tokio team so I guess it's good |
11:06:32 | FromDiscord | <dom96> I think I looked at sqlx already |
11:08:02 | FromDiscord | <Phil> In reply to @dom96 "In particular I forgot": Have that in java at work. Man do I always miss it with nim |
11:09:27 | FromDiscord | <TryAngle> A @dom96 no matter how much ppl talk about Rust analyzer, JetBrains CLion auto complete is really good, years ahead rust analyzer imo. |
11:10:09 | FromDiscord | <TryAngle> (edit) "A" => "Ah" |
11:27:43 | FromDiscord | <Rika> In reply to @dom96 "Maybe. It would probably": Since when did something like that not cause drama though let’s be real |
11:54:22 | FromDiscord | <federico3> Debian has been shipping up-to-date Nim since years and Ubuntu is feeding from it↵(@soundmodel) |
12:20:05 | FromDiscord | <Prestige> In reply to @dom96 "In particular I forgot": Hoping Nim gets to that level at some point, IDE support is pretty poor in comparison |
12:21:00 | FromDiscord | <Prestige> Have a lot of friends that won't touch Nim for that reason |
12:23:45 | * | jmdaemon quit (Ping timeout: 272 seconds) |
12:35:16 | FromDiscord | <TryAngle> In reply to @Avahe "Have a lot of": Same 😔 😔 😔 |
12:36:05 | FromDiscord | <TryAngle> But one of them is a c++ fan boy and makes fun of me for using a non industry standard language lolll |
12:47:38 | FromDiscord | <Q-Master> Heh, some many years ago my co-workers on other project had been writing a game for PS2 in C++ using Far commander editor. Without any IDEs \:) |
12:48:33 | FromDiscord | <IDF> In reply to @TryAngle "But one of them": make fun of him saying even stroustrupt said he only knows parts of c++ |
12:51:06 | * | noeontheend joined #nim |
12:51:44 | FromDiscord | <laker31> In reply to @Avahe "Hoping Nim gets to": What's the best IDE for Nim right now?↵I am using the Nim extension by saem, Nimsuggest and CodeLLDB, works quite well but I am by no means an advanced coder or anything |
12:51:55 | FromDiscord | <laker31> (edit) "In reply to @Avahe "Hoping Nim gets to": What's the best IDE for Nim right now?↵I am using ... the" added "VSC with" |
12:52:39 | FromDiscord | <laker31> (edit) "saem, Nimsuggest" => "saem (with nimsuggest + nimpretty enabled)" |
12:53:13 | FromDiscord | <IDF> your best bet is using nimlsp with a text editor that supports lsp |
12:54:12 | FromDiscord | <Prestige> I believe VSC with that extension is the best thing we have so far |
12:54:30 | FromDiscord | <Prestige> I'm using neovim with nimlsp, it's okay |
12:54:46 | FromDiscord | <enthus1ast> pkill -9 nimsuggest↵? |
12:54:55 | FromDiscord | <Prestige> No autocompletion and the language server dies all the time |
12:55:15 | FromDiscord | <enthus1ast> taskkill /im nimsuggest.exe /f |
12:55:59 | FromDiscord | <laker31> In reply to @IDF "your best bet is": Ah I see, saem's extension (which I really like) only supports nimlangserver - is that as good as nimlsp? |
13:08:32 | FromDiscord | <Rika> They both use the same thing; Nim’s suggestion engine |
13:08:38 | FromDiscord | <Rika> (edit) "thing;" => "thing," |
13:13:00 | FromDiscord | <enthus1ast> and the commands i sent, helps if it goes wild |
13:14:16 | FromDiscord | <jan0809> In reply to @Avahe "No autocompletion and the": um didnt die yet for me ngl, about autocomp im not entirely sure but i feel like its there (gotta check at home |
13:14:34 | FromDiscord | <TryAngle> In reply to @Avahe "I believe VSC with": wait so nimlsp is better than nimsaem? |
13:14:56 | * | xet7 joined #nim |
13:15:15 | FromDiscord | <enthus1ast> its also interesting that jump to definition works only about 15-20 % of times |
13:15:37 | FromDiscord | <enthus1ast> i often just completely disable nimsuggest in the extension |
13:15:53 | FromDiscord | <enthus1ast> its kinda usless, harmfull even |
13:16:02 | FromDiscord | <jan0809> those didnt ever fail on my end, not even when jumping to stdlib afaik |
13:16:27 | FromDiscord | <TryAngle> In reply to @enthus1ast "its also interesting that": ye that's my biggest issue with nimsaem vsc rn, I always open another VSC window on a second monitor with a git clone of the library and use project search 💀 |
13:16:37 | FromDiscord | <TryAngle> (edit) "💀" => "bc of that💀" |
13:17:29 | FromDiscord | <jan0809> um you guys made sure being on devel? |
13:18:09 | FromDiscord | <laker31> nimsaem devel or? |
13:18:15 | FromDiscord | <jan0809> nim devel |
13:18:40 | FromDiscord | <jan0809> atleast if you use nimlangserver |
13:18:45 | FromDiscord | <enthus1ast> nope stable↵(@jan0809) |
13:18:56 | FromDiscord | <jan0809> that didnt work at all for me |
13:19:00 | FromDiscord | <enthus1ast> 1.6.4 |
13:19:04 | FromDiscord | <jan0809> but devel like charm |
13:19:28 | FromDiscord | <jan0809> think devel is 1.7.1 or something |
13:19:43 | FromDiscord | <laker31> In reply to @jan0809 "nim devel": Ah, no I'm on 1.6.6. But for me the only thing that doesnt work is jumping to the libraries, jumping to procedures or type definitions always works, and so does autocompletion for everything imports |
13:20:12 | FromDiscord | <jan0809> and make sure to apply the settings as said in the readme; |
13:20:30 | FromDiscord | <laker31> (edit) "In reply to @jan0809 "nim devel": Ah, no I'm on 1.6.6. But for me the only thing that doesnt work is jumping to the libraries, jumping to procedures or type definitions always works, and so does autocompletion for everything ... imports" added "but" |
13:21:02 | FromDiscord | <jan0809> In reply to @laker31 "Ah, no I'm on": for me it always crashed right away on stable -> only using `nimlangserver` |
13:22:52 | FromDiscord | <laker31> In reply to @jan0809 "for me it always": Ah that's strange, I haven't ever had that happen |
13:23:02 | FromDiscord | <soundmodel> is there any list of community tasks for Nim? |
13:23:12 | FromDiscord | <laker31> What's weird for me is that jumping and autosuggest for imports doesnt work on neither nimlangserver nor nimsuggest 🤔 |
13:23:17 | FromDiscord | <jan0809> just saw on git current stable seem to work now |
13:23:29 | * | noeontheend quit (Ping timeout: 255 seconds) |
13:24:19 | FromDiscord | <jan0809> https://media.discordapp.net/attachments/371759389889003532/997131432608682044/IMG_20220714_152338.jpg |
13:26:01 | FromDiscord | <laker31> So on devel do suggestions for imports work for you? (with `nimlangserver`) |
13:27:09 | FromDiscord | <jan0809> im not sure gotta check when im athome |
13:27:42 | FromDiscord | <laker31> Thanks, I'd love to know. It's not a big deal but slightly annoying 😄 |
13:28:18 | FromDiscord | <xflywind> In reply to @soundmodel "is there any list": What do you mean by "community tasks"? |
13:28:35 | FromDiscord | <soundmodel> tasks that a community may develop in open source way |
13:28:53 | FromDiscord | <soundmodel> I mean I originally came in only as a user, but seeing that Nim is incomplete, I've been wondering what's the best use of time |
13:28:59 | FromDiscord | <soundmodel> to develop the compiler or write libraries |
13:29:32 | FromDiscord | <soundmodel> based on what's seen on other languages a language will not gain widespread industrial interest as long as it's immature |
13:29:40 | FromDiscord | <soundmodel> because no business will take a risk like that |
13:31:10 | FromDiscord | <soundmodel> e.g. https://news.ycombinator.com/item?id=24526861 |
13:32:10 | FromDiscord | <Rika> nim itself is oss so...? |
13:34:22 | FromDiscord | <soundmodel> yes, but then you study e.g. how C++ or something is developed |
13:34:33 | FromDiscord | <soundmodel> or Linux |
13:34:59 | FromDiscord | <soundmodel> you need an original designer to give insight as to the prospects |
13:35:14 | FromDiscord | <soundmodel> otherwise someone comes and makes Nim to JavaScript 2 |
13:36:01 | FromDiscord | <vestel> how do I do list comprehensions? |
13:36:11 | FromDiscord | <Rika> look at issues perhaps or https://github.com/nim-lang/needed-libraries |
13:36:30 | FromDiscord | <soundmodel> yes, this is part of it, but library dev != compiler dev |
13:36:36 | FromDiscord | <soundmodel> != langdev |
13:36:48 | FromDiscord | <Rika> In reply to @vestel "how do I do": https://nim-lang.org/docs/sugar.html#collect.m%2Cuntyped |
13:37:05 | FromDiscord | <Rika> In reply to @soundmodel "yes, this is part": then the nim issues page |
13:37:08 | FromDiscord | <Rika> as ive mentioend |
13:37:20 | FromDiscord | <soundmodel> particularly there's this risk that someone writes a library that ends up into some compiler bugs |
13:38:09 | FromDiscord | <soundmodel> (edit) "particularly" => "particularly," |
13:38:23 | FromDiscord | <jan0809> thats a good idea tho, im not into enough yet, but that makes it way easier for potentional ready to contrib ppl to find out where to look into |
13:38:59 | FromDiscord | <Phil> In reply to @vestel "how do I do": You may want to alternatively consider sequtils or (if performance matters) straight up for loops. |
13:39:22 | FromDiscord | <soundmodel> and depending on how deep things are some things can grow out of context |
13:39:38 | FromDiscord | <jan0809> In reply to @jan0809 "thats a good idea": you can do i think its called collect |
13:39:42 | FromDiscord | <Rika> theres a label "Easy" https://github.com/nim-lang/Nim/issues?q=is%3Aopen+is%3Aissue+label%3AEasy |
13:39:57 | FromDiscord | <jan0809> thats quite similar to what list comps do |
13:39:58 | FromDiscord | <soundmodel> like can someone develop the compiler unless one has x years of experience with it already |
13:40:19 | FromDiscord | <Rika> you can also do documentation |
13:40:29 | FromDiscord | <soundmodel> when e.g. GCC is, in comparison, 15 million LOC |
13:40:31 | FromDiscord | <jan0809> lol |
13:41:15 | FromDiscord | <xflywind> In reply to @soundmodel "yes, this is part": Well take an accepted RFC |
13:41:43 | FromDiscord | <xflywind> https://github.com/nim-lang/RFCs/issues?q=is%3Aissue+is%3Aopen+label%3A%22Accepted+RFC%22 |
13:42:02 | FromDiscord | <Rika> In reply to @flywind "Well take an accepted": thats quite a bit larger and harder to implement |
13:43:12 | FromDiscord | <jan0809> In reply to @Rika "you can also do": what would be insanely usefull (atleslast for me) is a list of python terms and whats the nim counterpart |
13:43:32 | FromDiscord | <jan0809> 😶🌫️ |
13:43:39 | FromDiscord | <Rika> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers/17297a0eacf950b4c137b9db3988800696fbe0b0 |
13:44:18 | FromDiscord | <jan0809> neat |
13:44:27 | FromDiscord | <xflywind> In reply to @soundmodel "you need an original": There are also more challenge tasks like https://github.com/nim-lang/compilerdev/issues |
13:44:51 | FromDiscord | <Rika> oh thats a new repo |
13:44:53 | FromDiscord | <Rika> never seen it |
13:45:45 | FromDiscord | <xflywind> It is old but tough |
13:47:33 | FromDiscord | <TryAngle> In reply to @soundmodel "because no business will": if ur business is not using v-lang yet, is it really a business? |
13:48:25 | FromDiscord | <soundmodel> but I'm also wondering whether compiler dev != other dev |
13:48:34 | FromDiscord | <soundmodel> i.e. that it takes too much energy to do everything |
13:49:17 | * | noeontheend joined #nim |
13:50:31 | FromDiscord | <soundmodel> also cannot find any "beginner doc for the compiler dev" |
13:51:15 | FromDiscord | <xflywind> In reply to @soundmodel "also cannot find any": did you read the contributing guide? |
13:51:42 | FromDiscord | <xflywind> https://nim-lang.github.io/Nim/contributing.html |
13:53:05 | FromDiscord | <soundmodel> I skimmed it, but I couldn't find an overview on how the compiler works |
13:53:09 | FromDiscord | <soundmodel> and what its principles are |
13:55:19 | FromDiscord | <voidwalker> pls help me with this bugger, I am trying to achieve something like this: ` dbsql.exec(sql"INSERT OR REPLACE INTO ? (?) VALUES (?)",tbName, tsv.headers, tsv.row)↵` |
13:55:37 | FromDiscord | <voidwalker> tbName is a string, while the rest are obviously seq[string] |
13:55:50 | * | noeontheend quit (Ping timeout: 240 seconds) |
13:55:54 | FromDiscord | <voidwalker> is it even possible without dynamically generating the required number of `?` signs ? |
13:56:55 | FromDiscord | <xflywind> In reply to @soundmodel "I skimmed it, but": The compiler uses multiple passes. I don't know the overview. But there is going to be a Nim compiler book soon. |
13:57:10 | FromDiscord | <Rika> In reply to @soundmodel "I skimmed it, but": because there isnt any i believe, you just go into it and read the code (as ive heard from others) |
13:57:23 | FromDiscord | <Rika> In reply to @flywind "The compiler uses multiple": really? when was this announced |
13:58:15 | FromDiscord | <voidwalker> can i even somehow check the sql query generated from a exec(dbConn) ? |
13:59:01 | FromDiscord | <xflywind> In reply to @Rika "really? when was this": it is the grapevine. |
13:59:12 | FromDiscord | <Rika> ? |
14:00:26 | FromDiscord | <xflywind> (edit) "In reply to @Rika "really? when was this": ... itfrom" added "I heard" | "is" => "from" |
14:01:51 | FromDiscord | <xflywind> Anyway, there is an easy task to take now => backport https://github.com/nim-works/nimskull/pull/380 to upstream |
14:06:47 | FromDiscord | <enthus1ast> @voidwalker\: no this is not possible |
14:07:22 | FromDiscord | <voidwalker> @enthus1ast yeah, I just came to the exact conclusion. A ? gets replaced by an element of the varargs array, not an array(seq) itself |
14:08:01 | FromDiscord | <voidwalker> so i need to do something like repeat("?,") |
14:08:40 | NimEventer | New post on r/nim by naimul9m: printing string giving segmentation fault error, see https://reddit.com/r/nim/comments/vywqtw/printing_string_giving_segmentation_fault_error/ |
14:10:11 | FromDiscord | <voidwalker> is there a string proc to deletethe last n chars from it ? |
14:10:23 | FromDiscord | <enthus1ast> better use join for this |
14:10:27 | FromDiscord | <voidwalker> (edit) "deletethe" => "delete the" |
14:10:31 | FromDiscord | <enthus1ast> repeat is not the correct tool |
14:10:57 | FromDiscord | <voidwalker> repeat to generate the correct number of ?, in (?,?,..) |
14:11:02 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=44lh |
14:11:04 | FromDiscord | <enthus1ast> (?),(?) |
14:11:10 | FromDiscord | <voidwalker> oh |
14:11:18 | FromDiscord | <enthus1ast> or withouth () |
14:12:01 | FromDiscord | <voidwalker> you are right.. too many string procs, can't remember them |
14:13:33 | FromDiscord | <enthus1ast> sent a code paste, see https://paste.rs/PTc |
14:14:14 | FromDiscord | <enthus1ast> BUT, i hate it constructing sql like this... |
14:15:18 | FromDiscord | <enthus1ast> sql always feels like a hack to me |
14:15:38 | FromDiscord | <voidwalker> yeah it is, not the most elegant interface to it |
14:15:40 | FromDiscord | <enthus1ast> if you feels fancy you could pr https://github.com/enthus1ast/nisane with something like this, to not get insane next time \:) |
14:17:09 | FromDiscord | <voidwalker> first insane, then nisane |
14:17:32 | FromDiscord | <enthus1ast> mhh the "orm" parts of nisane are rather toyisch |
14:17:52 | FromDiscord | <voidwalker> btw is there a function to enclose a string in "(" and ")" ?: ) |
14:18:11 | FromDiscord | <Rika> "(" & str & ")" |
14:18:14 | FromDiscord | <Rika> xd |
14:18:30 | FromDiscord | <Rika> or even use chars '(' & ... & ')' |
14:19:03 | FromDiscord | <enthus1ast> imho https://nim-lang.org/docs/strutils.html#escape%2Cstring%2Cstring%2Cstring |
14:19:12 | FromDiscord | <enthus1ast> ah |
14:19:12 | FromDiscord | <enthus1ast> no |
14:19:15 | FromDiscord | <enthus1ast> it does more |
14:22:39 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44li |
14:22:45 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=44li" => "https://play.nim-lang.org/#ix=44lj" |
14:22:55 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=44lj" => "https://play.nim-lang.org/#ix=44lk" |
14:23:07 | FromDiscord | <voidwalker> this no go |
14:23:33 | FromDiscord | <voidwalker> Error: type mismatch: got <SqlQuery, string>↵but expected one of:↵proc `&`[T](x: T; y: seq[T]): seq[T] |
14:23:57 | FromDiscord | <enthus1ast> you must create the query as a string, then convert it to sql string |
14:24:10 | FromDiscord | <enthus1ast> sql(query) |
14:24:17 | FromDiscord | <Rika> yeah |
14:24:22 | FromDiscord | <Rika> `sql("INSERT OR REPLACE INTO ? (" & paramWhat & ") VALUES ( "& paramWhat & ")")` |
14:24:36 | FromDiscord | <enthus1ast> but this is unsafe, sqlinjection is possible here |
14:24:47 | FromDiscord | <voidwalker> we have been over this a few days ago I think |
14:24:57 | FromDiscord | <voidwalker> dejavu |
14:25:04 | FromDiscord | <enthus1ast> could be |
14:26:55 | FromDiscord | <voidwalker> create the query as a string, you mean I have to assign it to a var first, and then pass that ? |
14:27:01 | FromDiscord | <voidwalker> and why do I have to do that in this case? |
14:27:12 | FromDiscord | <voidwalker> because of using paramWhat string inside ? |
14:27:18 | FromDiscord | <enthus1ast> because sql is a distinct string |
14:27:30 | FromDiscord | <enthus1ast> and & is not overloaded / borrowed |
14:27:30 | * | arkurious joined #nim |
14:27:47 | FromDiscord | <voidwalker> not sure what that means |
14:28:07 | FromDiscord | <voidwalker> Ahh you mean I get a string, and not a distinct string, by using & ? |
14:28:34 | FromDiscord | <enthus1ast> https://nim-lang.org/docs/db_common.html#SqlQuery |
14:28:36 | FromDiscord | <enthus1ast> yes |
14:30:25 | FromDiscord | <phillvancejr (phillvancejr)> Can I overload the assignment operator for a distinct integral type? |
14:31:28 | FromDiscord | <Rika> as in `=`? i dont think so no |
14:32:11 | FromDiscord | <phillvancejr (phillvancejr)> Ah ok, thank you |
14:32:48 | FromDiscord | <jan0809> bless you sir |
14:34:19 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44lm |
14:35:04 | FromDiscord | <Rika> its not that vulnerable to injection that code, since its not directly using user input, but you'll prolly be fucked if some lad puts a tsv with 123489719284789124897 columns |
14:35:38 | FromDiscord | <voidwalker> well, it's for use on a specific tsv set, from imdb |
14:35:51 | FromDiscord | <voidwalker> I want to replace 7 import procedures for each tsv with one : D |
14:36:13 | FromDiscord | <voidwalker> So basically this was that, I've done it |
14:36:30 | FromDiscord | <voidwalker> as long as I'm happy with all data types being varchar in the db. Which I am not |
14:55:52 | FromDiscord | <Phil> In reply to @voidwalker "finally it works !": Whenever I have to insert variables into strings I immediately go for strformat |
14:56:52 | FromDiscord | <Phil> In my personal preference strings formatted with strformat are easier to read compared to using the concat operator |
14:58:27 | FromDiscord | <voidwalker> I see, I shall investigate it one day |
14:59:56 | FromDiscord | <Phil> It's basically`fmt"my var X has value: {X}"` |
15:01:10 | FromDiscord | <voidwalker> meanwhile, what would be a good way to add a string to each element in a seq[string] ? |
15:01:14 | FromDiscord | <voidwalker> map ? |
15:01:30 | FromDiscord | <Rika> map sure yeah |
15:03:02 | FromDiscord | <enthus1ast> but @Phil recommendation with strformat is good |
15:03:03 | FromDiscord | <enthus1ast> it borrows the implementation from eg `&` from the non distinct type (which is string in `SqlQuery` case) |
15:03:05 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=44lK |
15:04:24 | FromDiscord | <voidwalker> I see, why wasn't this done in the lib itself ? |
15:05:47 | FromDiscord | <Rika> because its not needed |
15:05:54 | FromDiscord | <Rika> or was deemed not required for sql queries |
15:09:24 | FromDiscord | <Knedlik> Hey guys, quickly jumping here to ask, is there a guide somewhere to generating debug symbols? |
15:09:25 | FromDiscord | <ripluke> How can I make a website with nim that's interactive |
15:09:35 | FromDiscord | <ripluke> Without using js lol |
15:10:06 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44lN |
15:10:37 | FromDiscord | <Rika> In reply to @ripluke "Without using js lol": then you're limited to generating html with links |
15:10:44 | FromDiscord | <voidwalker> is there some shorter way to map appending a string ? |
15:11:06 | FromDiscord | <Rika> `import sequtils; str.mapIt(it & "something")`? |
15:11:45 | FromDiscord | <ripluke> In reply to @Rika "then you're limited to": Hmm |
15:12:30 | FromDiscord | <enthus1ast> which is the BEST html↵(@.luke) |
15:12:30 | * | tomboh quit (Ping timeout: 260 seconds) |
15:12:52 | FromDiscord | <enthus1ast> fast, bloat free, battery friendly, you name it |
15:12:54 | FromDiscord | <Rika> im building a website without js too |
15:13:01 | FromDiscord | <Rika> prefetch would be nice tho |
15:13:17 | FromDiscord | <ripluke> In reply to @enthus1ast "fast, bloat free, battery": And if I want interactivity do I use script tags |
15:13:25 | FromDiscord | <Rika> i thought you said no js |
15:13:28 | FromDiscord | <Rika> that is js |
15:14:09 | FromDiscord | <ripluke> In reply to @Rika "that is js": Well yea but I dont think that you can replace js with nim (rn atleast) |
15:14:18 | FromDiscord | <Rika> ?????????????????????????????????????????????? |
15:14:22 | FromDiscord | <ripluke> Maybe using something like wasm |
15:14:44 | FromDiscord | <enthus1ast> nim js yourfile.nim |
15:14:53 | FromDiscord | <Rika> nim compiles to js bro |
15:15:13 | FromDiscord | <ripluke> In reply to @Rika "nim compiles to js": I forgot about that 💀 |
15:16:06 | FromDiscord | <enthus1ast> when i build websites in nim i usually do server side rendering (with nimja) + javascript |
15:16:44 | FromDiscord | <enthus1ast> it's easier / faster to just use a 3rd party module (my js is mostly crap anyway) |
15:17:19 | FromDiscord | <ripluke> https://github.com/andreaferretti/react.nim↵This seems cool |
15:17:30 | FromDiscord | <ripluke> And I already have some experience with react |
15:17:34 | FromDiscord | <ripluke> Might use this |
15:17:42 | FromDiscord | <enthus1ast> also have a look at karax |
15:18:30 | FromDiscord | <soundmodel> In reply to @Rika "because there isnt any": Ehh, you think this works out? |
15:18:39 | FromDiscord | <Rika> no |
15:18:40 | FromDiscord | <Rika> of course not |
15:18:42 | FromDiscord | <soundmodel> I've seen such projects and while it's doable, it's hard for forming an overview |
15:18:43 | FromDiscord | <Rika> but its the reality |
15:19:06 | FromDiscord | <soundmodel> okay so assuming that GCC was this way, you mean one reads 15 million LOCs? |
15:19:10 | FromDiscord | <soundmodel> (edit) "LOCs?" => "LOC?" |
15:19:10 | FromDiscord | <Rika> i may be uninformed though, i didnt search too much into it |
15:19:25 | FromDiscord | <Rika> but ive not heard of any resources for going into nim compiler dev |
15:19:31 | FromDiscord | <Rika> again |
15:19:33 | FromDiscord | <Rika> i told you |
15:19:39 | FromDiscord | <Rika> i dont think it works out |
15:19:59 | FromDiscord | <soundmodel> well but I started by asking are there resources to know how to contribute to Nim? |
15:20:54 | FromDiscord | <Rika> and library development contributes to nim, in the sense of its ecosystem |
15:21:00 | FromDiscord | <Rika> yet you said it didnt |
15:21:21 | FromDiscord | <Rika> one of nims weak points is its very very small ecosystem |
15:21:35 | FromDiscord | <Rika> its one of the more major weak points i would even say |
15:21:39 | FromDiscord | <soundmodel> yes but then I asked whether it's enough to be a lib dev |
15:21:41 | FromDiscord | <soundmodel> and not compiler dev |
15:21:51 | FromDiscord | <Rika> i think it is enough |
15:22:16 | FromDiscord | <Rika> deeming whether a library is useful enough for proliferation is up to you though |
15:22:30 | FromDiscord | <Rika> of course you're sensible enough to know that an iseven package makes no sense right? |
15:22:35 | FromDiscord | <xflywind> stdlib is easier to contribute to. |
15:23:30 | FromDiscord | <soundmodel> it's a bit boring though to close the compiler info |
15:23:41 | FromDiscord | <soundmodel> I think a proper community project would need to reveal that as well |
15:24:45 | FromDiscord | <soundmodel> then I found this: https://nim-lang.org/docs/intern.html |
15:27:46 | FromDiscord | <Rika> me having forgot that page existed: |
15:27:48 | FromDiscord | <Rika> my bad |
15:32:13 | FromDiscord | <soundmodel> that has pretty good info actually |
15:32:38 | FromDiscord | <soundmodel> but it's surprisingly short |
15:33:13 | FromDiscord | <soundmodel> consider it's a full compiler |
15:33:20 | FromDiscord | <soundmodel> (edit) "consider" => "considering" |
15:34:05 | FromDiscord | <soundmodel> but compare to e.g. the FreeBSD contributing doc: https://docs.freebsd.org/en/articles/contributing/ |
15:42:57 | * | CyberTailor quit (Quit: Konversation terminated!) |
15:45:50 | FromDiscord | <soundmodel> it'd be also nice to understand how many LOCs the compiler is |
15:48:42 | FromDiscord | <soundmodel> since it says there: "It is essential to understand most of the compiler's code." |
15:48:51 | FromDiscord | <soundmodel> so then this might be an investment for someone |
15:49:14 | FromDiscord | <soundmodel> (edit) "someone" => "someone, just like deciding to read a 80 page book vs a 550 page book" |
15:50:57 | FromDiscord | <Phil> In reply to @enthus1ast "it's easier / faster": With how damn fast nim is an SSR page might honestly be faster than rest + front-end js framework |
15:51:56 | * | rwb quit (Ping timeout: 272 seconds) |
15:54:08 | * | rwb joined #nim |
15:58:07 | FromDiscord | <mattrb> In reply to @Elegantbeef "Might be able to": Do you think it's a compiler bug? |
16:03:24 | FromDiscord | <soundmodel> I have to say though that this https://github.com/nim-lang/Nim/tree/devel/compiler looks a bit taxing to start with |
16:04:08 | FromDiscord | <soundmodel> I see no comments on the procs for example |
16:09:23 | FromDiscord | <voidwalker> if I want to have a table with a key (string) and 3 values string,proc, and something else, the only way is a tuple, right ? |
16:09:32 | FromDiscord | <soundmodel> and compare to e.g. https://gcc.gnu.org/onlinedocs/gccint/ |
16:09:34 | FromDiscord | <voidwalker> (edit) "if I want to have a table with a key (string) and 3 values string,proc, and something else, the only way ... is" added "to store the value" |
16:09:43 | FromDiscord | <soundmodel> the Nim compiler's documenting seem very poor compared to this |
16:09:47 | FromDiscord | <soundmodel> (edit) "seem" => "seems" |
16:11:01 | FromDiscord | <soundmodel> (edit) "and compare to e.g. https://gcc.gnu.org/onlinedocs/gccint/ ... " added "or https://rustc-dev-guide.rust-lang.org/" |
16:11:04 | FromDiscord | <soundmodel> (edit) "this" => "these" |
16:14:41 | FromDiscord | <soundmodel> (tbh it wants me to use Rust instead) |
16:14:52 | FromDiscord | <soundmodel> (edit) "wants" => "makes" | "makesme ... to" added "want" |
16:15:04 | FromDiscord | <voidwalker> var updProcs: OrderedTable[string, proc(key:string)] on this kind of table, is it possible to have proc without defining its args, if I want different kinds of procs to be pointed at ? |
16:15:13 | FromDiscord | <voidwalker> (edit) "var" => "`var" | "proc(key:string)]" => "proc(key:string)]`" |
16:15:23 | FromDiscord | <soundmodel> (edit) "instead)" => "instead!)" |
16:18:45 | FromDiscord | <soundmodel> https://nim-lang.org/assets/news/images/survey/nim_displeasing.png |
16:23:03 | * | noeontheend joined #nim |
16:27:24 | FromDiscord | <kraptor> I have to say that, to me, documentation is quite good (compared to most documentation I find for anything else). Of course, I'm not expecting something like Qt docs (that are top of the top) and we can improve in that area but, anyway |
16:28:07 | FromDiscord | <kraptor> It's more concerning the debugging tools status: current nim-gdb wrapper is lacking and it fails most of the time for non-trivial types... 😦 |
16:35:53 | FromDiscord | <soundmodel> then can you say what to read to understand the compiler? |
16:36:20 | FromDiscord | <kraptor> I was talking about the png you shared |
16:36:25 | FromDiscord | <soundmodel> IMO, the docs I've seen make Nim seem unprofessional, which could be the reason Microsoft or something consider Rust etc. |
16:36:27 | * | xet7 quit (Ping timeout: 272 seconds) |
16:36:40 | FromDiscord | <soundmodel> (edit) "IMO, the docs I've seen make Nim seem unprofessional, which could be the reason Microsoft or something consider Rust etc. ... " added "(because they cannot risk playing with some random communities)" |
16:36:59 | FromDiscord | <soundmodel> (edit) "communities)" => "community support)" |
16:41:58 | FromDiscord | <Yardanico> maybe, but most people don't read compiler docs so that won't affect them |
16:42:19 | FromDiscord | <soundmodel> but it also makes the language seem a bit untrustworthy, IMO |
16:42:29 | FromDiscord | <soundmodel> since if it's compiler is non-documented code |
16:42:39 | FromDiscord | <soundmodel> (edit) "it's" => "its" |
16:43:15 | FromDiscord | <soundmodel> it's the same as with badly documented libraries, do you want to risk using them and then hit something that you cannot fix? |
16:43:26 | FromDiscord | <soundmodel> (edit) "fix?" => "fix, since you cannot read the code?" |
16:46:40 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
16:48:58 | * | Lord_Nightmare joined #nim |
16:53:31 | FromDiscord | <soundmodel> and I still want to understand how it's built |
16:53:34 | FromDiscord | <soundmodel> if I'm going to use it |
17:03:37 | FromDiscord | <phillvancejr (phillvancejr)> is there a short cut to iterating through a range? something similar to Ada like `for i in Nums.range` vs `for i in Nums.low .. Nums.high` |
17:03:52 | FromDiscord | <phillvancejr (phillvancejr)> The latter is still short but I just want to know if there is an alternate |
17:11:41 | FromDiscord | <Phil> In reply to @phillvancejr (phillvancejr) "is there a short": `for i in 1..10:` ? |
17:11:53 | FromDiscord | <Phil> no space between the numbers, the range is inclusive |
17:13:37 | FromDiscord | <Rika> No there is nothing like you propose yet |
17:13:47 | FromDiscord | <Rika> It sure sounds nice though |
17:14:13 | FromDiscord | <Phil> I know I'm wonky because I just came off a flight and I've cruel lack of sleep atm |
17:14:31 | FromDiscord | <Phil> But I'm getting the distinct feeling he's asking for something special, what's the special thing |
17:14:41 | FromDiscord | <Phil> Is the bounds of the range not explicit? |
17:15:11 | FromDiscord | <Rika> He’s asking for a proc that returns low and high range without saying low and high range |
17:15:34 | FromDiscord | <Rika> Type.range instead of Type.low .. Type.high |
17:15:47 | FromDiscord | <Phil> Ohhhhhhhhh |
17:16:03 | FromDiscord | <Phil> Shouldn't it be somewhat easy to macrofy that? |
17:16:28 | FromDiscord | <Rika> Proc. No need for a macro here since of HSlice type no? |
17:16:47 | FromDiscord | <Phil> Maybe I should just go to sleep |
17:17:13 | FromDiscord | <Rika> Hahaha it’s okay |
17:17:24 | FromDiscord | <Rika> I’ll be going to sleep though |
17:31:12 | FromDiscord | <voidwalker> https://stackoverflow.com/questions/68217774/how-can-i-create-a-lookup-table-of-different-procedures-in-nim |
17:31:30 | FromDiscord | <voidwalker> `"↵This dynamic way of handling things is not supported in nim. Type of procs has to be known at compile time, that's just a fact."` |
17:31:48 | FromDiscord | <voidwalker> (edit) "`"↵This" => "`"This" |
17:32:38 | FromDiscord | <Rika> ? |
17:32:52 | FromDiscord | <voidwalker> I asked a question about this earlier, and found an answer |
17:33:10 | FromDiscord | <Rika> Oh okay |
17:33:31 | FromDiscord | <voidwalker> And wanted some comments maybe |
17:35:14 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44mg |
17:35:25 | FromDiscord | <voidwalker> this looks like a shitty way to call procs :\ |
17:39:30 | FromDiscord | <Phil> You want to store procs in a table? |
17:39:42 | FromDiscord | <Phil> Can you make them all have the same signature? |
17:40:17 | FromDiscord | <Phil> If so you can store pointers to them, I've done that storing procs for a Django like signal system |
17:41:04 | FromDiscord | <Phil> The same signature is necessary because you'll be type casting the proc pointer in order to be able to invoke the thing |
17:41:17 | FromDiscord | <voidwalker> yes, I want to store procs in a table. So for each column name in a db, I have a different way of parsing it |
17:41:18 | FromDiscord | <Require Support> so noticed that if i have an object with a field as type `JsonNode` and i try to convert the whole object to `JsonNode` using `%` .. i get `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` |
17:42:01 | FromDiscord | <voidwalker> I gues.. I could have them, hmmm, each take just the string of the value as it's supposed to get parsed, and maybe sqlite handles the type conversion for me ? |
17:43:11 | FromDiscord | <voidwalker> I haven't considered that before, I just did parseInt, parseUint, customParseProc |
17:44:49 | FromDiscord | <soundmodel> anyone know about nim-forum password recovery? Don't seem to get a reset email. |
17:51:33 | FromDiscord | <Phil> sent a long message, see http://ix.io/44mk |
17:52:53 | FromDiscord | <Phil> A connect call then looks like this for example:↵` connect(SignalType.stPostCreate, Character, characterCreateSignal)` |
17:53:17 | FromDiscord | <Phil> characterCreateSignal is a proc with this signature in this example:↵`proc characterCreateSignal(connection: DbConn, modelInstance: Character) =` |
17:55:16 | FromDiscord | <Phil> You can, strictly speaking, store procs with wildly different signatures in such a table of pointers.↵However, if you do that, all places that take a pointer from that Hashtable must also know the proc signature to cast the pointer to |
17:59:40 | FromDiscord | <voidwalker> Ok so how would I sugar syntax it so I don't have to write `cast[proc(a: int, b: int): int {.cdecl.}]` every time ? |
18:03:58 | FromDiscord | <Phil> You can make `proc(a: int, b: int): int` a named type (maybe even with the cdecl pragma? no idea), so:↵`type MySuperProc = proc(a: int, b: int): int`↵And then you can use that instead |
18:04:20 | FromDiscord | <Phil> That even helps with readability a bit |
18:04:30 | FromDiscord | <voidwalker> hmm that makes sense |
18:04:44 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=44mo |
18:05:18 | FromDiscord | <voidwalker> I am a long way from having an inner map of how everything can connect to everything else, in nim, and programming in general beyond the simple procedural script programs |
18:05:21 | * | toluene quit (Quit: Ping timeout (120 seconds)) |
18:06:18 | FromDiscord | <voidwalker> Ok, for now I will see if I can make it work with a single type of proc |
18:07:19 | FromDiscord | <Phil> You can, if the word "cast" or the edgy brackets bother you, of course also make a template. But that template will still need to eat the same 2 parameters, namely 1) the specific proc type and 2) the pointer that you're casting |
18:07:22 | * | toluene joined #nim |
18:07:59 | FromDiscord | <Phil> (edit) "casting" => "casting. Which means all that achieves is that you get rid of the edgy brackets and can name the entire operation something other than `cast`" |
18:11:55 | FromDiscord | <voidwalker> Hm sqlite ate my string input even if the column was declared int, without erroring |
18:12:15 | FromDiscord | <voidwalker> (edit) "Hm sqlite ate my string input ... even" added "(that's not a clean int)" |
18:12:29 | FromDiscord | <enthus1ast> sqlite does not check the types |
18:12:37 | FromDiscord | <enthus1ast> i think you can enables this though |
18:13:37 | FromDiscord | <enthus1ast> https://stackoverflow.com/questions/49230311/is-it-possible-to-enforce-sqlite-datatypes |
18:13:50 | FromDiscord | <enthus1ast> but yeah, sqlite is a little strange |
18:14:11 | * | noeontheend quit (Ping timeout: 255 seconds) |
18:18:13 | FromDiscord | <voidwalker> Hm but it should store INT as 1-8 bytes ? that means it silently falls back to VARCHAR if type not compatible? |
18:18:33 | FromDiscord | <voidwalker> `sqlite's datatype isn't associated to its column but to the data themselves: this practically means that you can insert any data to any column.` oh I see |
18:46:19 | FromDiscord | <voidwalker> uhm, can I have functions instead of procs, in a table ? |
18:46:38 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44my |
18:46:59 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=44my" => "https://play.nim-lang.org/#ix=44mz" |
18:47:20 | FromDiscord | <voidwalker> `Error: expression 'ttIdtoId(key)' is of type 'string' and has to be used (or discarded)` |
18:50:39 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=44mA |
18:51:56 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=44mB |
18:54:38 | FromDiscord | <voidwalker> `Error: func keyword is not allowed in type descriptions, use proc with {.noSideEffect.} pragma instead` |
18:56:45 | FromDiscord | <demotomohiro> Then it would need to be `type parseProc = proc (key:string): string {.noSideEffect.}`. |
18:59:21 | FromDiscord | <soundmodel> In reply to @soundmodel "**URGENT**: anyone know about": Anyone know who to contact? |
19:02:04 | FromDiscord | <demotomohiro> I think @dom96 ? |
19:12:13 | FromDiscord | <deech> This may have come up before but I'd like some way have all of an imported module's procs compiled to C/C++ not just the ones that are used. The `{.used.}` pragma doesn't do this, the only way I've found is to add `{.exportc.}` to everything but that's not great either, am I missing something? |
19:14:42 | FromDiscord | <soundmodel> I hope the compiler docs are improved, because I'm now going back to Python because of it |
19:16:39 | FromDiscord | <demotomohiro> In reply to @soundmodel "I hope the compiler": What is the problems in compiler docs? |
19:17:22 | FromDiscord | <soundmodel> that this https://nim-lang.org/docs/intern.html is absolutely rudimentary compared to https://rustc-dev-guide.rust-lang.org/ |
19:17:34 | FromDiscord | <soundmodel> and then when I see the code in Github, it isn't commented |
19:17:39 | FromDiscord | <phillvancejr (phillvancejr)> nim doesn't have modulo ranges like Ada does it? |
19:18:01 | FromDiscord | <soundmodel> (edit) "Github," => "Github (https://github.com/nim-lang/Nim/tree/devel/compiler)," |
19:18:08 | FromDiscord | <soundmodel> (edit) "commented" => "commented. This makes Nim seem very unprofessional." |
19:18:19 | FromDiscord | <soundmodel> (edit) "unprofessional." => "unprofessional and therefore I think going to some language that has better docs." |
19:28:37 | * | noeontheend joined #nim |
19:46:22 | FromDiscord | <jan0809> In reply to @laker31 "Thanks, I'd love to": what should i check for ya? im athome now |
19:46:53 | FromDiscord | <jan0809> if the imports itself do autocomplete? |
19:55:58 | * | pro joined #nim |
20:08:41 | * | rockcavera joined #nim |
20:08:41 | * | rockcavera quit (Changing host) |
20:08:41 | * | rockcavera joined #nim |
20:08:59 | FromDiscord | <sanchopanca> how does one add an item to a HashSet? i don't see anything about it in the docs and my google search results are fruitless too (sorry for potentially silly question, this is my first day using the language) |
20:09:20 | FromDiscord | <Prestige> `incl` I believe |
20:09:32 | FromDiscord | <Generic> see https://nim-lang.org/docs/sets.html |
20:09:44 | FromDiscord | <Generic> it has the same API as the builtin bitsets |
20:09:45 | FromDiscord | <sanchopanca> yeah that's the page i'm looking at |
20:10:37 | FromDiscord | <sanchopanca> ok, incl wasn't an intuitive name 😅 thanks |
20:25:19 | FromDiscord | <planetis> In reply to @phillvancejr (phillvancejr) "nim doesn't have modulo": what dou you mean? |
20:27:06 | FromDiscord | <voidwalker> if I do mapIt() on seq[string], can I get the order number of "it" in the sequence to use ? |
20:29:15 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44nd |
20:29:23 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=44nd" => "https://play.nim-lang.org/#ix=44ne" |
20:29:37 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=44ne" => "https://play.nim-lang.org/#ix=44nf" |
20:30:00 | FromDiscord | <voidwalker> I want to do something like this, where it.ord is the position in the sequence of the element it |
20:34:13 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44nk |
20:37:10 | FromDiscord | <voidwalker> and this does what ? the wording in the doc is too ambiguous for me to understand |
20:37:33 | * | krux02 joined #nim |
20:38:49 | FromDiscord | <planetis> it adds the last statement in the list |
20:39:19 | FromDiscord | <voidwalker> oh I see, and then I use the list itself as data. |
20:41:08 | FromDiscord | <voidwalker> welp, I'd have hoped I can somehow use mapit to keept it a oneliner |
20:41:12 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=44nn |
20:42:15 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44no |
20:43:19 | FromDiscord | <voidwalker> but enumerate can only be used in for loops ? |
20:45:44 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=44nq |
20:49:36 | FromDiscord | <voidwalker> nah, it does not return a sequence to use in map |
20:50:37 | Amun-Ra | mapIt, etc. std/sequtils |
20:51:15 | FromDiscord | <hotdog> Or call `toSeq` on it |
20:52:13 | void09 | mapIt, etc. std/sequtils ? |
20:52:34 | Amun-Ra | for example: mapIt, from std/sequtils |
20:52:54 | void09 | what about mapIt ? my original question was related to mapIt |
20:53:19 | Amun-Ra | I was responding to TryAngle paste |
20:53:38 | * | pro quit (Quit: pro) |
21:05:08 | FromDiscord | <voidwalker> @!Patitotective thank you, that worked. Although it still bugs me that I now have 3 extra potentiall avoidable lines in the code 🙂 |
21:07:44 | FromDiscord | <voidwalker> This is something that @ElegantBeef might know something about |
21:09:00 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44nv |
21:09:06 | FromDiscord | <!Patitotective> count might not be the best name though |
21:12:29 | FromDiscord | <voidwalker> so this would make a sequence of tuples where the first element is the position, and the second the value |
21:12:51 | FromDiscord | <!Patitotective> yes |
21:13:24 | FromDiscord | <voidwalker> so like enumerate, but as a persistent sequence, not an iterator |
21:13:53 | FromDiscord | <voidwalker> Uhm this looks like something so basic.. it must be somehow possible with the standard libraries |
21:15:12 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44ny |
21:15:24 | FromDiscord | <huantian> Isn’t that just someSeq.pairs.toSeq? |
21:15:48 | FromDiscord | <voidwalker> hah it is |
21:23:35 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=44nz |
21:23:44 | FromDiscord | <voidwalker> (edit) "sent a code paste, see https://play.nim-lang.org/#ix=44nz" => "`nim↵ dbsql.exec(sql(sqlQ), tbName & tsv.headers & tsv.row.pairs.toSeq.mapIt(importDict[tsv.headers[it[0]]].parseSq(it[1])))`" |
21:23:56 | FromDiscord | <voidwalker> (edit) "`nim↵ dbsql.exec(sql(sqlQ), tbName & tsv.headers & tsv.row.pairs.toSeq.mapIt(importDict[tsv.headers[it[0]]].parseSq(it[1])))`" => "sent a code paste, see https://play.nim-lang.org/#ix=" |
21:24:06 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=" => "https://play.nim-lang.org/#ix=44nA" |
21:24:52 | FromDiscord | <!Patitotective> you can also use `it.key` and `it.val` to make it clearer imo |
21:25:33 | FromDiscord | <TryAngle> In reply to @huantian "Isn’t that just someSeq.pairs.toSeq?": I always forget pairs exist lol |
21:33:27 | FromDiscord | <voidwalker> When defining a table, can you put multiple keys at once assigned to the same value ? |
21:33:41 | FromDiscord | <voidwalker> So I don't have to use a new line for each of them |
21:34:06 | FromDiscord | <Elegantbeef> You could make a new `[]` operator if you wished |
21:34:11 | FromDiscord | <Elegantbeef> or use a for loop |
21:34:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44nC |
21:40:42 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44nD |
21:42:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44nE |
21:43:23 | FromDiscord | <!Patitotective> it worked without that but i guess its nicer |
21:43:24 | FromDiscord | <Elegantbeef> Actually nevermind i was dumb |
21:44:02 | FromDiscord | <Elegantbeef> Nah i thought there was an issue with recursive calls when K == V |
21:44:04 | * | noeontheend quit (Ping timeout: 272 seconds) |
21:45:04 | FromDiscord | <!Patitotective> nim smart 🧠 |
21:46:15 | FromDiscord | <voidwalker> That's beautiful. I will use it, even though it's not my code and I couldn't write it now with my skills |
21:46:45 | FromDiscord | <Elegantbeef> It's not that complicated, but yea you'll learn |
21:48:09 | FromDiscord | <voidwalker> I will, and reach nimvana |
21:49:49 | FromDiscord | <voidwalker> I bought the 70 EUR mastering nim book btw, I hope it keeps Araq fed until nim 2.0 at least : ) |
21:50:29 | FromDiscord | <voidwalker> It's a bummer I will have to spend a few hours scanning and OCR-ing it though :\ |
22:24:10 | * | noeontheend joined #nim |
22:53:00 | FromDiscord | <ripluke> How can I take a list of colors and compare them to a color to see which is closest |
22:59:37 | FromDiscord | <Elegantbeef> How do you have the colour stored |
22:59:42 | FromDiscord | <Elegantbeef> Also comparing colours is a tricky thing |
22:59:47 | FromDiscord | <Elegantbeef> Cause human perception exists |
23:00:52 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44o7 |
23:01:41 | FromDiscord | <ripluke> Yes that's exactly what I need :) thx! |
23:06:30 | * | jmdaemon joined #nim |
23:19:12 | NimEventer | New thread by Deech: Force compilation of unused parts of a module, see https://forum.nim-lang.org/t/9305 |
23:30:02 | NimEventer | New Nimble package! RaytracingAlgorithm - RayTracing Algorith in Nim, see https://github.com/lorycontixd/RaytracingAlgorithm |
23:43:59 | * | noeontheend quit (Ping timeout: 244 seconds) |
23:44:02 | * | CyberTailor joined #nim |