00:00:10 | FromDiscord | <Elegantbeef> I have a xeon1231v3 my IPC isnt supremely high but it's decent |
00:00:27 | FromDiscord | <Shiba> (edit) "pentium" => "pentium, 2.13ghz" |
00:04:18 | FromDiscord | <Shiba> I choosed freedom over speed, and learned nim while i had lua, i have to face the consequences |
00:04:34 | FromDiscord | <Elegantbeef> What? |
00:04:43 | FromDiscord | <Yardanico> In reply to @Shiba "I choosed freedom over": what |
00:04:53 | FromDiscord | <Yardanico> compilation is a one time thing |
00:05:00 | FromDiscord | <Yardanico> then your nim programs will RUN faster than your lua programs |
00:05:01 | FromDiscord | <Yardanico> much faster |
00:07:26 | FromDiscord | <Shiba> Don't take what i said seriously, it's 2 am here and my brain hurts, i should stop saying dump things and perhaps go sleep |
00:08:47 | * | kayabaNerve joined #nim |
00:11:03 | FromDiscord | <sOkam!> What's the correct syntax to just declare the type of this object element?↵If relevant: Tileset is also a ref object, but of RootObj https://media.discordapp.net/attachments/371759389889003532/925178998974193664/unknown.png |
00:11:14 | FromDiscord | <Yardanico> Table[string, seq[int]] |
00:11:19 | FromDiscord | <Elegantbeef> `Table[string, seq[int]]` |
00:11:21 | FromDiscord | <Yardanico> generic parameters in nim use bracket syntax |
00:11:28 | FromDiscord | <sOkam!> oh square brackets, tyty |
00:11:33 | FromDiscord | <Yardanico> also better write anim: Table |
00:11:42 | FromDiscord | <Yardanico> just a but more idiomatic :P |
00:11:48 | FromDiscord | <sOkam!> no components? |
00:12:04 | FromDiscord | <sOkam!> does it not make the table flexible, or is it flexible anyway? |
00:12:05 | FromDiscord | <Yardanico> ? |
00:12:09 | FromDiscord | <Yardanico> In reply to @sOkam! "does it not make": as in? |
00:12:25 | FromDiscord | <sOkam!> I just want two columns in the table |
00:12:50 | FromDiscord | <sOkam!> Thought that if I don't define the two, it might interpret the table as expandable |
00:12:59 | FromDiscord | <Yardanico> not sure what you mean |
00:13:05 | FromDiscord | <Yardanico> Table is a mapping from one type to another |
00:13:16 | FromDiscord | <Yardanico> in your case it maps different strings to their corresponding seq[int] values |
00:13:36 | FromDiscord | <Yardanico> it's like dict in python if you know that |
00:13:45 | FromDiscord | <Yardanico> but type limited |
00:13:48 | FromDiscord | <sOkam!> exactly. how does it know what to map if not declared on the type? |
00:13:59 | FromDiscord | <Yardanico> ??? it's declared in your type |
00:14:03 | FromDiscord | <Yardanico> Table[string, seq[int]] |
00:14:08 | FromDiscord | <Yardanico> says that you want to map from strings to seq[int] |
00:14:14 | FromDiscord | <sOkam!> In reply to @Yardanico "also better write anim*:": ☝️ |
00:14:21 | FromDiscord | <Yardanico> i meant for : |
00:14:28 | FromDiscord | <Yardanico> i didn't write the full definition of table to save time |
00:14:31 | FromDiscord | <sOkam!> ah for the asterisk, kk |
00:14:31 | FromDiscord | <Yardanico> I meant spacing around : |
00:14:47 | FromDiscord | <Elegantbeef> in nim you do `field: type` |
00:14:59 | FromDiscord | <Elegantbeef> Conventionally atleast |
00:17:16 | FromDiscord | <sOkam!> what's the issue on this one? 🤔 https://media.discordapp.net/attachments/371759389889003532/925180565907451924/unknown.png |
00:17:29 | * | kayabaNerve quit (Ping timeout: 256 seconds) |
00:17:29 | FromDiscord | <sOkam!> I have another one like that with 2 definitions, and it works well |
00:17:37 | FromDiscord | <Yardanico> tuple |
00:17:52 | FromDiscord | <impbox [ftsf]> Tuples don't use on fields |
00:18:00 | FromDiscord | <Yardanico> you don't export fields in a tuple, they're always exported |
00:18:01 | FromDiscord | <sOkam!> oh |
00:18:07 | FromDiscord | <impbox [ftsf]> Only on objects |
00:18:17 | FromDiscord | <Elegantbeef> Well more accurately tuple fields are shorthand for indexing |
00:18:27 | FromDiscord | <Elegantbeef> The fields dont actually exist! |
00:19:04 | FromDiscord | <sOkam!> does that apply to regular types too? |
00:19:10 | FromDiscord | <Elegantbeef> Nope |
00:19:14 | FromDiscord | <sOkam!> or just for tuples explicitly |
00:19:23 | FromDiscord | <sOkam!> kk |
00:19:33 | FromDiscord | <Elegantbeef> Named fields on tuples are just expanded as `yourTuple[indexOfField]` |
00:36:07 | FromDiscord | <sOkam!> https://media.discordapp.net/attachments/371759389889003532/925185310923575376/unknown.png |
00:36:37 | FromDiscord | <Yardanico> ? |
00:36:39 | FromDiscord | <sOkam!> https://media.discordapp.net/attachments/371759389889003532/925185445355192370/unknown.png |
00:37:10 | FromDiscord | <sOkam!> https://media.discordapp.net/attachments/371759389889003532/925185569334644756/unknown.png |
00:37:34 | FromDiscord | <sOkam!> If I hover over it... it recognizes it. But the compiler says nope 😦 |
00:37:43 | FromDiscord | <Yardanico> maybe you import in the wrong order? |
00:37:47 | FromDiscord | <Yardanico> or something, idk |
00:37:53 | FromDiscord | <Yardanico> maybe it's related to nico |
00:38:11 | FromDiscord | <Yardanico> it's better if you ask nico stuff in #gamedev maybe |
00:38:45 | FromDiscord | <sOkam!> I thought it was more syntax-related than gamedev per se, since the issue seems to be the relationship |
00:38:46 | FromDiscord | <fenrave> In reply to @Elegantbeef "https://github.com/abisxir/alasgar is interesting, ": Lol https://media.discordapp.net/attachments/371759389889003532/925185975456522250/unknown.png |
00:39:28 | FromDiscord | <fenrave> Tried the example out because i have nothing better to do |
00:39:32 | FromDiscord | <fenrave> Weird type safety issue |
00:41:28 | FromDiscord | <fenrave> It is a float32..? https://media.discordapp.net/attachments/371759389889003532/925186655676153886/unknown.png |
00:41:34 | FromDiscord | <fenrave> huh |
00:42:09 | FromDiscord | <Yardanico> float32 isn't compatible with float64 |
00:42:15 | FromDiscord | <Yardanico> you need to convert |
00:42:20 | FromDiscord | <fenrave> yeah |
00:42:35 | FromDiscord | <fenrave> i think the example was made after the guy whose writing it was converting it for some reason |
00:42:40 | FromDiscord | <fenrave> or before |
00:42:53 | FromDiscord | <fenrave> i'm sure he would have ran his own example from time to time |
00:42:59 | * | neceve quit (Ping timeout: 256 seconds) |
00:43:12 | FromDiscord | <fenrave> oh |
00:43:19 | FromDiscord | <fenrave> no its my own system libraries |
00:47:58 | FromDiscord | <sOkam!> Oh, I just noticed this↵Is there an intended way to do imports with circular dependencies? https://media.discordapp.net/attachments/371759389889003532/925188289575673886/unknown.png |
00:50:28 | FromDiscord | <Elegantbeef> Layout your code so you import just before you need |
00:50:28 | FromDiscord | <Elegantbeef> If there is a tight cyclical dependency you're SOL |
00:53:07 | * | xet7 quit (Ping timeout: 250 seconds) |
00:55:19 | FromDiscord | <sOkam!> whats sol? |
00:55:36 | FromDiscord | <Elegantbeef> Shit outta luck |
00:56:06 | FromDiscord | <Elegantbeef> Or "sweet" if 4 swears scare you |
00:56:12 | FromDiscord | <Elegantbeef> if swears\ |
01:01:04 | FromDiscord | <sOkam!> How come this works... https://media.discordapp.net/attachments/371759389889003532/925191587535917116/unknown.png |
01:01:57 | FromDiscord | <sOkam!> But this doesn't? https://media.discordapp.net/attachments/371759389889003532/925191811557896222/unknown.png |
01:02:15 | FromDiscord | <sOkam!> Is it not the exact same thing, or am I really blind? 😔 |
01:02:48 | FromDiscord | <Elegantbeef> Where does `uiDir`/`envDir` come from in that example they're both 1 line |
01:03:41 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Where does `uiDir`/`envDir` come": not sure I understand |
01:03:58 | FromDiscord | <Elegantbeef> The code on the left side of the above examples are both 1 line module |
01:04:07 | FromDiscord | <Elegantbeef> So where does `uiDir` and `envDir` come from |
01:04:25 | FromDiscord | <sOkam!> The right side file is the same, the left side is included in both cases |
01:05:11 | FromDiscord | <sOkam!> uiDir and envDir are defined in the right file, the cfg one |
01:05:31 | FromDiscord | <Elegantbeef> Oh your're including |
01:05:53 | FromDiscord | <sOkam!> yeah, to avoid importing since it breaks dependencies |
01:06:06 | FromDiscord | <sOkam!> and they are just asset lists anyway, so its fine |
01:06:52 | FromDiscord | <sOkam!> Both included, both defined in the exact same way... but one breaks and the other seems fine? 🥴 |
01:07:54 | FromDiscord | <Elegantbeef> I could be wrong but this should be doable with imports |
01:08:52 | FromDiscord | <sOkam!> I got the cyclic dependancy issue before with imports |
01:11:06 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/925194111793909770/image.png |
01:11:07 | FromDiscord | <Elegantbeef> Works just fine for me |
01:12:19 | FromDiscord | <Shiba> Can tables store functions |
01:12:42 | FromDiscord | <Elegantbeef> Yes |
01:12:57 | FromDiscord | <Shiba> Oh so i can make objects |
01:12:57 | FromDiscord | <Elegantbeef> They have to be the homogenous so you may need an object variant |
01:13:30 | FromDiscord | <fenrave> How are functions in tables done exactly? In lua its pretty easy to add a function to table |
01:13:34 | FromDiscord | <Yardanico> In reply to @Shiba "Oh so i can": you don't need tables with functions for that |
01:13:39 | FromDiscord | <Yardanico> In reply to @fenrave "How are functions in": procedures are first-class in nim |
01:13:43 | FromDiscord | <Yardanico> you can pass them around and store them' |
01:13:45 | FromDiscord | <Yardanico> (edit) "them'" => "them" |
01:13:46 | FromDiscord | <fenrave> I mean procedures |
01:13:51 | FromDiscord | <Yardanico> so what I said |
01:13:54 | FromDiscord | <fenrave> oh |
01:13:56 | FromDiscord | <Yardanico> you just store them as any other type |
01:13:58 | FromDiscord | <fenrave> misinterpreted that |
01:13:59 | FromDiscord | <fenrave> i see |
01:14:07 | FromDiscord | <Elegantbeef> The only issue is they need to be homogenous |
01:14:18 | FromDiscord | <Elegantbeef> If they're not homogenous you need to box them using an object variant |
01:14:47 | FromDiscord | <Elegantbeef> Like you cannot store `proc(a: int)` and `proc()` in the same table without a box |
01:14:57 | FromDiscord | <Shiba> In reply to @Yardanico "you don't need tables": Why isn't easy to call every table's update function |
01:15:13 | FromDiscord | <Elegantbeef> Nim has objects |
01:15:14 | FromDiscord | <Shiba> (edit) "In reply to @Yardanico "you don't need tables": Why isn't ... easy" added "it" |
01:15:18 | FromDiscord | <Elegantbeef> We dont use tables to emulate actual logic |
01:15:44 | FromDiscord | <Yardanico> exactly |
01:15:50 | FromDiscord | <Yardanico> lua needs that because it doesn't have actual objects :) |
01:15:52 | FromDiscord | <fenrave> sent a code paste, see https://play.nim-lang.org/#ix=3JIt |
01:15:55 | FromDiscord | <fenrave> yeah |
01:16:06 | FromDiscord | <fenrave> mimicking objects is fun though |
01:16:18 | FromDiscord | <fenrave> (edit) "https://play.nim-lang.org/#ix=3JIt" => "https://play.nim-lang.org/#ix=3JIu" |
01:16:29 | FromDiscord | <fenrave> mimicry is the best kind of flattery |
01:16:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JIv |
01:16:58 | FromDiscord | <Elegantbeef> Or you use the OOP mechanism |
01:17:38 | FromDiscord | <Shiba> Iam trying to delete the concep of oop in my mind after 2 years of c# |
01:18:00 | FromDiscord | <Yardanico> in nim you can do most of traditional oop without methods |
01:18:03 | FromDiscord | <Yardanico> because we have UFCS (MCS) |
01:19:38 | FromDiscord | <Shiba> And can you like self.accesOtherVariables |
01:19:38 | FromDiscord | <fenrave> In reply to @Shiba "Iam trying to delete": Coming from lua its pretty easy to not think about them |
01:20:04 | FromDiscord | <sOkam!> In reply to @Elegantbeef "image.png": i tried the imports before, but they were at the beginning of the files↵when switching the words in those sshots to import, instead of include, they worked fine 🤷♂️ |
01:20:12 | FromDiscord | <Elegantbeef> Exactly |
01:20:39 | * | noeontheend joined #nim |
01:20:40 | FromDiscord | <sOkam!> sounds like magic, if you ask me |
01:21:51 | FromDiscord | <Elegantbeef> Nope just import order |
01:22:24 | FromDiscord | <Elegantbeef> you can order your imports to prevent cyclical imports |
01:23:06 | FromDiscord | <sOkam!> i see. definitely fancy, need to get a better grasp on it |
01:23:07 | FromDiscord | <Elegantbeef> When you do the import at the top the module importing it attempts to import itself so errors |
01:23:40 | FromDiscord | <sOkam!> how are files accessed? how's the order layed out? |
01:24:11 | FromDiscord | <Elegantbeef> First in first imported 😀 |
01:24:14 | FromDiscord | <sOkam!> In c/cpp I understood the compiler gets all imported files layed out all at once, to be read at once |
01:25:10 | FromDiscord | <sOkam!> In reply to @Elegantbeef "First in first imported": I see. Whats the difference between importing and including? |
01:25:19 | FromDiscord | <Elegantbeef> Include copies the contents |
01:25:23 | FromDiscord | <Elegantbeef> Import doesnt |
01:25:48 | FromDiscord | <sOkam!> Yeah, but like... what does import mean if the contents are not copied? |
01:26:06 | FromDiscord | <Elegantbeef> Only exported symbols are avaliable |
01:26:17 | FromDiscord | <fenrave> if i recall correctly, nim just imports what you actually use and strips out unused stuff for smaller binary sizes |
01:26:28 | FromDiscord | <Elegantbeef> Well it imports it all |
01:26:33 | FromDiscord | <Elegantbeef> But it doesnt compile it out |
01:26:39 | FromDiscord | <fenrave> yeah |
01:26:47 | FromDiscord | <sOkam!> ic |
01:27:05 | FromDiscord | <sOkam!> so its similar to including, but the code is selectively filtered? |
01:27:22 | FromDiscord | <Elegantbeef> Well include pastes the file at the call site |
01:27:32 | FromDiscord | <Elegantbeef> Import adds exported symbols to the symbol table for this module |
01:28:02 | FromDiscord | <Elegantbeef> So in the import example `someDir` isnt exported so you'll want to either `export modA` or `export someDir` |
01:28:28 | FromDiscord | <sOkam!> oh, so they are actually not added to the sequence |
01:28:49 | FromDiscord | <Elegantbeef> In the include method they're added to the symbol table of this module since they're declared there now |
01:28:50 | FromDiscord | <sOkam!> just referenced for when the code is called? |
01:28:54 | FromDiscord | <Elegantbeef> Include works like C's include |
01:29:00 | FromDiscord | <Elegantbeef> It pastes the file there |
01:29:21 | FromDiscord | <Elegantbeef> Import is a properly thought out way to make up code |
01:29:38 | FromDiscord | <Elegantbeef> Default to `import` and use `include` only when you need to |
01:29:43 | FromDiscord | <Elegantbeef> There isnt much reason to use include imo |
01:29:57 | FromDiscord | <sOkam!> kk |
01:39:04 | FromDiscord | <tandy> is nim suitable for real time programming?↵people seem to see garbage collector and run away..↵https://old.reddit.com/r/nim/comments/jc7zxk/hard_real_time_resource/ |
01:39:08 | FromDiscord | <Yardanico> it is |
01:39:16 | FromDiscord | <Yardanico> with --gc:arc |
01:41:31 | FromDiscord | <Yardanico> even refc has soft realtime capabilities |
02:12:43 | * | noeontheend quit (Quit: noeontheend) |
02:14:02 | * | noeontheend joined #nim |
02:16:26 | * | kayabaNerve joined #nim |
02:16:34 | FromDiscord | <sOkam!> Is this syntax wrong? 🤔 https://media.discordapp.net/attachments/371759389889003532/925210588504813648/unknown.png |
02:18:09 | FromDiscord | <Elegantbeef> Yes |
02:18:45 | FromDiscord | <Elegantbeef> Or i think so |
02:19:16 | FromDiscord | <Elegantbeef> Never mind that's right |
02:19:35 | FromDiscord | <sOkam!> Compiler not likey |
02:20:02 | FromDiscord | <Elegantbeef> Well the compiler has an error message which is helpful |
02:20:23 | FromDiscord | <sOkam!> Not much, tbh 😦 https://media.discordapp.net/attachments/371759389889003532/925211548761354260/unknown.png |
02:20:32 | FromDiscord | <Elegantbeef> That's very helpful |
02:20:38 | FromDiscord | <Elegantbeef> go to line 14 what do you do |
02:21:09 | FromDiscord | <sOkam!> https://media.discordapp.net/attachments/371759389889003532/925211737605681163/unknown.png |
02:21:44 | FromDiscord | <Elegantbeef> Ok so you dont export tiles from `envData` |
02:21:46 | FromDiscord | <Elegantbeef> We did it |
02:22:24 | FromDiscord | <sOkam!> oh nvm im dumb |
02:22:27 | FromDiscord | <Elegantbeef> so now go to `../env/data` and `export tiles` or throw `` on `tiles` |
02:22:39 | FromDiscord | <sOkam!> its not exporting, i just didnt add the tiles variable 🙈 |
02:22:43 | FromDiscord | <Elegantbeef> See error messages are helpful |
02:23:43 | FromDiscord | <sOkam!> Would be more helpful if it said: Hey! You totally forgot to add this variable, you dummy with goldfish memory who actually thought about doing it... and didnt↵🤷♂️ |
02:23:45 | FromDiscord | <sOkam!> 😄 |
02:24:07 | FromDiscord | <Elegantbeef> Eh Nim's semantic error messages are generally helpful |
02:24:22 | FromDiscord | <Elegantbeef> Nim's parsing error messages are a hit or a miss |
02:24:36 | FromDiscord | <sOkam!> whats the latter? |
02:24:47 | FromDiscord | <Elegantbeef> "Indentation error" |
02:26:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JIB |
04:11:10 | * | arkurious quit (Quit: Leaving) |
04:29:54 | * | rockcavera quit (Remote host closed the connection) |
05:27:17 | * | noeontheend quit (Ping timeout: 240 seconds) |
05:29:13 | * | drewr joined #nim |
07:42:00 | * | cheer joined #nim |
07:44:57 | * | drewr quit (Ping timeout: 240 seconds) |
08:29:24 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
08:32:20 | * | Lord_Nightmare joined #nim |
09:01:06 | FromDiscord | <Esther> Heya - I'm using vscode with the Nim extension and a nimble library that has some declarations hidden behind a 'when x:' thingo. How do I tell the autocomplete whatsit to define that 'x'? |
09:10:06 | FromDiscord | <Rika> You do that on the compile command, not in code |
09:14:39 | FromDiscord | <Elegantbeef> You make a config file and have `--define:yourDefine` |
09:14:52 | FromDiscord | <Elegantbeef> Sorry for rika's lying to you |
09:15:21 | FromDiscord | <Elegantbeef> @Esther\: ^ 😀 |
09:15:39 | FromDiscord | <Elegantbeef> `config.nims`in the root of your current file |
09:15:45 | FromDiscord | <Elegantbeef> current project\ |
09:17:11 | FromDiscord | <Esther> That seems to have done it, thank you! |
09:17:52 | FromDiscord | <Elegantbeef> No problem |
09:19:10 | FromDiscord | <Esther> Also, is there a language keyword index in the docs anywhere? I was trying to find what the 'when' keyword actually does in the docs but had a lot of trouble |
09:19:37 | FromDiscord | <Rika> In reply to @Elegantbeef "Sorry for rika's lying": It's still not in code, it's in configuration |
09:20:07 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#statements-and-expressions-when-statement |
09:23:45 | FromDiscord | <evoalg> In reply to @Esther "Also, is there a": If you know the word you're looking for, but you're having trouble finding it in the docs (and "nim keyword" isn't helping), then go to https://nim-lang.org/docs/theindex.html and search the page for your key word |
09:24:03 | FromDiscord | <Elegantbeef> That index doesnt have keywords |
09:24:07 | FromDiscord | <Elegantbeef> The manual has keywords |
09:24:11 | FromDiscord | <evoalg> ahhh |
09:24:25 | FromDiscord | <evoalg> in that case you've been lied to again Esther |
09:25:00 | FromDiscord | <Elegantbeef> the index does have a list of all builtin types |
09:25:16 | FromDiscord | <evoalg> gotcha ok |
09:25:42 | FromDiscord | <evoalg> beef is the fountain of truth 😉 |
09:25:45 | FromDiscord | <Elegantbeef> only cause all builtin types are implemented in system.nim |
09:26:05 | FromDiscord | <Elegantbeef> Nah i'm just an dumb asshole that's almost always active 😛 |
09:26:46 | FromDiscord | <evoalg> I like how you have exactly the same waking hours as me, even though I'm in New Zealand 🙂 |
09:27:28 | FromDiscord | <Rika> In reply to @evoalg "beef is the fountain": I mean he twists the truth very often as well |
09:27:31 | FromDiscord | <Elegantbeef> That says more about me than it should |
09:28:18 | FromDiscord | <Elegantbeef> Do i twist the truth or am i ignorant? |
09:28:37 | FromDiscord | <Rika> I never said it was intentional |
09:28:55 | FromDiscord | <Elegantbeef> Twisting the truth means i'd know i'm lying! |
09:29:31 | FromDiscord | <Rika> Sometimes you do you just forgot |
09:29:53 | FromDiscord | <Elegantbeef> Rika knows my mind better than I apparently |
09:30:07 | * | xet7 joined #nim |
09:30:22 | FromDiscord | <Rika> Of course I do I'm just a figment of your imagination after all |
09:30:35 | FromDiscord | <evoalg> Neal Asher (scifi writer) wrote of an ancient life form that humans called "dragon" who knew a lot but spoke in riddles ... maybe it's the same with beef |
09:30:37 | FromDiscord | <Elegantbeef> Would be cooler if you were just a pigment |
09:31:55 | FromDiscord | <Rika> Sorry, I'm colourblind |
09:32:53 | FromDiscord | <evoalg> figment or pigment, Rika would still be part of you beef? |
09:33:02 | FromDiscord | <Rika> Lewd |
09:34:02 | FromDiscord | <evoalg> if that part was a big part ... I meant really big, like 100%, then Rika would actually be beef |
09:34:17 | FromDiscord | <TryAngle> 😳 |
09:34:51 | FromDiscord | <evoalg> ok, ok ... I'll shut up |
09:35:13 | FromDiscord | <Rika> I didn't know you were this perverted evo |
09:35:35 | FromDiscord | <evoalg> When you're my age, you've seen it all |
09:36:03 | FromDiscord | <Elegantbeef> He's also a kiwi |
09:36:07 | FromDiscord | <Elegantbeef> So that doesnt help |
09:36:42 | FromDiscord | <evoalg> kiwi means I've not only seen it all |
09:39:36 | FromDiscord | <Solitude> NICE nim discussion |
09:39:47 | FromDiscord | <Elegantbeef> Thanks |
09:39:54 | * | xet7 quit (Remote host closed the connection) |
09:40:55 | * | xet7 joined #nim |
09:42:00 | FromDiscord | <Rika> You're welcome |
09:45:20 | FromDiscord | <Elegantbeef> So evo i do wonder are you working on any main project with Nim or still just learning stuffs? |
09:47:48 | FromDiscord | <Rika> Can't keep on just learning forever, to progress you should make something |
09:48:05 | FromDiscord | <valerga> i want to make something in nim called animal(s) |
09:48:12 | FromDiscord | <valerga> but no idea what yet lol |
09:48:23 | FromDiscord | <valerga> (it probably already exists) |
09:48:50 | FromDiscord | <Elegantbeef> I feel like `animals` is a good name of a rust like trait package |
09:49:04 | FromDiscord | <Rika> I can't believe you know things about rust beef |
09:49:08 | FromDiscord | <Rika> You've betrayed us |
09:49:23 | FromDiscord | <Elegantbeef> Hey i learn things about all the other system languages |
09:49:24 | FromDiscord | <evoalg> he was lying to us the whole time |
09:49:26 | FromDiscord | <Elegantbeef> They have interesting things |
09:49:52 | FromDiscord | <Rika> I'm joking, I kinda like the idea of traits |
09:50:15 | FromDiscord | <Elegantbeef> Yea i seen the cone language today and it has them |
09:50:19 | FromDiscord | <Rika> It sounds like a good extension for Nim's types |
09:50:58 | FromDiscord | <Elegantbeef> They're a bit like concepts plus |
09:51:11 | FromDiscord | <Rika> I often think Nim APIs need some (but not a lot of) standardisation |
09:52:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JJB |
09:52:06 | FromDiscord | <Elegantbeef> It's a bit ehh about a 1\:1 API |
09:52:06 | FromDiscord | <evoalg> but yea I should start a project, as it's the best way to learn ... I'll start one. BTW does `nim secret` still work in 1.6.2? |
09:52:24 | FromDiscord | <Elegantbeef> Yea i totally agree there needs to be standardization |
09:52:33 | FromDiscord | <Elegantbeef> Concepts should be used |
09:52:43 | FromDiscord | <Rika> In reply to @evoalg "but yea I should": Probably |
09:52:52 | FromDiscord | <Elegantbeef> It seems it works |
09:52:55 | FromDiscord | <Rika> In reply to @Elegantbeef "Concepts should be used": Concepts need to be improved |
09:52:58 | FromDiscord | <Rika> Then it can be used |
09:53:11 | FromDiscord | <Rika> Can y'all in matrix see replies now |
09:53:12 | FromDiscord | <Rika> Btw |
09:53:15 | FromDiscord | <evoalg> but it's my brew installation that broke nim secret |
09:53:17 | FromDiscord | <Elegantbeef> Yea |
09:53:24 | FromDiscord | <Rika> Ok |
09:53:32 | FromDiscord | <Elegantbeef> what needs to be done to concepts? |
09:53:36 | FromDiscord | <Rika> In reply to @evoalg "but it's my brew": Imagine using macOS smh |
09:53:37 | FromDiscord | <Elegantbeef> There are a few bugs ofc |
09:53:38 | FromDiscord | <Rika> I'm joking |
09:53:49 | FromDiscord | <Rika> In reply to @Elegantbeef "There are a few": Well yeah its pretty much just bugs |
09:53:52 | FromDiscord | <Rika> Then the field thing |
09:53:58 | FromDiscord | <Rika> Though AFAIK it's possible |
09:54:07 | FromDiscord | <Elegantbeef> the field thing? |
09:54:12 | FromDiscord | <Elegantbeef> Are we talking about the newconcepts? |
09:54:19 | FromDiscord | <Rika> Ah yeah |
09:54:21 | FromDiscord | <Rika> I thought we were |
09:54:37 | FromDiscord | <valerga> I've been wondering. Would this proposal make nim harder to learn, remove some of the flexibility people seem to like? https://github.com/nim-lang/RFCs/issues/380 |
09:54:43 | FromDiscord | <Elegantbeef> I was talking in general |
09:54:51 | FromDiscord | <Elegantbeef> Both have their benefits and their detriments |
09:55:00 | FromDiscord | <Elegantbeef> It'd make it easier |
09:55:22 | FromDiscord | <Elegantbeef> The issue with that is one it's not done at the type scope imo |
09:55:25 | FromDiscord | <Elegantbeef> Just like destructors and stuff |
09:55:37 | FromDiscord | <Elegantbeef> They're done presently in an unintuitive way |
09:56:08 | FromDiscord | <Elegantbeef> Regardless of the concept bugs there are many things in the stdlib and other libraries that should use them |
09:56:25 | FromDiscord | <Rika> In reply to @Elegantbeef "Regardless of the concept": Yeah |
09:56:38 | FromDiscord | <Elegantbeef> There's also an issue with not being able to extend modules after definition |
09:57:14 | FromDiscord | <Rika> In reply to @valerga "I've been wondering. Would": More thought would need to be put into it |
09:57:18 | FromDiscord | <Rika> Hard to tell |
09:57:39 | FromDiscord | <Elegantbeef> I do not like the idea of having types operations outside of the type definition |
09:57:43 | FromDiscord | <Elegantbeef> But regardless |
09:58:02 | FromDiscord | <Elegantbeef> Type bound operations arent really a bad thing, they just need to be made clear imo |
09:58:28 | FromDiscord | <valerga> would it introduce new keywords to learn about or would most of it be automatic? |
09:58:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JJC |
09:58:58 | FromDiscord | <Rika> In reply to @Elegantbeef "for instance a destructor": Cursed |
09:59:08 | FromDiscord | <Elegantbeef> I think araq's idea is to bind the functions declared in a module with the type by the first parameter |
09:59:54 | FromDiscord | <Elegantbeef> More cursed than manually declaring a proc in the same definition as the type is declared with a specific definition? |
10:00:00 | FromDiscord | <Rika> In reply to @Elegantbeef "I think araq's idea": I think it's good, but I cannot tell without actually trying it tbh |
10:00:02 | FromDiscord | <Elegantbeef> same module definition\ |
10:00:12 | FromDiscord | <Rika> In reply to @Elegantbeef "More cursed than manually": No just the syntax |
10:00:13 | FromDiscord | <Rika> Lol |
10:00:30 | FromDiscord | <Elegantbeef> Well it could be `destroy:` but that interferes with a field named destroy |
10:00:49 | FromDiscord | <Elegantbeef> so i guess we could make it so accquoted `destroy` is field and otherwise is a destructor |
10:00:51 | FromDiscord | <Rika> The more I think about it the more I think it is a good idea tbh |
10:01:17 | FromDiscord | <Elegantbeef> I do also think this post is something else that is needed https://forum.nim-lang.org/t/8658#56393 |
10:05:57 | FromDiscord | <Elegantbeef> That feature mixed with concepts makes life so much simpler |
10:06:30 | FromDiscord | <Elegantbeef> You want to use code but dont want to use a specific type you just replace it with your own that fits all the required procs |
10:12:17 | FromDiscord | <hmmm> yo what can I use that is similar to .lines but works with variables and not files |
10:12:43 | FromDiscord | <evoalg> variables like a seq ? |
10:12:49 | FromDiscord | <evoalg> you mean? |
10:12:56 | FromDiscord | <hmmm> more like a blob of text |
10:13:05 | FromDiscord | <hmmm> like what you get after you do readfile |
10:13:11 | FromDiscord | <evoalg> ahh |
10:13:21 | FromDiscord | <evoalg> then it's already in memory |
10:13:25 | FromDiscord | <hmmm> yep |
10:13:33 | FromDiscord | <hmmm> I want each line |
10:13:37 | FromDiscord | <Solitude> splitLines |
10:13:44 | FromDiscord | <hmmm> oh |
10:13:52 | FromDiscord | <hmmm> I'll try |
10:13:59 | FromDiscord | <Solitude> be careful |
10:14:03 | FromDiscord | <hmmm> what |
10:14:04 | FromDiscord | <hmmm> why |
10:17:06 | FromDiscord | <evoalg> but ... but this wont iterate line by line like `.lines` does for a file ... it will create a whole new seq right? ... https://play.nim-lang.org/#ix=3JJH |
10:17:29 | FromDiscord | <Elegantbeef> Look at evo pointing out the issue |
10:17:43 | FromDiscord | <hmmm> well splitlines worked lol |
10:17:57 | FromDiscord | <Elegantbeef> It'll work but if it's a big file you're make your ram unhappy |
10:18:32 | FromDiscord | <hmmm> oh no it's for a micro sub nano service utility that will get used on like 4/5 lines of text |
10:19:00 | FromDiscord | <evoalg> ahhh ... cos you said like .lines (which doesn't copy all of the file into mem) |
10:19:36 | FromDiscord | <evoalg> In reply to @Elegantbeef "Look at evo pointing": proud of me? 😄 😄 ... but I'm not sure how I'd create on iterator to solve the problem 😦 |
10:19:51 | FromDiscord | <Elegantbeef> A while loop |
10:20:42 | FromDiscord | <evoalg> and go through each char until I get a '\n' where I'd yield? |
10:21:29 | FromDiscord | <Rika> Pretty much |
10:21:54 | FromDiscord | <Elegantbeef> There you go |
10:21:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JJK |
10:22:10 | FromDiscord | <Elegantbeef> Can do a `for x in y` |
10:22:17 | FromDiscord | <Elegantbeef> rather `for x in s` |
10:22:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JJL |
10:23:34 | FromDiscord | <Elegantbeef> There is also a no alloc method that doesnt play as nice using `openArray` |
10:24:43 | FromDiscord | <Elegantbeef> Ah doesnt work without views i take it back |
10:24:47 | FromDiscord | <evoalg> I was half way though typing something up when you did two versions already! |
10:25:11 | FromDiscord | <evoalg> ... I lie ... quarter of the way through... |
10:25:13 | FromDiscord | <Elegantbeef> shit i spoiled the fun |
10:26:23 | FromDiscord | <evoalg> it's fun watched you go at bot speeds |
10:27:23 | FromDiscord | <evoalg> preallocates 64 bytes ... to get a head start? |
10:28:42 | FromDiscord | <Elegantbeef> Well moreso to prevent allocations if possible |
10:28:59 | FromDiscord | <evoalg> why did you chose 64 though? |
10:29:35 | FromDiscord | <hmmm> woah beefy it worked |
10:29:38 | FromDiscord | <Elegantbeef> A relatively large base 2 number |
10:30:01 | FromDiscord | <hmmm> respect4beefy = respect4beefy 2 |
10:30:07 | FromDiscord | <evoalg> base 2 numbers ... so allocations are more efficient in base 2 chunks? |
10:30:43 | FromDiscord | <Elegantbeef> Well if we did 65 bytes we'd take up a whole cacheline and an extra byte \:d |
10:30:55 | FromDiscord | <Elegantbeef> I dont think they're more efficient |
10:30:57 | FromDiscord | <Elegantbeef> I could be wrong |
10:31:09 | FromDiscord | <Elegantbeef> Any size works there i just chose 64 |
10:31:11 | FromDiscord | <hmmm> make a beefytools repo, I wouldn't want to miss something |
10:31:32 | FromDiscord | <Elegantbeef> I already have one https://github.com/beef331/slicerator 😛 |
10:32:01 | FromDiscord | <Elegantbeef> should i make a `chunkUntil` iterator 😀 |
10:32:02 | FromDiscord | <evoalg> maybe iterating over text should be part of slicerator? |
10:32:14 | FromDiscord | <evoalg> oh ... what you said 😉 |
10:32:36 | FromDiscord | <Solitude> In reply to @evoalg "but ... but this": https://nim-lang.org/docs/strutils.html#splitLines.i,string |
10:32:59 | FromDiscord | <Elegantbeef> Oh right that exists |
10:33:04 | FromDiscord | <Solitude> you dumbass |
10:33:05 | FromDiscord | <evoalg> ohhhh! |
10:33:25 | FromDiscord | <Elegantbeef> Now now you love me↵(@Solitude) |
10:33:28 | FromDiscord | <evoalg> In reply to @Solitude "https://nim-lang.org/docs/strutils.html#splitLines.": you know the docs so well! |
10:34:32 | FromDiscord | <Elegantbeef> Though this doesnt reuse the string so probably is less memory friendly |
10:34:57 | FromDiscord | <evoalg> still, slicerator should contain everything that someone want's to iterator over? |
10:35:18 | FromDiscord | <Elegantbeef> Yea like iterators.... 😛 |
10:35:38 | FromDiscord | <Elegantbeef> I really hate that we cant chain iterators |
10:36:09 | FromDiscord | <evoalg> that's because you haven't released chain in slicerator yet? |
10:36:23 | FromDiscord | <Elegantbeef> No cause you cannot chain iterators |
10:37:20 | FromDiscord | <Elegantbeef> chain in slicerator is really just hack |
10:37:33 | FromDiscord | <Elegantbeef> All operations are defined by yours truly and require being written in there |
10:38:04 | FromDiscord | <Elegantbeef> Though i think map/filter are all one really needs, but i could be wrong |
10:39:03 | FromDiscord | <Elegantbeef> Are there any other operations that one would want to apply to the output of an iterator is my question |
10:40:42 | FromDiscord | <evoalg> in one my the aoc's I did:↵ `var grid = readFile("inputs/11.txt").strip.splitlines.mapIt(toSeq(it).mapIt(ord(it) - ord('0')))` ↵... not proud of it, but it worked |
10:41:17 | FromDiscord | <evoalg> nested mapIt's |
10:42:34 | FromDiscord | <Elegantbeef> Yea i mean it'd be turned into a collect wrapping an odd statement |
10:43:12 | FromDiscord | <Elegantbeef> would be like `for x in chain lines("inputs/11.txt").map(toSeq(x)` followed by another iteration |
10:43:57 | FromDiscord | <Elegantbeef> Afterall the syntax is like ` for i, x in chain a.map(parseInt(x)).filter(x > 5e4.int).map(x 100):` |
10:44:33 | FromDiscord | <Elegantbeef> This only really makes sense for when you''re using the output in a for loop i guess |
10:44:56 | FromDiscord | <evoalg> true it's a bad eg |
10:45:11 | FromDiscord | <Elegantbeef> I mean it's a real example |
10:45:31 | FromDiscord | <evoalg> but still ... does strip allocate? |
10:45:37 | FromDiscord | <Elegantbeef> Yes |
10:46:24 | FromDiscord | <Elegantbeef> My version shouldnt allocate unless you tell it using `map` |
10:46:32 | FromDiscord | <Elegantbeef> But anyway i need to sleep getting really late here |
10:47:09 | FromDiscord | <evoalg> nites! |
11:25:17 | * | neurocyte0132889 joined #nim |
11:25:17 | * | neurocyte0132889 quit (Changing host) |
11:25:17 | * | neurocyte0132889 joined #nim |
11:42:47 | FromDiscord | <sOkam!> Why is the `JsonNode` acyclic?↵Or, more broadly, what's the practical use of making something acyclic? |
11:46:20 | FromDiscord | <Rika> You can use ARC instead of ORC |
11:47:03 | FromDiscord | <haxscramper> I think even ORC does codegen a little differently for acyclic types |
11:59:09 | FromDiscord | <fumamatar> sent a code paste, see https://play.nim-lang.org/#ix=3JK8 |
11:59:28 | FromDiscord | <fumamatar> (edit) "https://play.nim-lang.org/#ix=3JK8" => "https://play.nim-lang.org/#ix=3JK9" |
12:00:00 | FromDiscord | <Rika> You can dereference a ref with [{ |
12:00:01 | FromDiscord | <Rika> Ugh |
12:00:03 | FromDiscord | <Rika> [] |
12:01:52 | FromDiscord | <fumamatar> Yes, but memcpy needs a ref or a ptr so I can not just dereference it when i safe the byte buffer |
12:02:18 | FromDiscord | <fumamatar> ` copyMem(buf, addr packet.header, sizeof(UDP_Header))` |
12:04:27 | FromDiscord | <fumamatar> maybe i need to serialize the header itself into bytes as well .. |
12:15:10 | FromDiscord | <fumamatar> so apparently i want to turn a ref into a ptr..? |
12:15:32 | FromDiscord | <Rika> You don’t need to |
12:15:41 | FromDiscord | <Rika> The ref is a “ptr” |
12:17:14 | FromDiscord | <fumamatar> I thought so. But then I dont understand how the payload (which is a ptr) is resolved to the actual bytes, while the header (which is a ref) is not and writes the address instead of the bytes to my buffer |
12:19:27 | FromDiscord | <sOkam!> I'm trying to understand the structure of what `parseJson( .. )` is doing↵How can I output the `JsonNode` data that from that function into a text file for reading?↵I tried writeFile, but it didn't like it not being a string https://media.discordapp.net/attachments/371759389889003532/925362306521657344/unknown.png |
12:22:21 | FromDiscord | <sOkam!> ~deleted~↵nvm, I solved it with bash `>` 🙂 |
12:22:32 | FromDiscord | <Rika> You’re getting the address of the ref, think about what getting the address of a pointer is 😛 |
12:22:32 | FromDiscord | <sOkam!> (edit) "~deleted~↵nvm," => "~~deleted~~↵nvm," |
12:22:42 | FromDiscord | <Rika> A pointer to a pointer, so not what you want |
12:23:12 | FromDiscord | <fumamatar> oh yea right |
12:24:17 | NimEventer | New Nimble package! py2nim - Py2Nim is a tool to translate Python code to Nim. The output is human-readable Nim code, meant to be tweaked by hand after the translation process., see https://github.com/Niminem/Py2Nim |
12:24:26 | FromDiscord | <fumamatar> sent a code paste, see https://play.nim-lang.org/#ix=3JKh |
12:32:01 | FromDiscord | <Rika> You could probably cast to a `pointer` “safely” in this case |
12:32:43 | * | beshr joined #nim |
12:32:47 | * | neceve joined #nim |
12:36:33 | FromDiscord | <fumamatar> That is possible, but leads to the same output as using addr |
12:36:43 | FromDiscord | <fumamatar> somehow |
12:37:04 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3JKi |
12:38:33 | FromDiscord | <fumamatar> I think A is an array, and B is a set? |
12:39:58 | FromDiscord | <Rika> Yes |
12:40:48 | FromDiscord | <sOkam!> is it the same if the contents of 1 and 2 are strings? |
12:44:45 | FromDiscord | <fumamatar> Not really, they are different types with different characteristics |
12:45:04 | * | rockcavera joined #nim |
12:45:04 | * | rockcavera quit (Changing host) |
12:45:04 | * | rockcavera joined #nim |
12:45:26 | FromDiscord | <sOkam!> Yeah, thingB is an error if 1or2 are strings https://media.discordapp.net/attachments/371759389889003532/925368846347554836/unknown.png |
12:46:52 | FromDiscord | <sOkam!> In that case, what's the difference between `[]` and `{}` in the context of a `JsonNode`? |
12:48:10 | FromDiscord | <sOkam!> Is {} just a hierarchy separator, and [] an array syntax? 🤔 |
12:51:56 | FromDiscord | <fumamatar> im not familiar with the Json library, can you share some code? |
12:57:06 | FromDiscord | <Rika> {} is afaik like many [] |
12:57:23 | FromDiscord | <Rika> So [][][] -> {,,} |
13:00:03 | * | neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat) |
13:01:42 | * | neurocyte0132889 joined #nim |
13:01:42 | * | neurocyte0132889 quit (Changing host) |
13:01:42 | * | neurocyte0132889 joined #nim |
13:02:22 | FromDiscord | <sOkam!> In reply to @fumamatar "im not familiar with": about what exactly? a json file, or do you mean something else? |
13:02:52 | FromDiscord | <fumamatar> i mean nim's JsonNode class |
13:04:47 | FromDiscord | <sOkam!> In reply to @fumamatar "i mean nim's JsonNode": https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/json.nim#L185 |
13:08:04 | FromDiscord | <sOkam!> Found this, which I think explains it https://media.discordapp.net/attachments/371759389889003532/925374540345929759/unknown.png |
13:09:48 | FromDiscord | <Rika> Not that |
13:10:10 | FromDiscord | <Rika> https://nim-lang.org/docs/json.html#overview-handling-optional-keys |
13:10:13 | FromDiscord | <Rika> Seems to be this |
13:10:46 | * | neceve quit (Read error: Connection reset by peer) |
13:11:32 | FromDiscord | <Rika> Additionally there is a var arg version of {} but none for [] (because {} is get or default and the latter is just get) |
13:14:31 | FromDiscord | <sOkam!> Oh, I should definitely start by reading that page 🙈 ↵Me dummy 🌱 |
13:16:49 | FromDiscord | <Rika> Lol you’ll get the habit of it soon |
13:47:02 | FromDiscord | <retkid> how does -d:danger deal with pointers? |
13:47:41 | FromDiscord | <retkid> i keep getting out of memory even though i calculate the size of the pointers correctly |
13:48:05 | FromDiscord | <retkid> unless every entry in an ordered list is greater than 16 bytes per entry |
13:48:06 | FromDiscord | <Solitude> it doesnt do anything with pointers |
13:48:18 | FromDiscord | <retkid> so what does -d:release do with pointers? |
13:48:26 | FromDiscord | <Solitude> nothing |
13:48:30 | FromDiscord | <retkid> that is untru |
13:48:31 | FromDiscord | <retkid> (edit) "untru" => "untrue" |
13:48:35 | FromDiscord | <Solitude> okay |
13:49:26 | FromDiscord | <retkid> unless you're on the technicality "Well it doesn't TECHNICALLY do anything to pointers but actually it just changes thew way garbage collection is done which affects pointers" |
13:49:57 | FromDiscord | <retkid> but, whenever i compile with -d:danger it does the out of memory defect eventually |
13:50:50 | FromDiscord | <retkid> it has something to do with the size of the pointer, however, it shouldn't |
13:51:16 | FromDiscord | <retkid> it doesnt matter what size i enter when i dont compile with -d:danger but when i do, it does |
13:51:45 | FromDiscord | <retkid> so i assume performance and takes cycles to save me and change the size, when danger does not |
13:58:25 | * | rockcavera quit (Remote host closed the connection) |
14:05:15 | * | badsektor joined #nim |
14:38:02 | * | arkurious joined #nim |
14:45:22 | FromDiscord | <planetis> does status have any library for string manipulation ? |
14:45:29 | FromDiscord | <planetis> a better strutils for example |
15:05:22 | FromDiscord | <Shiba> so how do i tell nim to noy use stdlib_system.nim |
15:05:29 | FromDiscord | <Shiba> (edit) "noy" => "not" |
15:05:47 | * | xet7 quit (Quit: Leaving) |
15:23:38 | * | xet7 joined #nim |
15:34:39 | FromDiscord | <Solitude> In reply to @retkid "unless you're on the": sorry, telepathy machine broke |
15:40:03 | FromDiscord | <konsumlamm> In reply to @Shiba "so how do i": `import pkg/system`? |
15:40:25 | FromDiscord | <konsumlamm> or just don't call your module `system` |
15:48:26 | FromDiscord | <Shiba> In reply to @konsumlamm "or just don't call": i didn't |
15:48:51 | FromDiscord | <Yardanico> In reply to @Shiba "so how do i": You don't |
15:49:02 | FromDiscord | <Yardanico> system is always explicitly imported by all Nim modules |
15:49:12 | FromDiscord | <Yardanico> Also you probably meant stdlib_system.c |
15:49:22 | FromDiscord | <Yardanico> because there's no .nim with that name |
15:53:54 | FromDiscord | <sOkam!> If I want to store something in an object like `classSizes.size.NAME`, expecting that call to output a value... is there a better way to do it than Tables? |
16:00:48 | FromDiscord | <Shiba> why it's says 10719 lines of code compiled , that aloot ,even my .nim fille is empty |
16:01:09 | * | vicecea joined #nim |
16:01:36 | FromDiscord | <Shiba> like i know there are necessary libaries for compiling but 10k is ... |
16:01:53 | FromDiscord | <Shiba> (edit) "fille" => "file" |
16:02:53 | FromDiscord | <Solitude> because it processed 10k lines of code. is that a problem? |
16:03:37 | FromDiscord | <Solitude> its nim runtime thats going to be included in every program |
16:04:28 | vicecea | hi, I'm wondering what would be the simplest way to do the following: I'm looking for a template/macro, e.g. with an identifier of `vecho`, which can be called passing another identifier, e.g. `vecho(my_variable)` and which will effectively do `echo "my_variable: " & my_variable` - can this be done with a template or would I need a macro for that? - thanks for pointers |
16:05:40 | FromDiscord | <Solitude> you would need a macro to extract identifier's name, pretty sure |
16:06:15 | vicecea | Solitude: thanks! I'll look into macros then |
16:08:30 | FromDiscord | <geekrelief> In reply to @vicecea "<@104136074569211904>: thanks! I'll look": https://play.nim-lang.org/#ix=3JMw |
16:09:35 | vicecea | geekrelief: beautiful! thank you! |
16:09:45 | FromDiscord | <Patitotective> I'm new to _Nim_ and I'm looking for a page with all `array` procedures. Is there an API Reference for _Nim_?↵Thanks 🙃 |
16:10:26 | FromDiscord | <Solitude> In reply to @Patitotective "I'm new to _Nim_": https://nim-lang.org/docs/theindex.html |
16:10:37 | FromDiscord | <Solitude> search for array and openArray |
16:13:10 | FromDiscord | <Patitotective> is there a `count` procedure for arrays? |
16:16:21 | FromDiscord | <Patitotective> nvm |
16:20:32 | * | xet7 quit (Ping timeout: 240 seconds) |
16:22:26 | FromDiscord | <Hamid_Bluri> In reply to @Patitotective "is there a `count`": there is a count `proc` and a `countIt` template in `std/sequtils`↵https://nim-lang.org/docs/sequtils.html#countIt.t%2Cuntyped%2Cuntyped↵↵but I don't know what you want exacly |
16:27:11 | FromDiscord | <Patitotective> In reply to @hamidb80 "there is a count": `count` works 🙃 thanks |
16:35:17 | FromDiscord | <Patitotective> can i delete a char at a specific index in a string? |
16:38:48 | * | jjido joined #nim |
16:42:25 | * | xet7 joined #nim |
16:45:04 | FromDiscord | <Solitude> In reply to @Patitotective "can i delete a": https://nim-lang.org/docs/strutils.html#delete%2Cstring%2CSlice%5Bint%5D we have this |
16:45:33 | * | noeontheend joined #nim |
16:45:48 | * | xet7 quit (Client Quit) |
16:46:53 | * | xet7 joined #nim |
16:49:22 | * | rockcavera joined #nim |
16:49:22 | * | rockcavera quit (Changing host) |
16:49:22 | * | rockcavera joined #nim |
16:55:34 | FromDiscord | <Shiba> In reply to @Yardanico "Also you probably meant": https://media.discordapp.net/attachments/371759389889003532/925431796462673990/Capture.PNG |
16:56:06 | FromDiscord | <Yardanico> it changes the name, in reality it's named system.nim |
16:56:25 | FromDiscord | <Yardanico> And again, this is required, it's just that Nim explicitly lists it |
16:57:18 | FromDiscord | <Shiba> i saw that it's doesnt show in other nim tetorals when they compile |
16:57:38 | FromDiscord | <Shiba> (edit) "doesnt" => "does not" |
16:57:46 | FromDiscord | <Shiba> (edit) "tetorals" => "tetorials" |
16:57:56 | FromDiscord | <Yardanico> maybe because they're older |
16:58:04 | FromDiscord | <Shiba> and there compile line is under 8000 |
16:58:07 | FromDiscord | <Yardanico> this is completely normal, why are you so concerned about it? |
16:58:11 | FromDiscord | <Shiba> (edit) "line" => "lines" |
16:58:25 | FromDiscord | <Yardanico> In reply to @Shiba "and there compile lines": Nim grows with time, again, why are you so concerned with this? |
16:58:32 | FromDiscord | <Shiba> trying iam trying to find the speed the process |
16:58:37 | FromDiscord | <Solitude> In reply to @Shiba "i saw that it's": it doesnt show because it doesnt get recompiled |
16:58:47 | FromDiscord | <Shiba> (edit) removed "find the" |
16:59:12 | FromDiscord | <Yardanico> In reply to @Shiba "trying iam trying to": That won't help much |
16:59:24 | FromDiscord | <Yardanico> We already explained all possible ways to speed up compilation to you |
17:01:02 | NimEventer | New thread by Vitreo12: Bug with peekableOutputStream?, see https://forum.nim-lang.org/t/8749 |
17:03:38 | FromDiscord | <Yardanico> You just have to accept the fact that with most compiled languages you have compilation and runtime as separate parts, and compile time is important, but less important than runtime performance |
17:04:23 | FromDiscord | <Yardanico> In interpreted languages there's no full separate compilation process - the interpreter might parse code into bytecode, but that's about it, then the interpreter just runs the bytecode |
17:05:08 | FromDiscord | <Rika> An empty C program also has a runtime that it links to |
17:06:30 | FromDiscord | <Yardanico> Also, with compiled languages you don't need to recompile as often because most compiled languages are statically typed, so that already prevents a lot of time spent debugging interpreted programs (I know that some interpreted languages are statically typed, but most of them aren't) |
17:06:44 | FromDiscord | <Yardanico> For basic error checking most editors already have Nim plugins that do that for you |
17:07:21 | FromDiscord | <Yardanico> You can also use "nim check" from the command line manually to check if you Nim file has any errors |
17:07:37 | FromDiscord | <Shiba> how i disbale the embedded debuger |
17:08:02 | FromDiscord | <Yardanico> it's not enabled |
17:08:41 | FromDiscord | <Yardanico> are you just reading random articles about Nim trying to disable everything? As I said, we already recommended a lot of ways you can improve compile times, but there's still a limit to what you can so to speed up compilation |
17:09:26 | FromDiscord | <Shiba> 😢 |
17:09:40 | FromDiscord | <sOkam!> Is Niminem, the creator of Py2nim, in here? |
17:10:52 | FromDiscord | <Shiba> In reply to @Yardanico "are you just reading": No? https://media.discordapp.net/attachments/371759389889003532/925435645617381446/Capture.PNG |
17:11:07 | FromDiscord | <Yardanico> it's disabled by default |
17:11:12 | FromDiscord | <Shiba> ah ok |
17:11:18 | FromDiscord | <Yardanico> Stop reading outdated info PLEASE |
17:11:34 | FromDiscord | <Shiba> it's not me the guide is outdated |
17:11:42 | FromDiscord | <Yardanico> there's no magical switch that'll make your code compile 10x faster |
17:12:26 | FromDiscord | <Shiba> i will try to be patient |
17:14:38 | FromDiscord | <Yardanico> really your best bet is to buy an SSD, it can lead to a faster compilation speed without you needing to change the CPU/mobo |
17:15:02 | FromDiscord | <Yardanico> HDDs are slow, that's a fact, especially for development because there's a lot of files being read and written |
17:15:15 | nrds | <Prestige99> Where was that image from btw @Shiba? |
17:15:30 | FromDiscord | <Yardanico> If you have enough RAM you can try compiling in /tmp assuming it's tmpfs |
17:15:51 | FromDiscord | <Shiba> In reply to @nrds "<Prestige> Where was that": the official nim compile guide |
17:15:54 | FromDiscord | <Yardanico> In reply to @Shiba "No?": Also yeah, forgot to mention |
17:16:04 | FromDiscord | <Shiba> (edit) "compile" => "compiler" |
17:16:10 | FromDiscord | <Yardanico> As I've said before most compiled languages have two separate stages |
17:16:18 | FromDiscord | <Shiba> In reply to @Yardanico "If you have enough": HOW |
17:16:21 | FromDiscord | <Yardanico> When you compile the program, and when you run it |
17:16:39 | FromDiscord | <Yardanico> In reply to @Shiba "No?": This advice was for reducing runtime of the program |
17:16:44 | FromDiscord | <Yardanico> Not compilation time |
17:17:23 | nrds | <Prestige99> https://nim-lang.org/docs/nimc.html#optimizing-for-nim interesting |
17:17:54 | FromDiscord | <Yardanico> In reply to @Shiba "HOW": copy your code to some folder in /tmp, set the nimcache so it's also some folder in tmp, and maybe even copy the nim distribution to tmp and use it from there if you have enough RAM |
17:18:08 | FromDiscord | <Yardanico> But an easier way is to just buy an ssd |
17:18:49 | FromDiscord | <Yardanico> small capacity SSDs are really really cheap nowadays, and 60GB will be more than enough for typical programming tasks |
17:19:10 | nrds | <Prestige99> Going from HHD -> SSD was such a big difference in general for me. Should've done it much earlier |
17:19:15 | nrds | <Prestige99> HDD* |
17:19:48 | FromDiscord | <Shiba> In reply to @Yardanico "copy your code to": does it's get erased after i turn off my laptop |
17:19:53 | FromDiscord | <Yardanico> yes |
17:20:16 | FromDiscord | <Yardanico> that's why this is a big hack and you'll constantly need to copy your work back to the hdd to save it |
17:28:13 | FromDiscord | <0ffh> sent a long message, see http://ix.io/3JNX |
17:28:24 | FromDiscord | <0ffh> (edit) "http://ix.io/3JNX" => "http://ix.io/3JNY" |
17:28:42 | FromDiscord | <0ffh> (edit) "long message," => "code paste," | "https://paste.rs/lFu" => "https://play.nim-lang.org/#ix=3JNZ" |
17:29:52 | FromDiscord | <haxscramper> It fails with `hash()` error? |
17:29:58 | FromDiscord | <haxscramper> Missing overload for `hash` or `==`? |
17:30:20 | FromDiscord | <haxscramper> For custom types you need to implement a hash and equality compare function so you can use them in tables |
17:32:27 | FromDiscord | <0ffh> Good idea, but that's not it.↵I get hints about .sideEffect [] and raiseKeyError but I can't interpret them. |
17:34:00 | FromDiscord | <0ffh> Maybe table access on custom type have any side effects that are not present for string tables? |
17:34:08 | FromDiscord | <0ffh> (edit) "have" => "has" |
17:34:17 | FromDiscord | <0ffh> (edit) "type" => "types" |
17:35:22 | FromDiscord | <Rika> Can you give the full error in a paste |
17:36:02 | FromDiscord | <0ffh> sent a code paste, see https://play.nim-lang.org/#ix=3JO9 |
17:42:50 | FromDiscord | <Yardanico> In reply to @0ffh "Why does this work": That's because you define an anonymous func for sorting, and [] has a side effect |
17:42:57 | FromDiscord | <Yardanico> Try to rename func to proc here |
17:43:17 | FromDiscord | <Yardanico> func in Nim is a proc with {.noSideEffect.} |
17:44:11 | FromDiscord | <0ffh> In reply to @Yardanico "That's because you define": That's it, how stupid of me, it works now! |
17:44:15 | FromDiscord | <0ffh> Thank you! |
17:44:28 | FromDiscord | <Solitude> In reply to @Yardanico "That's because you define": what |
17:44:43 | FromDiscord | <Yardanico> In reply to @0ffh "Yeah, but it's loooong": @Solitude |
17:45:05 | FromDiscord | <Yardanico> His [] calls raiseKeyError that accesses a global variable |
17:45:11 | FromDiscord | <Yardanico> (might call) |
17:45:23 | FromDiscord | <Yardanico> (edit) "(might" => "(might" |
17:45:35 | FromDiscord | <Solitude> i grepped the stdlib and i dont see that variable |
17:45:55 | FromDiscord | <Yardanico> it's in his code |
17:45:57 | FromDiscord | <Yardanico> Not stdlib |
17:46:38 | FromDiscord | <Solitude> your `$` is not pure i guess |
17:46:53 | FromDiscord | <Rika> In reply to @0ffh "Why does this work": Here says func |
17:47:26 | FromDiscord | <Rika> I'm telling solitude btw |
17:47:45 | FromDiscord | <0ffh> sent a code paste, see https://play.nim-lang.org/#ix=3JOh |
17:47:57 | FromDiscord | <Solitude> yuck |
17:48:01 | FromDiscord | <Rika> Is it not a cost? |
17:48:04 | FromDiscord | <Rika> Const |
17:48:12 | FromDiscord | <0ffh> (edit) "https://play.nim-lang.org/#ix=3JOh" => "https://paste.rs/G0l" |
17:50:44 | FromDiscord | <Yardanico> In reply to @Solitude "your `$` is not": Yeah my mistake, misread the trace |
17:50:51 | FromDiscord | <Yardanico> It's good that we have it now at least :) |
17:50:52 | FromDiscord | <0ffh> sent a code paste, see https://play.nim-lang.org/#ix=3JOl |
17:51:12 | FromDiscord | <Yardanico> In the past the compiler didn't tell you why your code isn't pure |
17:51:18 | FromDiscord | <0ffh> (edit) "https://play.nim-lang.org/#ix=3JOl" => "https://play.nim-lang.org/#ix=3JOm" |
17:51:18 | * | badsektor quit (Remote host closed the connection) |
17:51:42 | FromDiscord | <Yardanico> In reply to @0ffh "What can I do,": well it's not a big deal as you can just continue using proc |
17:51:47 | FromDiscord | <no name fits> In reply to @Yardanico "If you have enough": wait how does that work? |
17:52:02 | FromDiscord | <Yardanico> In reply to @no name fits "wait how does that": he has an HDD and wants faster compile times |
17:52:08 | FromDiscord | <0ffh> In reply to @Yardanico "well it's not a": Yeah, I totally overlooked that was a func |
17:52:11 | FromDiscord | <no name fits> because I have plenty of RAM |
17:52:20 | FromDiscord | <Yardanico> So one big hack is to compile everything in the ram |
17:52:27 | FromDiscord | <Yardanico> if you have an SSD it won't change much |
17:53:30 | FromDiscord | <no name fits> I didn't know that was an option |
17:53:35 | FromDiscord | <no name fits> Also I have SSD so... |
17:54:11 | FromDiscord | <Rika> There's very minimal benefit if you already use an ssd |
17:54:32 | FromDiscord | <Yardanico> yeah exactly |
17:54:48 | FromDiscord | <no name fits> I don't have any issues with compile times using Nim though |
17:55:05 | FromDiscord | <Yardanico> Shiba is just searching for every way he can speed up the compilation somewhat, so I thought about tmpfs |
18:32:41 | FromDiscord | <geekrelief> is @Shiba using tcc? That's been the biggest speed up for me. |
18:34:17 | FromDiscord | <Shiba> Error: command missing |
18:34:19 | FromDiscord | <Shiba> sent a code paste, see https://play.nim-lang.org/#ix=3JPb |
18:34:30 | FromDiscord | <geekrelief> you need to have the Tiny C Compiler installed |
18:34:43 | FromDiscord | <Shiba> (edit) "https://play.nim-lang.org/#ix=3JPb" => "https://play.nim-lang.org/#ix=3JPc" |
18:34:52 | FromDiscord | <Shiba> do i need to also provide a path to tcc |
18:34:55 | FromDiscord | <geekrelief> https://github.com/TinyCC/tinycc |
18:35:04 | FromDiscord | <geekrelief> it should be in your path |
18:35:10 | FromDiscord | <geekrelief> once you install it |
18:35:27 | FromDiscord | <Shiba> i did |
18:36:35 | FromDiscord | <geekrelief> I don't have enough on to help you debug that. If tcc is in your PATH, nim should be able to find it |
18:39:57 | * | Gustavo6046 joined #nim |
18:42:52 | FromDiscord | <Shiba> so |
18:52:02 | * | xet7 quit (Ping timeout: 240 seconds) |
19:08:59 | FromDiscord | <Shiba> so i created a ram disck naand i put nim , my projects on it and nothing changed still 4s |
19:09:08 | FromDiscord | <Shiba> (edit) "disck" => "disk" |
19:09:13 | FromDiscord | <Shiba> (edit) "naand" => "and" |
19:09:21 | FromDiscord | <Shiba> (edit) "," => " and" |
19:09:42 | * | FromDiscord quit (Remote host closed the connection) |
19:09:55 | * | FromDiscord joined #nim |
19:10:51 | FromDiscord | <Solitude> reading/writing files takes tiny fraction of entire compilation, ofc it doesnt yield any meaningful speedups |
19:26:51 | FromDiscord | <hmmm> shouldn't nim compile speed be something like in the upper 5% of compiled langs already? How much speed do you need more my gud man, are you trying to compile skynet or smth |
19:27:52 | FromDiscord | <Shiba> do you think 5 seconds is fast for testing |
19:27:57 | FromDiscord | <hmmm> I mean when I press F7 I get dot dot dot bam finished |
19:28:05 | FromDiscord | <hmmm> its like 2 secs |
19:30:29 | FromDiscord | <geekrelief> In reply to @Shiba "do you think 5": you should really figure out why tcc isn't working for you |
19:31:12 | FromDiscord | <geekrelief> it's must faster for iteration |
19:31:16 | FromDiscord | <geekrelief> (edit) "must" => "much" |
19:31:52 | FromDiscord | <Shiba> In reply to @Elegantbeef "On windows i think": a guide? |
19:32:20 | FromDiscord | <Shiba> (edit) "In reply to @Elegantbeef "On windows i think": a guide? ... " added "(instrunction to install and setup)" |
19:32:33 | FromDiscord | <geekrelief> @Shiba Are you on windows? |
19:32:38 | FromDiscord | <Shiba> yes |
19:32:45 | FromDiscord | <geekrelief> there's a windows folder for tcc |
19:32:51 | FromDiscord | <geekrelief> the instructions are in there |
19:33:17 | FromDiscord | <geekrelief> https://github.com/TinyCC/tinycc/tree/mob/win32 |
19:33:49 | * | cheer left #nim (WeeChat 3.4) |
19:34:05 | FromDiscord | <Shiba> do you mean to build it |
19:36:34 | FromDiscord | <hmmm> today I needed to call one line of a python lib for a test and I was staring at my screen for a good 10 seconds, thought I hit some weird while true loop but no it was working as intended lol. I'd say 5 secs is not so bad. What langs do consistently better than that? |
19:36:54 | FromDiscord | <geekrelief> If you downloaded the binary I guess that would work too. I'm don't know why nim can find tcc if it's in your path. I have tcc built from the repo |
19:37:50 | FromDiscord | <geekrelief> In reply to @hmmm "today I needed to": 5 secs is ok if you have a big project, but for something under 100K lines I expect faster for iteration |
19:38:04 | FromDiscord | <geekrelief> I get subsecond compile times with tcc |
19:38:20 | FromDiscord | <hmmm> woa thats fast |
19:38:31 | FromDiscord | <hmmm> shiba get tcc my man |
19:38:47 | FromDiscord | <geekrelief> tm-nim https://media.discordapp.net/attachments/371759389889003532/925472868962287667/Umtezvizeu-1.mp4 |
19:42:06 | FromDiscord | <geekrelief> if this was gcc it'd be about 4 seconds, vcc is way longer. I heard about mold recently and I wonder if I should give clang a try |
19:42:21 | FromDiscord | <geekrelief> oh I forgot mold doesn't support windows yet |
19:43:16 | FromDiscord | <geekrelief> maybe it's time for me to upgrade to windows 11 and install wsl 😄 |
19:44:03 | FromDiscord | <Shiba> so ican compile c code with tcc but nim still can't find it |
19:45:05 | FromDiscord | <hmmm> people can actually install w11? I have like a big banner saying "dude get ready we preparin w11 as we speak" since 6 months |
19:45:25 | FromDiscord | <Yardanico> In reply to @geekrelief "if this was gcc": mold won't help you |
19:45:35 | FromDiscord | <Yardanico> It's aimed at bigger applications that take long to link |
19:45:37 | FromDiscord | <Yardanico> Like chromium |
19:45:40 | FromDiscord | <hmmm> I actually look forward to w11 because apparently you can get the new terminal as default |
19:45:55 | FromDiscord | <Yardanico> I've tested it and the difference was negligible |
19:45:57 | FromDiscord | <geekrelief> In reply to @Yardanico "It's aimed at bigger": oh yeah good point. those are huge 🙂 |
19:46:20 | FromDiscord | <Yardanico> In reply to @hmmm "people can actually install": ??? yes, it's already out |
19:47:32 | FromDiscord | <geekrelief> I've been holding off on installing. Got a fresh ssd for it, but I hate having to reinstall everything. |
19:50:25 | FromDiscord | <geekrelief> In reply to @Shiba "so ican compile c": Do you have Visual Studio installed? Can you compile with `--cc:vcc`? |
20:13:23 | FromDiscord | <Shiba> In reply to @geekrelief "Do you have Visual": no , and i cant think of an ide running on a pentium |
20:14:02 | FromDiscord | <Shiba> the error is the same whatever i put as an argument |
20:15:03 | FromDiscord | <Shiba> (edit) "the error is the same whatever i put as an argument" => "sent a code paste, see https://play.nim-lang.org/#ix=3JPR" |
21:25:49 | FromDiscord | <Shiba> ok yes it's found but now it's screaming errors |
21:25:55 | FromDiscord | <Shiba> (edit) "ok yes it's found ... but" added "it" |
21:34:08 | FromDiscord | <Shiba> i think i should change it's to 32 bit since it's the only supported architecteur |
21:52:44 | FromDiscord | <Shiba> https://media.discordapp.net/attachments/371759389889003532/925506580026368000/Capture.PNG |
22:03:16 | FromDiscord | <hmmm> I just tried tcc for kicks, it's faster no doubt, but the runtime will be slower right? |
22:04:09 | FromDiscord | <Shiba> In reply to @hmmm "I just tried tcc": yes , some libaries wont work tho since it's 32 bit only , and you will need to modify the pointers in the c filles |
22:04:32 | FromDiscord | <hmmm> I thought I downloaded tcc 64 |
22:04:46 | FromDiscord | <hmmm> or that's what my man fabrice said on his website |
22:05:15 | FromDiscord | <Shiba> maybe the installer is for 64 bit cpus |
22:08:05 | FromDiscord | <Shiba> In reply to @hmmm "I thought I downloaded": oh wait you use linux ?, ok you're good to go |
22:08:16 | FromDiscord | <hmmm> nu I'm on w10 |
22:18:34 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:19:12 | FromDiscord | <Elegantbeef> Indeed↵(@hmmm) |
22:19:27 | FromDiscord | <Elegantbeef> TCC's speed is all "let's get the fastest to binary" not "let's get the fastest binary" |
22:27:07 | * | Gustavo6046 quit (Quit: Leaving) |
22:30:07 | FromDiscord | <Shiba> now i need to find those libaries that my nim package use and fix the pointers |
22:32:54 | FromDiscord | <Shiba> nevermind it's works |
22:33:55 | FromDiscord | <Yardanico> In reply to @Shiba "yes , some libaries": What? You don't need to modify any pointers |
22:34:16 | FromDiscord | <Yardanico> If your Nim compiler is 64-bit and the C compiler is 32-bit then just compile with --cpu:i386 |
22:34:23 | FromDiscord | <Yardanico> If you want 32-bit binaries |
22:35:15 | FromDiscord | <Shiba> okay okay🥺 |
22:35:27 | * | Gustavo6046 joined #nim |
22:36:15 | FromDiscord | <Yardanico> In reply to @Shiba "": There's an easy workaround for that too |
22:36:17 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/19041#issuecomment-962548645 |
22:36:52 | FromDiscord | <Shiba> i should dig deeper before i ask here |
22:38:24 | * | vicfred joined #nim |
22:39:57 | FromDiscord | <Yardanico> But again, tcc will only help with C compilation speed, Nim compilation speed will be the same |
22:44:41 | FromDiscord | <Shiba> yes the c compiling part is now faster |
23:06:26 | * | noeontheend quit (Read error: Connection reset by peer) |
23:07:16 | * | noeontheend joined #nim |
23:41:35 | FromDiscord | <evoalg> In reply to @Solitude "i grepped the stdlib": did you download docs so yo can use grep on the command line? I love grep, but how do I download docs in a nice format? ... or do you use html files? |
23:46:48 | FromDiscord | <Yardanico> he probably just grepped the src |
23:47:07 | FromDiscord | <evoalg> is that downloaded by default? |
23:47:14 | FromDiscord | <Yardanico> of course? |
23:47:19 | FromDiscord | <Yardanico> nim has to compile your code somehow |
23:47:24 | FromDiscord | <evoalg> ahhh true |
23:47:26 | FromDiscord | <Yardanico> if you import the stdlib it needs to get the stdlib from somewhere |
23:47:36 | FromDiscord | <evoalg> gotcha - thank you! |