<< 19-01-2022 >>

00:03:04FromDiscord<evoalg> ok I forked https://github.com/nim-lang/Nim
00:04:00FromDiscord<Elegantbeef> now you'll want to go to `lib/system.nim` and add your runnable example
00:04:58FromDiscord<Patitotective> I'm creating a nimble library and I was wondering what should be included into main module (`niprefs.nim`), should I just export all the other modules?
00:05:34FromDiscord<Elegantbeef> You could it's up to you, you dont need a "main" module for a library
00:06:21FromDiscord<Patitotective> Oh, really? Thanks :uos
00:06:30FromDiscord<Patitotective> (edit) ":uos" => "๐Ÿ™ƒ"
00:07:33FromDiscord<evoalg> I've gone to Nim/tree/devel/lib/system ... but that's not lib/system.nim
00:07:55FromDiscord<Elegantbeef> You cloned the repo right?
00:08:23FromDiscord<Elegantbeef> After forking you want to clone your fork, then go to that directory on your drive
00:08:31FromDiscord<evoalg> I forked it ... oh there's a system.nim and a system folder ... that was my problem
00:08:47FromDiscord<evoalg> oh I don't do it on the github site?
00:09:09FromDiscord<Elegantbeef> I mean you can but life is easier working in a proper environment
00:09:17FromDiscord<evoalg> ok
00:11:36FromDiscord<Elegantbeef> Hmm i dont know if there is a good way to properly test this...
00:12:01FromDiscord<Elegantbeef> Ideally the runnable example has a assurance it works, but you need to send the ctrl+c to the program somehow
00:12:29FromDiscord<evoalg> oh so a runnable example isn't just meant as an example for users?
00:12:53FromDiscord<Elegantbeef> Well it is, but ideally you have assurances that it works
00:13:24FromDiscord<Elegantbeef> I cant think of how to assure this so i'd say just write an example and make a PR and either it'll get accepted or you'll get told to sod off but have learned how to make a PR
00:14:18FromDiscord<congusbongus> there should be a way to send signals to programs in tests, it might be more involved in compiled languages in nim but it's possible
00:14:27FromDiscord<congusbongus> (edit) "in" => "like"
00:14:29FromDiscord<evoalg> examples are good ... there are lots of cases where I ended up coming here and asking you because there were no examples ... or that's at least how if feels to me, being new
00:15:16FromDiscord<exelotl> yep we can always benefit from more examples
00:15:32FromDiscord<evoalg> I would imagine (but might be quite wrong) that most people checking out a language wouldn't come on irc / discord etc
00:17:23FromDiscord<evoalg> ahhh some of the examples are put in with comments ... I will do that
00:17:57*rlp10 quit (Ping timeout: 240 seconds)
00:19:58*rlp10 joined #nim
00:22:41FromDiscord<evoalg> ok beefy I added an example, and I pushed it back to my forked nim ... now how do I create a PR?
00:24:30*rlp10 quit (Read error: Connection reset by peer)
00:25:17*krux02 quit (Remote host closed the connection)
00:26:08*rlp10 joined #nim
00:27:05*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
00:28:23FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/pulls the big green button or if you view your repo it'll say "recent commit in X, pullrequest" or similar
00:29:24FromDiscord<Elegantbeef> Well the main issue is that it'd require importing other libraries just for the testโ†ต(@congusbongus)
00:29:37FromDiscord<Elegantbeef> I suppose that's not a big issue
00:30:16arkanoidonce I have a enum with string symbols, is there a convenient way to get that enum value from the string?
00:31:11FromDiscord<Elegantbeef> `import std/strutils; let myEnm = parseEnum[MyEnumType](myStr)`
00:31:34arkanoidis it fast? otherwise I would map it the other way around
00:31:49FromDiscord<Elegantbeef> Warning in the case of `type Colors = enum r = "red", g = "green", b = "blue"` both `"r"` and `"red"` are accepted
00:32:12FromDiscord<Elegantbeef> It's relatively fast it converts the string to a nim normalized string then compares using hashes iirc
00:33:09FromDiscord<evoalg> In reply to @Elegantbeef "https://github.com/nim-lang/Nim/pulls the big green": and it should be devel?
00:33:18FromDiscord<Elegantbeef> Actually it might just has the normalized string
00:33:26FromDiscord<Elegantbeef> Yep from your branch to `nim/devel`
00:34:01arkanoidthanks
00:34:31FromDiscord<evoalg> I clicked on the big green button "New pull request" but I can't then click on "Create pull request"
00:35:45FromDiscord<evoalg> and I dunno if that's what I'm supposed to do ... when I went to my forked nim (instead of clicking on the big green button) I can't see where it says "recent commit in X, pullrequest"
00:36:00FromDiscord<Elegantbeef> Click `"compare across forks"` then click the `headRepository` and click yours
00:36:00FromDiscord<Elegantbeef> Should be like this
00:36:01FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/933157816645058560/image.png
00:36:02FromDiscord<Elegantbeef> of course replace my repo with yours
00:37:28FromDiscord<Elegantbeef> Assuming you pushed to devel you can just copy this link and replace `beef331` with your github name https://github.com/nim-lang/Nim/compare/devel...beef331:devel
00:38:39FromDiscord<evoalg> I think I did it ... with the compare across forks way
00:39:17FromDiscord<evoalg> https://github.com/nim-lang/Nim/pull/19416
00:39:49FromDiscord<Elegantbeef> Nice though i dont know about using `## Example`
00:41:01FromDiscord<evoalg> it looked like there were other ones like that (that weren't runnable examples)
00:42:14FromDiscord<Elegantbeef> Is there an example of it elsewhere?
00:42:14FromDiscord<Elegantbeef> Ah it's full of it ๐Ÿ˜€
00:42:15FromDiscord<evoalg> I can sort of see why people just put it on stackoverflow ... it'd be better in the docs though
00:42:24FromDiscord<evoalg> hehe yea
00:42:33FromDiscord<Elegantbeef> I dont see why
00:42:44arkanoidis it better to name it atLargeUtf8String or arLargeUTF8String?
00:42:55FromDiscord<Elegantbeef> It might be a bit odd to learn but nothing bad will happen
00:43:14FromDiscord<Elegantbeef> It's Nim it doesnt matter, but NEP says former
00:45:34FromDiscord<evoalg> I guess people find it easier to "stackoverflow" it with less time spend by them instead of "fighting" to get it on the system docs ... and eg if I have something to look up in python my first choice is SO as then it's usually explained beautifully with examples and gotchas
00:46:07FromDiscord<evoalg> but I agree it's better in the docs
00:46:42FromDiscord<evoalg> (or both)
00:47:35FromDiscord<evoalg> ... and thank you beefy for patiently showing me how to create a PR ๐Ÿ™‚
00:47:54FromDiscord<Elegantbeef> No problem
00:48:59FromDiscord<Elegantbeef> For reference https://github.com/nim-lang/Nim/blob/version-1-6/lib/system.nim#L200
00:49:46FromDiscord<evoalg> ahhhh ok
00:50:16arkanoidthanks again
00:51:08FromDiscord<Elegantbeef> To quickly explain `rebase` allows you to modify the git history `HEAD~1` goes back 1 commit from where you are, everything else i think is self explanatory ๐Ÿ˜€
00:51:15FromDiscord<Elegantbeef> No problem ark
00:53:37FromDiscord<evoalg> hang on ... `rebase` ... you're talking to me beefy? What should I do?
00:54:25FromDiscord<Elegantbeef> Reread my message that starts with "you are missing"
00:55:00FromDiscord<evoalg> I can't see that message?
00:55:01FromDiscord<Elegantbeef> I'm suggesting you to edit your last commit with one that has the codeblock statement is basically what that means
00:55:07arkanoidif I have a enum with string symbol like type MyEnum = enum; meFoo: "bar", how can I print "meFoo"?
00:55:49FromDiscord<Elegantbeef> You are missing `.. code-block:: Nim` so you may want to to `git rebase -i HEAD~1` replace `pick` with `edit` add code block then `git add --all` followed by `git rebase --continue` and `git push --force`
00:55:59FromDiscord<Elegantbeef> Matrix bridge working now?
00:56:24FromDiscord<Elegantbeef> Probably should've wrote periods and commas ๐Ÿ˜€
00:56:34FromDiscord<evoalg> I can see it now ๐Ÿ˜‰
00:57:10FromDiscord<Elegantbeef> You are missing `.. code-block:: Nim`.โ†ตSo you may want to do`git rebase -i HEAD~1` replace `pick` with `edit`.โ†ตAdd the code block stuff then `git add --all` followed by `git rebase --continue` and `git push --force`โ†ตThere we go probably more readable! ๐Ÿ˜›
00:57:42FromDiscord<Elegantbeef> I dont know if you can arkanoid without making something to do it
00:58:00FromDiscord<Elegantbeef> the whole `a = "yourStr"` intentionally overwrites `$`
01:01:02FromDiscord<evoalg> I think I did it ... will that only update my forked one?
01:01:26FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/pull/19416/files ehhh!
01:01:37FromDiscord<Elegantbeef> You've learned to git! ๐Ÿ™‚
01:02:30arkanoidElegantbeef, I've enabled --stylecheck:hint, and it is saying "'atUtf8String' should be: 'atUTF8String'"
01:02:47arkanoidwell, I hope it is coming from nim, vscode may be doing something
01:03:02FromDiscord<Elegantbeef> Well yea declaration has to match call with styleCheck
01:03:50FromDiscord<Elegantbeef> Here you go arknoid https://play.nim-lang.org/#ix=3MIY
01:04:05FromDiscord<Elegantbeef> You also provided me with yet another typed macro for my updated macro tutorial! ๐Ÿ˜›
01:04:23arkanoid:D
01:04:29arkanoidthanks a lot!
01:04:51arkanoidwhat do you mean with "Well yea declaration has to match call with styleCheck"?
01:05:09arkanoidargh! here the stile checker is saying the opposite!
01:05:25FromDiscord<Elegantbeef> `styleCheck` ensures that the callsites have the same identifiers as declared iirc
01:05:44FromDiscord<Elegantbeef> Oh nvm that's Nim's style guid by default
01:05:54arkanoid'atUtf8String' should be: 'atUTF8String', 'atLargeUTF8String' should be: 'atLargeUtf8String'
01:06:09FromDiscord<Elegantbeef> > โ†ตIn the age of HTTP, HTML, FTP, TCP, IP, UTF, WWW it is foolish to pretend these are somewhat special words requiring all uppercase. Instead treat them as what they are\: Real words. So it's parseUrl rather than parseURL, checkHttpHeader instead of checkHTTPHeader etc.
01:06:15FromDiscord<Elegantbeef> That's from NEP1
01:07:23nrds<Prestige99> Seems a bit weird, I would capitalize abbreviations personally
01:07:56FromDiscord<Elegantbeef> Given that people say "json" as "jason" and "gui" as "gooey" i dont know
01:08:12arkanoidin my case it is suggesting two completely opposite things
01:08:32FromDiscord<Elegantbeef> I think it cannot reasonable enforce style checks
01:09:03FromDiscord<evoalg> In reply to @Elegantbeef "https://github.com/nim-lang/Nim/pull/19416/files eh": hehe ... I haven't learned git, but I'm taking notes - thank you once again ๐Ÿ™‚
01:09:58FromDiscord<Elegantbeef> No problem, the best part is you can now document things once you find they're under documented, you've become the change you want to see ๐Ÿ˜›
01:14:45FromDiscord<evoalg> true
01:17:35arkanoiddoes nim have a "null type" I can use as T?
01:17:49FromDiscord<Elegantbeef> `void`?
01:18:13FromDiscord<Elegantbeef> If you want void but different you can do `type NoType = distinct void`
01:22:52arkanoidright! thanks, sorry for the naive questions
01:23:20arkanoidI have to deal with multiple languages every day, it's hard to draw a line and switch context
01:28:28FromDiscord<Patitotective> Is there an equivalent for _Python_ class properties in _Nim_? (Fields that call a procedure)
01:28:46FromDiscord<Elegantbeef> yes properties ๐Ÿ˜€
01:29:04FromDiscord<Patitotective> lol
01:29:47FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MJ8
01:29:58FromDiscord<Elegantbeef> Whoops the `a=` should be `myType: var MyType`
01:30:09FromDiscord<Patitotective> damn, _Nim_'s so cool lol ๐Ÿ™ƒ
01:30:10FromDiscord<Patitotective> thanks
01:32:18arkanoiddo you know if there a way to ask the compile to reorder index of literal arrays with char index?
01:32:57FromDiscord<Elegantbeef> I dont think so
01:33:03FromDiscord<Elegantbeef> Atleast if i understand what you want
01:33:09arkanoidI mean this https://play.nim-lang.org/#ix=3MJ9
01:33:31FromDiscord<Elegantbeef> Yea there is not
01:33:38FromDiscord<Elegantbeef> You could make a macro for it though
01:34:10FromDiscord<Elegantbeef> But there's also an issue that it's non contiguous
01:34:21arkanoidis that a problem?
01:34:46arkanoidI just wanted to avoid hash map given that index is char
01:34:56arkanoidbut yeah, it's premature optimization
01:37:56FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3MJb is what you could do
01:38:24FromDiscord<Elegantbeef> You then can do `yourChar in formatChars` before indexing the array
01:38:47FromDiscord<Elegantbeef> Or you can just index and get `taInvalid`
01:39:20NimEventerNew post on r/nim by TheDarkMode: noesisengine and nim?, see https://reddit.com/r/nim/comments/s7e1hq/noesisengine_and_nim/
01:39:58FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MJc
01:40:02FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3MJc" => "https://play.nim-lang.org/#ix=3MJd"
01:40:45FromDiscord<Elegantbeef> I'd personally do `newPrefs(table.objectV, path)` but ymmv
01:40:56arkanoidElegantbeer, very elegant, very beef. Thanks!
01:41:17FromDiscord<Elegantbeef> Lol no problem
01:43:58FromDiscord<Elegantbeef> I dont know my view is repeating oneself is silly, so when possible dont do it
01:47:49arkanoidand now is possible to have a map of MyEnum -> Type? Like atUInt8 : int8
01:48:04arkanoidarray[ArrowType, typedesc] seems not valid
01:48:05FromDiscord<Elegantbeef> No
01:48:18FromDiscord<Elegantbeef> `typedesc` is compile time information
01:49:06arkanoidok, time for large "case" i suppose
01:49:10FromDiscord<Patitotective> How can I clean all whitespaces from a string? https://nim-lang.org/docs/strutils.html#Whitespace
01:49:16FromDiscord<Patitotective> (edit) "https://nim-lang.org/docs/strutils.html#Whitespace" => "(https://nim-lang.org/docs/strutils.html#Whitespace)"
01:50:40FromDiscord<Elegantbeef> https://nim-lang.org/docs/strutils.html#strip%2Cstring%2Cset%5Bchar%5D
01:50:52FromDiscord<Elegantbeef> Depending what you're doing ark https://play.nim-lang.org/#ix=3MJe will work
01:52:01arkanoidmmm ok
01:52:51arkanoidI have to do it at runtime: I'm reading a string that represents a datatype, and I have to resolve it's sizeof
01:53:13arkanoidso I have to run a parser first, then find out the type/object, then sizeof it
01:53:20FromDiscord<Patitotective> In reply to @Elegantbeef "https://nim-lang.org/docs/strutils.html#strip%2Cstr": I want to remove whitespaces inside the string too (`"Hello world" -> "Helloworld"`)
01:55:06FromDiscord<Elegantbeef> Time to iterate over all the characters only adding the result if it's not whitespace
01:56:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MJf
01:57:50FromDiscord<Patitotective> why this `result = newString(s.len)`?
01:58:12FromDiscord<Elegantbeef> To preallocate the result buffer to a known larger size so `add` doesnt cause any allocations
01:58:34FromDiscord<Elegantbeef> The max size of the result is the length of s, but the min size can be 0..s.len
01:58:44FromDiscord<Elegantbeef> i gues `0..<s.len`
01:58:53FromDiscord<Patitotective> ๐Ÿ™ƒ
01:59:07FromDiscord<Elegantbeef> By preallocating a string to max size we avoid multiple allocations while doing `.add`
02:00:11FromDiscord<Elegantbeef> You could also do an inplace variation that modifies the `var string` but I didnt feel like implementing it
02:20:32FromDiscord<Yardanico> In reply to @Patitotective "why this `result =": As Beef said, it preallocates, but he made a slight mistake - if you want to still use add you need to use newStringOfCap instead of just newString
02:21:10FromDiscord<Patitotective> In reply to @Yardanico "As Beef said, it": lol thanks ๐Ÿ™ƒ
02:21:49FromDiscord<Elegantbeef> Ah right
02:21:55FromDiscord<Elegantbeef> Sue me
02:23:29FromDiscord<Patitotective> How can I create a procedure with optional parameters? Not default, parameters that when given modify the resultโ†ต(Maybe different procedures?)
02:24:04FromDiscord<Elegantbeef> Overload is one way, but give an example of what you're after
02:25:22FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MJn
02:25:34*neurocyte0917090 quit (Ping timeout: 250 seconds)
02:25:41FromDiscord<Elegantbeef> `if key.len > 0` if `prefs.len != 0`
02:26:10FromDiscord<Elegantbeef> If you dont want that you can also use `std/options`
02:26:18FromDiscord<Patitotective> In reply to @Elegantbeef "`if key.len > 0`": But, what if the user wants to use an empty table?
02:26:32FromDiscord<Patitotective> In reply to @Elegantbeef "If you dont want": Hmm, ok
02:26:35FromDiscord<Patitotective> (edit) "In reply to @Elegantbeef "If you dont want": Hmm, ok ... " added "thanks"
02:27:26FromDiscord<Rika> In reply to @Patitotective "But, what if the": Do you actually have a distinction between none and empty?
02:28:06FromDiscord<Patitotective> Yep
02:28:20FromDiscord<Patitotective> There can be a key that's an empty string
02:28:35FromDiscord<Elegantbeef> Then options are your best bet
02:28:42FromDiscord<Elegantbeef> Or overloads ๐Ÿ˜€
02:29:46FromDiscord<Patitotective> In reply to @Elegantbeef "Or overloads ๐Ÿ˜€": hmm, yea, let me try them
02:29:58FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MJo
02:35:52FromDiscord<Rika> In reply to @Patitotective "There can be a": Then the table is not empty
02:36:04FromDiscord<Rika> Ah you mean the key
02:40:30arkanoidis there a logic behind which value is returned from an array with index with holes when a hole is requestes?
02:41:00arkanoidit seems to return the same value as the last highest index in array
02:41:23FromDiscord<Elegantbeef> What do you mean?
02:41:50FromDiscord<Elegantbeef> Array's are contiguous so there are no holes
02:43:18arkanoidElegantbeef: https://play.nim-lang.org/#ix=3MJq
02:43:47FromDiscord<Elegantbeef> the value will always be the `0`'d value in this case `atInvalid`
02:43:52FromDiscord<Elegantbeef> remember Nim 0's memory
02:44:12arkanoidis it an assert or is just a case?
02:44:23FromDiscord<Elegantbeef> I dont follow
02:46:21FromDiscord<Elegantbeef> All values will be by default be `atInvalid` if you dont want to check what is implemented make a bitset and check that first
02:46:28FromDiscord<Elegantbeef> `{'n', 'b', 'c', 'C', ....}`
02:48:05arkanoidok
02:48:44arkanoidsorry I feel my english is not up-to-level sometimes
02:49:09FromDiscord<Elegantbeef> It's fine, you can provide code which is better than english, cause i'm clearly inept at english aswell
02:49:10arkanoidI was just asking if I can add a doAssert in that
02:49:32FromDiscord<Elegantbeef> You can do `assert a in FormatSet`
02:54:33arkanoidI have an UncheckedArray[MyType] and a length of it, it is possible to generate a type that turns it into something I can pass around as an openArray or similar?
02:54:36arkanoidwithout copy
02:55:19arkanoidat runtime
02:55:55FromDiscord<Elegantbeef> There is `toOpenArray`
02:56:42arkanoidit doesn't do copy?
02:56:48FromDiscord<Elegantbeef> Nope
02:56:57FromDiscord<Elegantbeef> But you cannot hold onto it as a variable
02:57:07FromDiscord<Elegantbeef> So you need to send it to a procedure or similar that accepts `openArray[T]`
02:58:44arkanoidsure
02:58:52arkanoidsweet sweet openarray
03:01:37arkanoiddamns seems that it wont work for a UncheckedArray[pointer]
03:08:43FromDiscord<Elegantbeef> Cast to `UncheckedArray[int]` perhaps i dont know
03:39:29*arkurious quit (Quit: Leaving)
03:47:09arkanoidI succeeded finally, I had to use templates instead of procs, and it makes sense
03:47:14arkanoidI cannot return openArray
03:49:43FromDiscord<Elegantbeef> Ah yes
03:51:13arkanoidnow I'm stuck, at runtime I have a enum value that means a nim type (like atFloat64), and I have a "ptr UncheckedArray[byte]" that I need to cast to "ptr UncheckedArray[float64]" and possibly to openArray after that, but all this at runtime
03:52:11arkanoidI lack the knowledge to handle types at runtime
03:52:50FromDiscord<Elegantbeef> Well you need to handle them statically ๐Ÿ˜›
03:53:05arkanoidbut how?
03:53:38arkanoidmaybe the answer is here but unsure https://play.nim-lang.org/#ix=3MJe
03:53:51arkanoidmy arg is not static
03:54:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MJz
03:56:07arkanoidlike what I'm doing here I guess https://play.nim-lang.org/#ix=3MJA
03:57:42FromDiscord<Rosen> man's really naming his types "taint"
03:58:10arkanoid?
03:58:34FromDiscord<Elegantbeef> you know you can do `of atBinary, atLargeBinary, atUtf8String, atLargeUtf8String` ๐Ÿ˜›
03:58:52FromDiscord<Elegantbeef> I guess that's to be implemented
03:58:53FromDiscord<Elegantbeef> Disregard!
03:58:59arkanoidyes, but these are todo
03:59:57arkanoidso there's no way to ArrowType -> typedesc at runtime
04:00:14arkanoiddamn, now I feel where python shines
04:00:25arkanoidbut smells everywhere else
04:03:30arkanoidmaybe a large object variant ...
04:06:47FromDiscord<Elegantbeef> That's basically what you have
04:26:49*Gustavo6046 joined #nim
05:46:22arkanoidit always confuses me how you cannot do UFC on iterator
05:47:15arkanoidI have "template values*[T](arr: ArrowArray): openArray[T] =", I can do "for v in values[int32](arr)", but I can't "for v in arr.values[int32]()"
05:48:18FromDiscord<Elegantbeef> you can
05:48:23FromDiscord<Elegantbeef> do `arr.values[: int32]`
05:48:38FromDiscord<Elegantbeef> generic method call syntax requires `[: T]`
05:49:13arkanoidhow can I discriminate when it is needed and when is not?
05:53:13FromDiscord<Elegantbeef> Is it a generic you're calling using method call syntax? You need it
06:06:22arkanoidit happens so rarely that I never figured it out by myself
06:06:26arkanoidthanks for your patience
06:06:49arkanoidin the meanwhile, hooray, got my first read from pyarrow structure
06:07:58arkanoidhow was that pragma to raise compile error? {.error.} or something
06:09:08FromDiscord<Elegantbeef> `{.error: "msg".}`
06:25:07FromDiscord<evoalg> So beefy, someone corrected my example as it was quite right https://github.com/nim-lang/Nim/pull/19416 ... I don't have to do anything right?
06:25:15*rockcavera quit (Remote host closed the connection)
06:36:35arkanoidthanks
06:39:19FromDiscord<Elegantbeef> No they did not correct it
06:39:24FromDiscord<Elegantbeef> They gave you what is needed to fixed
06:39:38FromDiscord<Elegantbeef> So you'll want to follow my instructions again adding the tabs
06:39:57FromDiscord<Elegantbeef> Or just add the tabs and push
06:53:00FromDiscord<Elegantbeef> @evoalg\: ^ just to get your attention
06:53:54FromDiscord<evoalg> I can add the tabs and push without doing that trickiness?
06:54:44FromDiscord<Elegantbeef> You can, it'll add another commit though depending on your view that's not that great
06:55:07FromDiscord<Elegantbeef> They squash them all into a single commit anyway, but yea just a think to be cognisant about
06:56:08FromDiscord<evoalg> so can I click on the drop-down on their code and click commit?
06:56:41FromDiscord<Elegantbeef> I think so
06:56:47FromDiscord<Elegantbeef> Havent used github gui much myself
06:57:41FromDiscord<evoalg> The drop-down on the "Commit suggestion" and click on "Commit changes" ... oh ok .... another question, how do I tell that they didn't commit those changes (and didn't correct it)?
06:58:06FromDiscord<Elegantbeef> It says "suggested change" and there is no new commit in the history
06:58:31FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/933254078069354516/image.png
06:58:40FromDiscord<Elegantbeef> For example of what it looks like if someone adds a commit ontop of yours ๐Ÿ˜€
06:59:29FromDiscord<evoalg> ok ... I clicked commit on the drop down ... I'll try and see if that worked
06:59:29FromDiscord<Elegantbeef> They missed the last statement!
07:00:05FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/pull/19416/files#diff-c7ae564e61082887ea50f0d58a637cb12fa78261f51aa4eface24ababfeee299R2330 that poor line isnt indented ๐Ÿ™‚
07:00:44FromDiscord<Elegantbeef> Git does get easier to use the more you use it
07:01:10FromDiscord<evoalg> oh darn
07:01:19FromDiscord<evoalg> I should have realized sorry
07:01:40FromDiscord<evoalg> so it's too late to do the HEAD trick?
07:01:44FromDiscord<Elegantbeef> Nah
07:01:52FromDiscord<Elegantbeef> You can always do `git pull`
07:02:15FromDiscord<evoalg> oh I edited the change ... but maybe I should do a git pull ok
07:02:28FromDiscord<evoalg> I mean edited it locally
07:02:48FromDiscord<evoalg> oh it did not like that
07:03:23FromDiscord<Elegantbeef> you can then do `git rebase -i HEAD~2` `edit` the first `drop` the second, indent it properly doโ†ต`git add --all`โ†ต`git rebase -- continue`โ†ต`git force --push`
07:03:29FromDiscord<Elegantbeef> Jeez
07:03:32FromDiscord<Elegantbeef> `git push --force` ๐Ÿ˜›
07:03:46FromDiscord<Elegantbeef> You can either do `git checkout .` to discard your change
07:03:52FromDiscord<Elegantbeef> Or you can do `git reset --hard`
07:03:59FromDiscord<evoalg> I only edited it in vim ... I didn't add it locally to git
07:04:11FromDiscord<Elegantbeef> Ah
07:04:44FromDiscord<evoalg> I'll undo and do you HEAD~1 trick and then change it?
07:05:05FromDiscord<Elegantbeef> Well `HEAD~2` now if you want to have a single commit
07:05:24FromDiscord<evoalg> ok
07:05:32FromDiscord<Elegantbeef> You can drop the latest commit and edit the first
07:05:55FromDiscord<evoalg> sorry how do I do that? ... I'm easily confused with git
07:06:09FromDiscord<Elegantbeef> This message walks you through it
07:06:20FromDiscord<evoalg> ok
07:06:35FromDiscord<Elegantbeef> it should be `git push --force` though
07:06:41FromDiscord<evoalg> ok
07:06:54FromDiscord<Elegantbeef> Tired mind got starwarsy i guess
07:07:26FromDiscord<evoalg> lol
07:07:38FromDiscord<Elegantbeef> `HEAD~2` if you cannot guess allows you to modify the the last two commits
07:07:44FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3MJU
07:07:48FromDiscord<Elegantbeef> `git checkout .`
07:07:59FromDiscord<Elegantbeef> You saved a file inside the git directory and git knows it
07:08:27FromDiscord<Elegantbeef> Git's tracking files so it knows when one has changes and will not let you use many commands whilst you have them
07:08:53FromDiscord<Elegantbeef> `checkout .` should discard changes if you havent committed
07:09:00FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3MJV
07:09:07FromDiscord<evoalg> I change to edit the 2nd ... ignore the 1st?
07:09:11FromDiscord<Elegantbeef> you didnt do `git pull`
07:09:13FromDiscord<evoalg> oh
07:09:20FromDiscord<Elegantbeef> do not modify that just close it
07:09:28FromDiscord<evoalg> ok
07:09:40FromDiscord<Elegantbeef> `git pull` now
07:09:50FromDiscord<Elegantbeef> That'll get your remote changes(from github gui)
07:10:03FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3MJW
07:10:49FromDiscord<evoalg> it's suggesting I do one of those before my next git pull
07:10:55FromDiscord<Elegantbeef> I guess the first
07:10:58FromDiscord<evoalg> ok
07:11:02FromDiscord<Elegantbeef> \Dont know if i've seen that before
07:12:08FromDiscord<evoalg> I did it ... but I'm still getting:
07:12:17FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3MJX
07:12:23FromDiscord<Elegantbeef> That's right this time
07:12:24FromDiscord<Elegantbeef> Notice how the commits changed
07:12:43FromDiscord<Elegantbeef> edit the first one "add an example to" and drop "correct the example"
07:12:54FromDiscord<evoalg> ohhhhh
07:13:02FromDiscord<evoalg> now I edit the first?
07:13:22FromDiscord<evoalg> change pick to edit on the first one?
07:13:43FromDiscord<evoalg> drop the 2nd...
07:14:19FromDiscord<Elegantbeef> yes
07:14:41FromDiscord<Elegantbeef> you now properly format the example then do `git add --all`
07:15:31FromDiscord<Elegantbeef> then you can do `git rebase --continue` and `git push --force` and should be golden
07:15:39FromDiscord<Elegantbeef> And this is your intro to git! ๐Ÿ™‚
07:18:47FromDiscord<evoalg> I did it ... I think...
07:19:01FromDiscord<Elegantbeef> You did!
07:19:09FromDiscord<Elegantbeef> Congrats
07:19:38FromDiscord<evoalg> phew ... but I needed lots of hand holding
07:20:13FromDiscord<Elegantbeef> To be fair i dont imagine most are used to manually rebasing/editing commits
07:21:05FromDiscord<evoalg> advance trickiness heh ๐Ÿ˜‰
07:21:25FromDiscord<Elegantbeef> Think i mainly depends on what they're working on or who they are
07:21:54FromDiscord<evoalg> those spaces after the hash signs `## ` and then indenting made me stop and think
07:21:58FromDiscord<Elegantbeef> Eh if you use git more often it's not too magical
07:23:43FromDiscord<evoalg> so I could have committed additional changes but using advanced ways we made it as if it was right the first time
07:23:50FromDiscord<Elegantbeef> Yep
07:25:02FromDiscord<evoalg> if it passes and people have happy with it, will it get updated with the next nim version or something ... not the current one right?
07:25:08FromDiscord<Elegantbeef> The git history is not any wiser that you panicked hyperventilated and vomited in a paper bag
07:25:36FromDiscord<Elegantbeef> Yea it'll be in the next minor Nim version `1.8`(or 2.0) unless it's backported
07:26:00FromDiscord<evoalg> Thanks for your help once again
07:26:47FromDiscord<Elegantbeef> It will be on the dev docs though
07:27:05FromDiscord<Elegantbeef> Dev docs hosted here https://nim-lang.github.io/Nim/
07:27:40FromDiscord<Elegantbeef> Dont remember if these are generated nightly or after each PR, so no clue how long after your PR will you see your first contribution
07:27:42FromDiscord<evoalg> ahhh thanks ๐Ÿ™‚
07:27:59FromDiscord<evoalg> that's if it's accepted
07:28:25FromDiscord<Elegantbeef> Eh it'll probably be
07:30:37FromDiscord<xflywind> You can use `nim doc -r --lib:lib lib/system.nim` to see whether your changes work.
07:31:09FromDiscord<xflywind> https://nim-lang.github.io/Nim/contributing.html contains many contributing guides.
07:31:49FromDiscord<Elegantbeef> Oh right the commit message should've had `[skip CI]` cause it's purely doc
07:32:12FromDiscord<evoalg> ahhhhh ... thank you both
07:34:11FromDiscord<xflywind> In reply to @evoalg "ahhhhh ... thank you": I think an extra line is required between example and code examples
07:34:15FromDiscord<xflywind> https://media.discordapp.net/attachments/371759389889003532/933263064839618560/unknown.png
07:34:36FromDiscord<xflywind> (edit) "code examples" => "`.. code-block`"
07:34:59FromDiscord<Elegantbeef> Evo is like 3 seconds away from going "Well i thought adding this was going to be simple, but i'm off to go kill a person, be back after lunch"
07:35:18FromDiscord<evoalg> or have a cry
07:35:58FromDiscord<enthus1ast> @Patitotective\: yes but you must tweak it to fit your use case https://play.nim-lang.org/#ix=3MJZ
07:36:04FromDiscord<evoalg> Shall I do the HEAD~1 trick again beefy?
07:36:27FromDiscord<Elegantbeef> Hey dont look at me I'm not someone that can accept PRs
07:37:02FromDiscord<xflywind> rebase is not required, PRs are merged by squash automatically.
07:37:17FromDiscord<enthus1ast> @Patitotective\: eg if you want to replace hex/decimal with numbers or characters
07:37:50FromDiscord<evoalg> so I could just do another git add, commit & push after editing it with the new line?
07:37:58FromDiscord<xflywind> yeah
07:38:08FromDiscord<Elegantbeef> Test locally with what flywind said first though
07:38:21*PMunch joined #nim
07:38:44FromDiscord<evoalg> true
07:38:58FromDiscord<Isofruit> In reply to @Elegantbeef "And this is your": Oh boy, git rebase
07:40:16FromDiscord<Isofruit> I use almost anything but, I do not run with a lot of branches generally though so I guess that doesn't quite count.โ†ตI use cherry pick more than I use rebase tbh
07:40:40FromDiscord<evoalg> looks good ... and I should use [skip CI] somewhere in the commit message?
07:42:08FromDiscord<evoalg> geez I did "git commit" and forgot to do the [skip CI] straight away
07:42:26FromDiscord<Isofruit> Can always amend if it isn't pushed
07:42:41FromDiscord<evoalg> I didn't do git push yet
07:43:18FromDiscord<Isofruit> Git commit - - amend... Imagine I wrote that flag correctly
07:43:29FromDiscord<Isofruit> On mobile, life is hard
07:44:07FromDiscord<evoalg> thanks that worked
07:47:07FromDiscord<evoalg> so I ended up doing `git add .` and `git commit` (and then edited it) and then `git push` ... and I think it updated the PR
07:47:52FromDiscord<Isofruit> If you commit to a branch that is in pr that commit counts towards the pr
07:49:20FromDiscord<Isofruit> Effectively the PR isn't on a snapshot of your branch, it's of the entire branch until the pr is merged. That is so you can make refactoring commits after receiving feedback on your pr by the repo owner
07:50:12FromDiscord<Isofruit> Or whoever else reads the pr
07:51:08FromDiscord<evoalg> nice that makes life a little better then ๐Ÿ˜‰
07:51:40*jjido joined #nim
07:52:47FromDiscord<Isofruit> Sidenote, I recommend tiny commits and small pr's if other people are involved in the review process
07:55:36FromDiscord<evoalg> makes sense I guess yea
08:16:26FromDiscord<evoalg> I dunno who flywind is on git ... I dunno if they are on here but thank you
08:16:41FromDiscord<Elegantbeef> They're xflywind ๐Ÿ˜›
08:17:04FromDiscord<evoalg> ohhhh all good ๐Ÿ™‚
08:17:43szahidHello. Why i have 3 on output everytime? https://play.nim-lang.org/#ix=3MKd
08:17:46FromDiscord<Isofruit> They're literally the main person behind the prologue framework ๐Ÿ˜„
08:18:02*pch joined #nim
08:18:12FromDiscord<evoalg> oh shows how little I know
08:18:29FromDiscord<Elegantbeef> `randomize()` szahid
08:18:32FromDiscord<Elegantbeef> Otherwise it uses the default state
08:18:52FromDiscord<enthus1ast> 3 sound like a fair random number to me \:)
08:19:20FromDiscord<evoalg> some languages randomize by default, but not Nim though
08:19:49*xet7 quit (Ping timeout: 240 seconds)
08:21:01PMunch@Elegantbeef, yeah we rolled a dice and it came up 3, so that's the random number
08:21:20PMunchhttps://xkcd.com/221/
08:21:45szahidElegantbeef thanks!
08:21:51pchis there a fast way to truncate least significant bits without assuming endianness when working with integers? I need to truncate a 32-bit normalized position to 8 or 16 bits on the fly and store
08:22:25PMunchpch, well you can stop assuming endianness and check it?
08:23:38pchmore optimal would be to just have a truncate function that Knows:tm:
08:25:19PMunchWell it'd need to check as well
08:25:25PMunchSo someone has to check
08:25:52PMunchYou can divide the number by a power of two
08:25:57PMunchThat would truncate it
08:26:02pchyeah just asking if there's a built-in way that Knows
08:26:07pchtrue
08:26:21PMunchAnd probably be optimised away to a shift optimisation anyways
08:26:29FromDiscord<leorize> the only way to know is if someone told you, no?
08:26:54pchwell usually The Compiler Knows
08:27:03FromDiscord<leorize> no matter what the byte ordering is, the data is still correct
08:27:09pchthis is kinkinkijkin btw, working on a project i havent touched in years
08:28:26pchbit shift left on BE32 divides, on BE8 mangles
08:29:51FromDiscord<leorize> nim does let you know the endian at compile time, if you're working on native mumbers
08:30:28pchso just use `when` then...
08:30:32FromDiscord<leorize> but aren't native numbers always follow a constant shift pattern anyway?
08:30:58PMunchpch, pretty much, you can of course put that in a template or something
08:31:01pchpossibly? might change between compilers
08:31:23FromDiscord<leorize> ie. shift-left defined as shift torwards most significant bit and shift-right defined as shifting torwards least significant bit
08:32:43pchI know there's some wacky reactions you can get from some GCC versions on 32BE8 compiles
08:32:57pchie on armv7 with -mbe8
08:33:12*xet7 joined #nim
08:33:32PMunchhttps://stackoverflow.com/questions/7184789/does-bit-shift-depend-on-endianness
08:34:21pchah okay
08:39:48FromDiscord<Rika> So basically shifts arenโ€™t dependent on endianness unless youโ€™re on PowerPC?
08:40:07PMunchSeems like it :P
09:14:44*Vladar joined #nim
09:21:40*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
09:51:51*Gustavo6046 quit (Quit: Leaving)
10:48:23FromDiscord<dizzyliam> sent a code paste, see https://play.nim-lang.org/#ix=3MKG
10:48:30FromDiscord<dizzyliam> today in cursed things: code justified like text
10:51:59FromDiscord<congusbongus> No oooooโ†ตThis is why my favourite thing about golang is gofmt
11:03:39FromDiscord<Tanguy> gofmt is a dictatorship
11:04:17PMunch@dizzyliam, oh goodness gracious
11:05:08PMunch@congusbongus, no wonder you started looking into Nim if your favourite feature from Go is it's auto-formatter :P
11:07:02*Lord_Nightmare quit (Ping timeout: 240 seconds)
11:07:23FromDiscord<xx_ns> In reply to @karma_corrections "today in cursed things:": i kind of like it
11:07:33FromDiscord<xx_ns> I'll start formatting my code like this from now on
11:14:37FromDiscord<Rika> In reply to @Tanguy "gofmt is a dictatorship": Go
11:23:43FromDiscord<mratsim> And Github is punisshing tab users by displaying tabs as 8 spaces.
11:24:28FromDiscord<mratsim> like wtf: https://github.com/sel-hamr/42-fractol/blob/master/fractol.h
11:28:38PMunch@mratsim, Emacs-style code looks like a complete mess if you don't do that, and it doesn't really break anything for code that only uses tabs
11:29:33PMunchYou can also just chuck on ?ts=4 in the URL to change it: https://github.com/sel-hamr/42-fractol/blob/master/fractol.h?ts=4
11:29:56PMunchAnd there's probably a browser extension somewhere out there which applies that automatically for you
11:31:37FromDiscord<mratsim> TIL
11:31:50FromDiscord<mratsim> (I was looking for mandelbrot ;))
11:39:49PMunchBy the way, for those who might not know. It was (is?) common in Emacs to indent C code with four spaces, but replace every eight space with a tab. If you open up code written in this style in another editor it looks completely bonkers, and you start questioning the sanity of the author.
11:40:25PMunchHad a professor who wrote his pre-code in Emacs, and as his TA I had to answer all the angry emails from students wondering if the professor had gone mad
11:45:18FromDiscord<Rika> That sounds bonkers even with contextโ€ฆ
11:46:31szahidWhat is the correct way to use query parameters with httpClient? just add this to the url string?
11:47:53FromDiscord<Rika> Yes
11:48:56PMunch@Rika, well it used to be a thing that even code should save space
11:49:13szahidHello Rika :)
11:49:18PMunchI mean C still has trigraphs in order to support non-ASCII machines :P
11:49:20FromDiscord<Hamid_Bluri> sent a long message, see http://ix.io/3MKZ
11:49:30FromDiscord<Hamid_Bluri> wow
11:49:37FromDiscord<Rika> In reply to @szahid "Hello Rika :)": Hello, whatโ€™s up
11:49:42FromDiscord<Rika> In reply to @PMunch "<@259277943275126785>, well it used": Ah I see
11:49:53FromDiscord<Rika> In which case just use tabs for everything no?
11:49:55PMunchif (my_int == 42) ??( printf("Hello world %d", 42); ??)
11:49:59PMunchThat's valid C
11:50:18FromDiscord<Hamid_Bluri> ?????
11:50:27FromDiscord<Rika> Did you mean ??(
11:50:46FromDiscord<Hamid_Bluri> yeah what is it
11:51:00FromDiscord<Hamid_Bluri> trigraphs?
11:51:03PMunchWell if you have more than 5 levels of indentation you start saving again
11:51:13PMunchNot 100% sure why they did it that way though..
11:51:20FromDiscord<Rika> https://riptutorial.com/c/example/23858/trigraphs
11:51:23FromDiscord<Rika> Cursed
11:51:34PMunch@Hamid_Bluri, it's for machines that don't have 8-bit ASCII files
11:51:42FromDiscord<Rika> Imagine a world that wasnโ€™t standardisedโ€ฆ. Wait
11:52:11PMunchOh apparently it's ??< and not ??(
11:52:16FromDiscord<Rika> Yup
11:52:16PMunch??( is a square bracket
11:52:55FromDiscord<Rika> Youโ€™re a square bracket smh
11:53:09PMunchBy the way, trigraph replacement is one of the very first things the compiler does. Even before parsing. So it will replace them in string literals as well :P
11:53:24FromDiscord<Rika> I mean it should shouldnโ€™t it
11:53:34PMunchAlthough nowadays I think you actually have to pass a flag to GCC to enable it
11:53:47FromDiscord<Rika> Yes, -trigraphs I think
11:53:49PMunchOh yeah it's very much a feature
11:54:23PMunchBut it can be confusing if you write something like `printf("What happened??!");` and it prints out "What happened|"
12:00:15FromDiscord<Rika> Lol
12:46:45*NimBot joined #nim
12:47:16*nisstyre joined #nim
12:49:09szahidim looking for substitute python's list range ex. arr[2:5]
12:50:16szahidok. i have.. seq[2..5]
12:50:41FromDiscord<eyecon> Oooh, let me give the standard answer this time
12:50:49FromDiscord<eyecon> In reply to @szahid "im looking for substitute": Use slicerator: https://www.notion.so/ardasaltoglu/slicerator-f1693185839a403e8d167a81d8ee583d
12:51:06FromDiscord<eyecon> Use slicerator: https://github.com/beef331/slicerator
12:51:31FromDiscord<eyecon> Pasted a wrong link at first, sorry
12:54:24FromDiscord<Rika> Only if you want an iterator
12:54:41FromDiscord<Rika> It doesnโ€™t apply if you want a slice value I believe
13:02:39FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3MLF
13:03:34FromDiscord<mratsim> In reply to @szahid "ok. i have.. seq[2..5]": seq[2..<5]
13:30:02*Vladar quit (Quit: Leaving)
13:33:34*rockcavera joined #nim
13:33:34*rockcavera quit (Changing host)
13:33:34*rockcavera joined #nim
13:36:40NimEventerNew thread by GordonBGood: Update on compiling to asmjs or wasm through emscripten..., see https://forum.nim-lang.org/t/8827
13:47:13FromDiscord<Rika> In reply to @eyecon "Do you see any": Why not in [] you get or default (removes the var) and in []= you just do the same as []= for tables?
13:47:33FromDiscord<Rika> You already store the default value, why store it more times in the table?
13:47:47FromDiscord<Rika> Ah I can see why
13:48:49FromDiscord<Rika> Eh okay if you need the formerly accessed but not set keys okay
14:10:46NimEventerNew thread by Sauerbread: Privacy offensive - remove Google Analytics from the Nim website, see https://forum.nim-lang.org/t/8828
14:15:39FromDiscord<eyecon> In reply to @Rika "Eh okay if you": Thanks! Any comments/criticisms that still apply?
14:21:01FromDiscord<Rika> I donโ€™t think you can improve this other than using the same []= from tables in []=
14:21:28FromDiscord<Rika> Because you donโ€™t need to put the default before always putting a new value
14:26:01*Lord_Nightmare joined #nim
14:27:47FromDiscord<eyecon> I... don't get it. My use case is, if it helps, generally to have empty `seq`s in the table's unallocated keys so that I can add without checking and creating a new empty `seq`.
14:29:22FromDiscord<eyecon> Ah, do you mean that I overwrite the value from `mGetOrPut` in any case?
14:29:29FromDiscord<eyecon> If so, I think you are right
14:32:19FromDiscord<eyecon> So simply: `proc `[]=`[A, B](self: var DefaultTable[A, B], key: A, value: B) = self.table[key] = value`
14:33:22*nrds joined #nim
14:34:19FromDiscord<Rika> Yes
14:34:26FromDiscord<Rika> Thatโ€™s what I mean yes
14:34:27FromDiscord<IsaacPaul> In reply to @eyecon "Thanks! Any comments/criticisms that": > proc `[]`[A, B](self: var DefaultTable[A, B], key: A): var B =โ†ต> self.table.mgetOrPut(key, self.defaultvalue)โ†ตYou're lying to the developer. You're saying that there is a value at that key when there isn't.
14:34:40FromDiscord<Rika> In reply to @IsaacPaul "> proc `[]`*[A, B](self:": Thatโ€™s the point of the data structureโ€ฆ
14:35:18FromDiscord<IsaacPaul> I don't think you should lie to save a few keystrokes lol
14:35:25FromDiscord<Rika> Opinion
14:35:29FromDiscord<Rika> Not helpful in which case
14:35:44FromDiscord<eyecon> Lie? That's the whole point, to have values automatically created on access
14:35:56FromDiscord<eyecon> Besides, I'm not overwriting `contains`
14:36:18FromDiscord<eyecon> So key presence checks still fail for nonexistent keys
14:36:30FromDiscord<eyecon> I think at least, never needed them
14:36:54FromDiscord<Rika> I donโ€™t know what your point is
14:37:41FromDiscord<IsaacPaul> Honestly, the structure sounds problematic from a maintenance prospective. But I have no way to quantify my opinion besides experience ๐Ÿ˜›
14:38:14FromDiscord<Rika> I personally donโ€™t understand why they need it either but I wonโ€™t question it too hard
14:41:37FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3MMa
14:41:52FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3MMb
14:42:12FromDiscord<mratsim> or use array[char, int] ?
14:42:43FromDiscord<eyecon> But it's a pair of chars to int
14:42:53FromDiscord<mratsim> ah
14:43:04FromDiscord<mratsim> then array[uint16, int]
14:43:04FromDiscord<IsaacPaul> (edit) "https://play.nim-lang.org/#ix=3MMb" => "https://play.nim-lang.org/#ix=3MMc"
14:43:13FromDiscord<eyecon> That would have been possible, sure
14:43:25FromDiscord<eyecon> So, pre-allocate all combinations basically
14:43:48FromDiscord<eyecon> If the value type is not a primitive, like a seq, it gets more complicated
14:44:21*arkurious joined #nim
14:44:32FromDiscord<mratsim> array[uint16, seq[Something]]?
14:47:17FromDiscord<eyecon> Yes, and if the usage is sparse, then we are probably allocating some thousand times empty `seq`s in vain
14:47:26FromDiscord<eyecon> Not that it's impossible or bad, jut saying
14:47:35FromDiscord<eyecon> That is definitely an option
14:49:42FromDiscord<eyecon> Can I say something like Kotlin's "delegate all the unknown actions on this object to this field"?
14:50:38FromDiscord<eyecon> So that e.g. `items` on a `DefaultTable` automatically is applied to the `.table`?
14:51:46*Jjp137 joined #nim
14:53:37FromDiscord<Rika> No
14:53:42FromDiscord<Rika> Or rather
14:53:45FromDiscord<Rika> With a macro ๐Ÿ™‚
14:54:05FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3MMl
14:54:12FromDiscord<eyecon> I tend to take "no"s in this channel as "only with a macro" anyway
14:54:24FromDiscord<IsaacPaul> (edit) "https://play.nim-lang.org/#ix=3MMl" => "https://play.nim-lang.org/#ix=3MMm"
14:54:48FromDiscord<Rika> Do you want to distinguish no key from defaulted/accessed before anyway?
14:54:58FromDiscord<Rika> Do you have a reason to distinguish them
14:55:06FromDiscord<mratsim> In reply to @eyecon "Yes, and if the": they aren't allocated if they are uninitialized
14:55:22FromDiscord<Rika> In reply to @mratsim "they aren't allocated if": They arenโ€™t? Huh since when
14:55:32FromDiscord<eyecon> In the case I wrote about, yes, I did. I can imagine use cases where I wouldn't too
14:55:58FromDiscord<eyecon> So I implemented `.pairs` which would only iterate in previously set keys' values
14:56:07FromDiscord<eyecon> It works for my use case
14:56:12FromDiscord<mratsim> In reply to @Rika "They arenโ€™t? Huh since": a while, there is a check in add(s: var seq): to ensure a seq is allocated
14:56:17FromDiscord<Rika> Okay so in that case technically Option wouldnโ€™t help you
14:56:36FromDiscord<mratsim> and if not ia allocates one
14:56:42FromDiscord<mratsim> (edit) "ia" => "it"
14:57:04FromDiscord<Rika> In reply to @mratsim "a while, there is": But the default value is an empty seq? Do default values not have any allocations
14:57:28FromDiscord<IsaacPaul> In reply to @mratsim "they aren't allocated if": ๐Ÿ˜ฎ that's good to know
14:57:33FromDiscord<mratsim> it's ptr+len with a nil pointer
14:58:32FromDiscord<mratsim> https://github.com/nim-lang/Nim/blob/b24812df5f952427c1266e48c40b7956bdf3d999/lib/system/repr.nim#L163-L165
14:58:59FromDiscord<mratsim> so if unitialized you just need to check if len == 0
14:59:09FromDiscord<mratsim> and if so you check the pointer if it's nil
14:59:18FromDiscord<mratsim> and if yes, you allocate only at that point
15:00:20FromDiscord<Rika> I see
15:00:49FromDiscord<mratsim> easy to check, cast a array[16, byte] to seq[Foo] and add Foo
15:03:16FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=3MMH
15:03:50FromDiscord<mratsim> https://media.discordapp.net/attachments/371759389889003532/933376208954069092/unknown.png
15:04:11FromDiscord<mratsim> @eyecon ^
15:05:46FromDiscord<mratsim> https://media.discordapp.net/attachments/371759389889003532/933376695539478619/unknown.png
15:07:21FromDiscord<eyecon> I see, thanks
15:07:33FromDiscord<eyecon> So it's the `add` that allocates
15:07:46FromDiscord<xflywind> !eval echo (NimMajor, NimMinor, NimPatch)
15:07:47FromDiscord<demotomohiro> !eval var sq: seq[string]; echo cast[int](sq)
15:07:49NimBot(1, 4, 8)
15:07:50NimBot0
15:14:09*noeontheend joined #nim
15:41:37*noeontheend quit (Ping timeout: 240 seconds)
16:07:22FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MN3
16:23:45PMunchHmm, it seems like on of your runnable examples have caused an issue
16:23:53PMunchToo bad it doesn't say which one..
16:24:19PMunchOr is it because /usr/doc/nimdoc.css doesn't exist? That would be silly
16:27:06FromDiscord<Patitotective> Yea, `usr/doc/nimdoc.css` doesn't exist
16:37:11FromDiscord<leorize> this is expected if you install Nim through your distro package manager which packages nim according to the FHS
16:37:48FromDiscord<leorize> simply put\: the compiler is incompatible with Linux's FHS so packaging like that will break a feature or two
16:38:35PMunchIt is generally recommended to grab Nim via choosenim
16:39:31FromDiscord<Patitotective> I had a problem while installing _Nim_ because my pc is _old_, so Yardanico helped me to install _Nim_ manually
16:40:21FromDiscord<Patitotective> Maybe that's the problem
16:40:44FromDiscord<Patitotective> sent a code paste, see https://paste.rs/Opk
16:40:50FromDiscord<Rika> thats a dev version
16:40:51FromDiscord<Patitotective> (edit)
16:40:51FromDiscord<Rika> huh
16:42:08FromDiscord<Patitotective> Here are the message with Yardanico https://discord.com/channels/371759389889003530/753721959308853319/927965417094410251
16:44:22PMunchHmm, so where did you put Nim?
16:45:04PMunchDid you copy the binary anywhere?
16:45:27PMunchI think it looks for some files relative to its own location
16:45:59FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MNq
16:46:05FromDiscord<Patitotective> (edit)
16:46:07PMunchSo I'm guessing you moved it to /usr/bin/nim or something like that, and then it goes looking out of the bin folder, expecting to find the rest of the repository, but ending up in /usr
16:46:24PMunchYup, that's exactly what has happened
16:46:35FromDiscord<Patitotective> So should I reinstall _Nim_?
16:46:45PMunchNah I think we can hack this
16:46:51PMunchDo you still have nimble in the Nim repo folder?
16:47:34FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MNr
16:47:38FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3MNr" => "https://play.nim-lang.org/#ix=3MNs"
16:47:55FromDiscord<Patitotective> I guess I removed it, should I clone it again?
16:48:33PMunchAh, well then we're pretty much in the territory of a reinstall
16:48:45PMunchBut yeah, I guess that's the easiest solution
16:48:54PMunchBut the binary in .nimble is a shim I think
16:48:58PMunchIt just runs another program
16:50:53PMunchIf you run `strace ~/.nimble/bin/nimble --version 2>&1 | grep nimble` you should see the actual location of nimble
16:51:36FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MNt
16:51:40FromDiscord<Patitotective> (edit)
16:52:07FromDiscord<Patitotective> I already downloaded nim repo again, should I remove my current installation and run `install.sh`?
16:53:11PMunchHuh, that was actually the right nimble
16:53:22PMunchYeah I guess that's the best way of doing it
16:53:31PMunchWhich repo did you download though?
16:53:42PMunchYou probably want to grab the latest stable version
16:54:08FromDiscord<Patitotective> sent a long message, see http://ix.io/3MNy
16:54:12FromDiscord<Patitotective> wait
16:54:19FromDiscord<Patitotective> quite a long url
16:54:53FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MNz
16:55:21PMunchNah, that will run the same script that errored out for you
16:55:41FromDiscord<Patitotective> Then manually?
16:55:50PMunchGrab the one from here: https://github.com/nim-lang/Nim/releases/tag/v1.6.2
16:56:46PMunchYou should be able to just run the `build_all.sh` script from there
16:56:58PMunchAnd then go grab a cup of tea or something, might take a while
16:57:08FromDiscord<Patitotective> Without removing the actual installation?
16:57:17PMunchWell you should remove the current one first
16:57:22FromDiscord<Patitotective> how?
16:57:54PMunchTo be honest I'm not entirely sure how those files ended up where you have them
16:58:15PMunchDid you run some script to install Nim?
16:59:01FromDiscord<Patitotective> `install.sh`
16:59:13FromDiscord<Patitotective> let me see if `uninstall.sh` is in the trash lol
17:00:05FromDiscord<Patitotective> oh, it is called `deinstall.sh`
17:00:50PMunchRight, yeah run that
17:01:28FromDiscord<Patitotective> done, now im going to install _1.6.2_ and go grab a cup of tea
17:01:28FromDiscord<Patitotective> ๐Ÿ™ƒ
17:14:31PMunchIs it safe to have the same `const something {.strdefine.}` in two libraries, one which imports the other?
17:17:23FromDiscord<kevin> anyone know if there's a good DNS server Nim package? Can only find this https://github.com/rockcavera/nim-ndns which is a client ๐Ÿ˜ฆ
17:17:44FromDiscord<enthus1ast> no not that i'm aware of
17:17:53FromDiscord<enthus1ast> have worked on one, but got bored
17:18:53PMunchNone that I know of, but I've used Unbound with a Nim-written dynamic library with great success
17:19:14FromDiscord<enthus1ast> but dns got more complicated these days so maybe good idea to use production ready stuff
17:19:23FromDiscord<mratsim> In reply to @PMunch "Is it safe to": won't you have ambiguous identifier at call site?
17:19:56FromDiscord<mratsim> I'm surprised Carrier-Grade NAT didn't break just about everything.
17:20:12PMunchThey're not exported, so the module that imports it shouldn't be able to see that it was already put in a const
17:24:24FromDiscord<Patitotective> In reply to @Patitotective "done, now im going": It is done with `./build_all.sh`, what do I do now? just add `/usr/nim` to the path?
17:24:45FromDiscord<enthus1ast> i would use choosenim
17:25:00FromDiscord<enthus1ast> easy to change between versions
17:26:25FromDiscord<Patitotective> should I use choosenim? @PMunch or is it going to cause any error?
17:27:08PMunch@Patitotective, don't run choosenim
17:27:31PMunch@enthus1ast, his problem is that his CPU is too old, the pre-built versions doesn't have support for it
17:27:53PMunch@Patitotective, where did you download it?
17:28:22PMunchBasically you should now have a /bin folder
17:28:34PMunchAnd it should contain a working version of nim and nimble
17:28:36FromDiscord<enthus1ast> ic
17:29:04FromDiscord<Patitotective> In reply to @PMunch "Basically you should now": do i move that directory to `/usr/bin`
17:29:08PMunchSo if you just add that folder to your PATH (hopefully you didn't do all this in /tmp, but if you did just copy it somewhere else)
17:29:19PMunchNo, don't move it, that's what caused your original issue
17:29:31NimEventerNew thread by Chaemon: Bug of newSeqWith with Slice, see https://forum.nim-lang.org/t/8829
17:29:32PMunchYou need to add that directory to your PATH variable
17:29:39*pro joined #nim
17:29:51FromDiscord<Patitotective> Ok
17:37:06FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MNT
17:37:59FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3MNT" => "https://play.nim-lang.org/#ix=3MNU"
17:38:25FromDiscord<Patitotective> I added it to `~/.bashrc`
17:38:42FromDiscord<Patitotective> should i add it to `~/.profile`?
17:39:01PMunch`source .bashrc`
17:39:31PMunchIf you do `echo $PATH` you should see that it is there
17:39:44PMunchIf not you must run `source` or restart your terminal
17:44:18FromDiscord<Patitotective> ๐Ÿ˜• https://media.discordapp.net/attachments/371759389889003532/933416591411015770/Screenshot_from_2022-01-19_12-44-11.png
17:45:01PMunchYou have dots in the actual folder name, and dashes in the one in your path
17:45:21FromDiscord<Patitotective> oh
17:46:03FromDiscord<Patitotective> Thaaanks ๐Ÿ™ƒ
17:46:10FromDiscord<Patitotective> โค๏ธ
17:46:23*krux02 joined #nim
17:47:27PMunchNo problem :)
17:48:18PMunch@mratsim, apparently trying to use a `const something* {.strdefine.} = ""` in a `static: echo something` from a module that imports the one where it is defined doesn't work
17:48:24PMunchJust complains that it is `void`
17:57:52*jjido joined #nim
17:59:18*neurocyte0917090 joined #nim
18:00:23*vicecea quit (Remote host closed the connection)
18:00:52*vicecea joined #nim
18:05:39NimEventerNew thread by Nycto: Atomics: attempting to call undeclared routine: 'testAndSet', see https://forum.nim-lang.org/t/8830
18:06:10*Figworm quit (Quit: Figworm)
18:13:41NimEventerNew thread by Dbaron4: Libmysqlclient.so Not Found, see https://forum.nim-lang.org/t/8831
19:03:09*vicfred joined #nim
19:06:31*Figworm joined #nim
19:06:54*Figworm quit (Client Quit)
19:06:57*yassernasc joined #nim
19:08:29FromDiscord<sigkill> sent a long message, see http://ix.io/3MOo
19:08:51*Figworm joined #nim
19:11:56NimEventerNew thread by Jayv: Working with tables and strict funcs, see https://forum.nim-lang.org/t/8832
19:11:57PMunchEasy fix, use a nimble file
19:12:25PMunchNimLSP needs to find your project root, it has a couple different ways of doing this, one of which is the nimble file
19:14:29*rockcavera quit (Remote host closed the connection)
19:43:27*vicfred quit (Quit: Leaving)
19:52:59*greaser|q quit (Changing host)
19:52:59*greaser|q joined #nim
19:53:02*greaser|q is now known as GreaseMonkey
20:05:38FromDiscord<Patitotective> In the `runnableExamples` of my library, should I include `import library` or is it obsolete?
20:06:21PMunchIt should import the library it is defined in
20:16:17FromDiscord<Patitotective> Like
20:16:19FromDiscord<Patitotective> ?
20:16:22FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MOI
20:19:03*pro quit (Quit: WeeChat 3.4)
20:21:50PMunchYes, that should work I believe
20:29:15*yassernasc quit (Remote host closed the connection)
21:06:00*rockcavera joined #nim
21:06:00*rockcavera quit (Changing host)
21:06:00*rockcavera joined #nim
21:08:31*Gustavo6046 joined #nim
21:12:23*vicfred joined #nim
21:43:35*PMunch quit (Quit: leaving)
21:43:37arkanoidIs there a good example of C++ OOP wrapping in nim that works with arc?
21:45:27arkanoidme and the author of nimqml are trying to figure out a solution to port code to arc. The current design works with refc but doesn't work with arc without breaking backward compatibility
22:21:59FromDiscord<ynfle> Can `staticRead` be given relative paths
22:22:01FromDiscord<ynfle> (edit) "paths" => "paths?"
22:25:43FromDiscord<exelotl> yeah, relative to the file in which the staticRead occurs
22:33:33FromDiscord<ynfle> In reply to @exelotl "yeah, relative to the": Does it also respecte `~` for home dir?
22:34:11FromDiscord<exelotl> nope, that's a feature of the shell
22:34:49FromDiscord<ynfle> In reply to @exelotl "nope, that's a feature": Is there a way to simulate that?
22:35:31FromDiscord<exelotl> maybe you could do `staticRead(getEnv("HOME") & "/path/to/my_file.txt")`
22:36:00FromDiscord<exelotl> but that will only work if `getEnv` from the `os` module is allowed to be used at compile-time
22:38:37FromDiscord<exelotl> also it's not exactly a cross-platform solution, for example on windows it would be `getEnv("HOMEDRIVE") & getEnv("HOMEPATH")`
22:38:53FromDiscord<exelotl> I think
22:41:07FromDiscord<congusbongus> `getenv("AppData")` in windows
22:43:04*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
23:01:30*jjido joined #nim
23:02:07arkanoidwhat really is an empty object? https://play.nim-lang.org/#ix=3MPV ?
23:02:17arkanoidwhat's inside that byte?
23:03:41FromDiscord<IsaacPaul> maybe `expandTilde` works ๐Ÿคทโ€โ™‚๏ธ
23:04:24FromDiscord<Elegantbeef> I think it's just a case of "that's the min size of any object"
23:04:48*jjido quit (Client Quit)
23:04:52FromDiscord<Elegantbeef> `dump cast[ptr byte](td.unsafeAddr)[]` will return `0` which makes sense
23:10:40FromDiscord<Elegantbeef> If you're after a 0 sized type `void`
23:12:48arkanoidnull pointer is pointing to non null data?
23:13:13arkanoidI mean, I'm reading the first byte of that min object on stack as int
23:13:57FromDiscord<Elegantbeef> Eh there might be compiler issues to why that doesnt work
23:14:25FromDiscord<Elegantbeef> You should be doing `cast[byte]` eitherway
23:14:31FromDiscord<Elegantbeef> and it's still `0`
23:15:10FromDiscord<Elegantbeef> There is 0 reason to use an empty object in Nim so this is like the most edge casey odd bug
23:18:30FromDiscord<Elegantbeef> Atleast i dont think there is, could be wrong
23:23:16arkanoidsure, I'm dealing with metaphysics
23:23:53arkanoidyou're right, if I cast to byte I get zero
23:24:03arkanoidcurios why I'm getting weird int
23:24:16FromDiscord<Elegantbeef> Cause you're reading memory after the byte
23:25:58FromDiscord<Elegantbeef> Atleast I think
23:26:16FromDiscord<Elegantbeef> That metaphysics statement was a joke right? ๐Ÿ™‚
23:26:45arkanoidsure it is
23:26:51arkanoidit it possible to deal with it anyway?
23:27:20arkanoiddamn, int is 8 bytes
23:27:28arkanoidI need a coffee
23:27:33FromDiscord<Elegantbeef> Totally you pretend it doesnt exist and supress thought of it
23:27:37FromDiscord<Elegantbeef> Int is 8 bytes
23:27:50arkanoidyeah, was doing silly mistake
23:27:53arkanoidnot it makes esne
23:27:55arkanoidsense
23:29:09*Gustavo6046 quit (Remote host closed the connection)
23:39:32*Gustavo6046 joined #nim
23:57:53nrds<Prestige99> @Elegantbeef finally getting around to concepts. Is there a way to create a concept that I could "apply" to multiple types? I need to find some documentation on this..
23:58:11FromDiscord<Elegantbeef> elaborate on "apply"
23:58:35nrds<Prestige99> like I want multiple types to have a function named getBounds that returns a Rectangle
23:58:57nrds<Prestige99> and I want to be able to refer to this concept in a file that takes an object that has getBounds
23:59:13FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MQh
23:59:27FromDiscord<Elegantbeef> Then your proc would be `proc doThing(b: BoundObject)`
23:59:44nrds<Prestige99> So say I want a new Foo type that is also a BoundObject?