<< 08-10-2023 >>

03:18:50*rockcavera quit (Remote host closed the connection)
03:51:10FromDiscord<sOkam! 🫐> how do you define a multiline string without `\n` added to them?
03:52:25FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Irb
03:53:19FromDiscord<odexine> if that's so why do you need them to be multiline
03:53:34FromDiscord<sOkam! 🫐> In reply to @odexine "if that's so why": for clarity
03:53:42FromDiscord<sOkam! 🫐> of the data written in the code
03:53:59FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#ix=4Irc
03:54:10FromDiscord<sOkam! 🫐> is there an alternative without `&`?
03:54:13FromDiscord<odexine> no
03:54:28FromDiscord<sOkam! 🫐> 😔
03:54:37FromDiscord<odexine> if you want you can use regular multilines and remove the newlines with some proc
03:54:53FromDiscord<odexine> which will remove all newlines even if it is explicitly added
03:55:18FromDiscord<sOkam! 🫐> asking because its for minc codegen, so i don't have string tools or anything, and my multiline becomes \n like nim's one
03:55:58FromDiscord<odexine> if it's not nim then just make an extra syntax to denote that newlines arent added
03:56:36FromDiscord<sOkam! 🫐> yeah that's what i was thinking
04:03:40FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Ire
04:04:22FromDiscord<sOkam! 🫐> and `"""` strings cannot be `r` either
04:19:56NimEventerNew post on r/nim by qtless: HappyX And NodeJS, see https://reddit.com/r/nim/comments/172py9b/happyx_and_nodejs/
04:38:38FromDiscord<leorize> wdym? \`"""\` strings can \_only\_ be \`r\`↵(@sOkam! 🫐)
04:39:21FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Irl
04:39:21FromDiscord<Elegantbeef> Where it doesnt add any newlines
04:39:29FromDiscord<Elegantbeef> Might be without commas in C, don't recall it's awful
04:39:38FromDiscord<leorize> no commas in C, yea
04:44:19FromDiscord<sOkam! 🫐> Seems like `nkCallStrLit` is a thing, triggered by `somename"...."` and works for `"""`... so, awesome! easy to check
05:09:27FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Irs
05:09:51FromDiscord<sOkam! 🫐> it does have some uses in regular nim too, right?↵What does it change exactly? 🤔
05:12:31FromDiscord<sOkam! 🫐> like doing `echo"thing"` compared to `echo "thing"`.... is there any differences, other than ignoring the next thing after the second `"`
05:12:51FromDiscord<Elegantbeef> It turns it into a raw string
05:13:04FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#lexical-analysis-generalized-raw-string-literals
05:23:44FromDiscord<xtrayambak> sent a code paste, see https://play.nim-lang.org/#ix=4IrB
07:04:30FromDiscord<luxurymode> sent a code paste, see https://play.nim-lang.org/#ix=4IrL
07:08:37FromDiscord<Elegantbeef> Yea in the case of mismatch due to `var` it should be explicit about it
07:10:02FromDiscord<Elegantbeef> PRs possibly welcomed
07:46:09FromDiscord<Phil> Question:↵What risks am I exposing myself to by capturing a pointer to a value type?
07:46:30FromDiscord<Elegantbeef> Dangling pointers
07:47:57FromDiscord<Phil> Mostly wondering because in an owlkettle widget, you know that your `AppState` instance is around forever.↵So say AppState has a field of type int.↵If you have a pointer to that and you know AppState is never getting free'd, is there actually a risk?
07:48:35FromDiscord<Elegantbeef> No
07:50:07FromDiscord<Phil> Facepalm moment↵I just realized I had an entirely wrong mental model of memory regarding ref-types that contain value-types and didn't even notice and that made absolutely no sense
07:50:33FromDiscord<Elegantbeef> I mentioned multiple times lifetime matters for ptr
07:50:36FromDiscord<Phil> Somehow my brain concocted together that the ref-type is stored in heap and if it has a value-type field that somehow gets stored in stack.
07:50:51FromDiscord<Phil> Which makes around 0 sense.
07:51:07FromDiscord<Elegantbeef> Right that seems to be a common mistake
07:51:41FromDiscord<Phil> I don't even know how I got to that model, I guess it's just "if value-type = stack" applied to fields
07:52:13FromDiscord<Phil> So getting pointers to that, while still cursed, in a controlled environment seems okay
07:52:33FromDiscord<Elegantbeef> Yea it's a misconception caused by the phrase "values are stack allocated"
07:53:04FromDiscord<Elegantbeef> Should be 'value types can be stack allocated'
07:53:47FromDiscord<Phil> "Value-types that are at the top-level and not fields of other types are stack allocated" doesn't roll of the tongue that smoothly
07:54:09FromDiscord<Phil> Well, I guess not even top-level is correct here as that word is taken up by talking about scope levels
07:54:54FromDiscord<Elegantbeef> Top level's not even true 😛
07:55:54FromDiscord<Phil> ?↵I meant basically "If your value type is not a field of anything else, it will guaranteed be stack allocated", is that wrong?
07:56:06FromDiscord<Elegantbeef> Yes
07:56:21FromDiscord<Phil> Because of `new(ValueType)`?
07:56:37FromDiscord<Elegantbeef> No, cause you can put data in static memory
07:57:35FromDiscord<Phil> Static memory is a new word in my vocabulary, does that refer to the memory where static proc definitions and const values are stored?
07:58:17FromDiscord<Elegantbeef> Though I don't recall if `{.global.}` actually is `static` in C
07:58:17FromDiscord<Elegantbeef> Taking the address of a static allocated type is always safe as it's practically a program globaal
07:58:47FromDiscord<Elegantbeef> It'll never be reallocated and is always accessible
08:00:18FromDiscord<Phil> For discord user reference:↵The bridge ate a line from beef:↵> No, cause you can put data in static memory
08:01:32FromDiscord<Phil> What things get put in static memory? ↵I assume it's not everything at top level
08:02:12FromDiscord<Elegantbeef> It should be all toplevel any `{.global.}`
08:02:21FromDiscord<Elegantbeef> I don't know what Nim exactly puts in static memory
08:02:32FromDiscord<Elegantbeef> I was just being needlessly pedantic
08:07:15*azimut quit (Ping timeout: 252 seconds)
08:39:56*rockcavera joined #nim
09:24:02FromDiscord<ebahie> sent a code paste, see https://play.nim-lang.org/#ix=4Is3
09:25:25FromDiscord<ebahie> sent a code paste, see https://play.nim-lang.org/#ix=4Is4
09:35:51*jkl quit (Quit: Gone.)
09:45:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Is7
09:46:20FromDiscord<Phil> It'll return the last expression of "block" as the value for the if-statement
09:48:20FromDiscord<ebahie> but how would i reference token as the content of tokenFile in writeFile?
09:48:25FromDiscord<ebahie> (edit) "but how would i ... reference" added "be able"
09:48:28FromDiscord<ebahie> (edit) "but how would i be able ... reference" added "to"
09:49:56FromDiscord<ebahie> because doing `writeFile(tokenFile, token)` within `let token` does not work
09:50:24*jkl joined #nim
10:01:50FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Isa
10:02:21FromDiscord<Phil> You're after the value of input, not after what's in token, no?
10:02:36FromDiscord<Phil> (edit) "after what's in token," => "necessarily the token variable itself,"
10:04:16FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Isb
10:05:03FromDiscord<Phil> Note though if you're writing an if-statement this complex you're (for readabilities sake) better served just writing a proc "getToken" or something like it
10:06:38FromDiscord<hotdog6666> sent a code paste, see https://play.nim-lang.org/#ix=4Isc
10:07:20FromDiscord<Phil> Hm, could've sworn I had syntax issues last time I tried this kind of thing without block, 🤷 oh well.↵TIL
10:12:18FromDiscord<hotdog6666> In reply to @isofruit "Hm, could've sworn I": Not sure about that, maybe a nesting issue?
10:12:25FromDiscord<hotdog6666> How's your webdev stuff going these days?
10:22:22FromDiscord<kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4Isg
10:27:21*junaid_ joined #nim
10:49:48FromDiscord<hotdog6666> In reply to @kcvinker5420 "I am using my": You can qualify usages of WPARAM by adding the module like the error says, or exclude it from the import of one of the modules
10:50:28FromDiscord<kcvinker5420> In reply to @hotdog6666 "You can qualify usages": My gui lib is independent from winim.
10:50:42FromDiscord<kcvinker5420> So I cannot use any data types from winim.
10:50:50FromDiscord<kcvinker5420> I just want to use the com module
10:51:32FromDiscord<hotdog6666> In reply to @kcvinker5420 "My gui lib is": But you are importing winim?
10:51:48FromDiscord<kcvinker5420> In reply to @hotdog6666 "But you are importing": Just for com module
10:51:56FromDiscord<hotdog6666> I’m not sure what you are trying to do. Can you paste the actual code?
10:51:59FromDiscord<kcvinker5420> I don't want any other stuff from winim
10:52:35FromDiscord<kcvinker5420> I am sorry, I cannot paste the complete code. But I can paste the import statements
10:55:33FromDiscord<hotdog6666> Ok just try the two options I pasted above
10:57:49*PMunch joined #nim
11:00:39FromDiscord<kcvinker5420> In reply to @hotdog6666 "Ok just try the": All win32 datatypes are declared in my gui library. The same types are declared in winim library. I cannot depend winim for data types. I only need the com module. So I think making com related code a separate program is the best idea. I can start it from my program and collect the output from it's stdout
11:26:41NimEventerNew thread by askodev: Type mismatch on Future's, see https://forum.nim-lang.org/t/10537
11:36:51*junaid_ quit (Quit: leaving)
11:41:24*junaid_ joined #nim
11:46:12*krux02 joined #nim
11:50:47*junaid_ quit (Remote host closed the connection)
12:26:34arkanoidwhat does it mean to have type Foo = distinct object" ?
12:27:51FromDiscord<Phil> Hmm only thing I could think of is that Foo no longer applies to generics defined for object
12:28:13FromDiscord<Phil> Which includes iterators such as fieldPairs and a fair amount of other procs
12:28:28FromDiscord<Phil> (edit) "Which includes iterators such as fieldPairs ... and" added "(I think?)"
12:28:56arkanoiddo you think imported objects here should really be distinct object? https://github.com/guzba/nimsimd/blob/master/src/nimsimd/neon.nim
12:29:09FromDiscord<Phil> that is SIMD, I'm out
12:30:43FromDiscord<Phil> Wait, that repo does not contain "distinct" anywhere in the codebase
13:04:43*junaid_ joined #nim
14:47:57*junaid_ quit (Remote host closed the connection)
15:06:59FromDiscord<treeform> SIMD is different from usual programming ... it requires its own paradigm.
15:35:30FromDiscord<fakecrafter> sent a code paste, see https://play.nim-lang.org/#ix=4Ity
15:35:56FromDiscord<fakecrafter> (edit) "https://play.nim-lang.org/#ix=4Ity" => "https://play.nim-lang.org/#ix=4Itz"
15:38:04FromDiscord<odexine> integers do not have a representation for infinity, you will have to settle for "maximum integer" which is `int.high` IIRC
15:39:09FromDiscord<fakecrafter> ok↵thx
15:44:27FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ItB
15:45:24FromDiscord<Phil> Because currently this task fails complaining that nimibook doesn't exist.↵When I compile with `nim c -d:release --mm:refc nbook.nim` directly in my terminal it works.↵So exec is also caught in the nimble execution context or sth?
15:59:08*rockcavera quit (Ping timeout: 255 seconds)
15:59:10FromDiscord<kcvinker5420> I want to use `startProcess` function from `asynctools/asyncproc`. But I don't know how to get the out from AsyncProcess in both realtime and after the process exits. I need to know both ways.
15:59:35FromDiscord<kcvinker5420> (edit) "out" => "output"
16:04:19*rockcavera joined #nim
16:04:19*rockcavera quit (Changing host)
16:04:19*rockcavera joined #nim
16:05:03*junaid_ joined #nim
16:07:53*def- quit (Quit: -)
16:08:35*def- joined #nim
16:09:32FromDiscord<kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4ItI
16:34:14*azimut joined #nim
16:39:12*junaid_ quit (Remote host closed the connection)
16:45:13*junaid_ joined #nim
17:25:50FromDiscord<hotdog6666> In reply to @isofruit "Because currently this task": Yeah it needs to be required in your nimble file if it is compiled via a nimble task I think
17:26:37FromDiscord<Phil> In reply to @hotdog6666 "Yeah it needs to": I was expected that for compile commands executed in the nim context via nimble.↵I didn't expect that to also apply to compiles via `exec`
17:27:29FromDiscord<Phil> That was the thing that was confusing me.↵Either way though, the main problem appears to have been that I had a nimbledeps folder that was forcing some things that usually are pulled from a global context to be local
17:47:52*junaid_ quit (Remote host closed the connection)
18:29:45*junaid_ joined #nim
18:33:50*junaid_ quit (Remote host closed the connection)
19:44:01*PMunch quit (Quit: leaving)
20:01:36FromDiscord<kcvinker5420> How to construct a `Path` from a string
20:03:08Amun-RaPath("string")
20:08:22*azimut quit (Remote host closed the connection)
20:08:31FromDiscord<demotomohiro> It is same to calling a proc with string.↵So `Path "string"`, `Path"string"` and `"string".Path` works
20:08:47*azimut joined #nim
20:14:24FromDiscord<kcvinker5420> Thanks
20:20:17FromDiscord<kcvinker5420> Which module should I import to use Path ? `std/paths` shows an error
20:28:45Amun-Rastd/paths
20:29:00Amun-Raunless you're using older nim
20:31:20FromDiscord<kcvinker5420> I am using
20:31:29FromDiscord<kcvinker5420> (edit) "I am using ... " added "1"
20:31:39FromDiscord<kcvinker5420> (edit) "1" => "1.6.2"
20:36:40FromDiscord<Elegantbeef> Paths is only 2.0
20:41:05Amun-Rasad thing is debian still ships nim 1.6
20:42:21FromDiscord<Elegantbeef> A lot of people oddly still use 1.6.12
20:42:55Amun-RaI'm on sid/unstable and it's still 1.6.14
20:43:20Amun-Raso I have my own in /opt
20:43:32FromDiscord<Elegantbeef> Atleast it's the newest 1.6
20:59:51FromDiscord<nasuray> In reply to @isofruit "I was expected that": Have you tried setting this up with `taskRequires`?
21:13:39*lucasta joined #nim
21:29:20*incal joined #nim
21:29:58incalo/ is there an example of a simple 2D game, e.g. snake or whatever, that I can try compile and run? TIA
21:30:42incalI did google but only found libraries and people asking the same question ...
21:31:09Amun-Rayou can find an example for SDL2 and port it to nim + sdl2
21:31:46Amun-Ra(I know that's not exactly what you have in mind…)
21:32:05incalbut surely someone wrote a game for nim already? like a pong or space invaders clone or whatever
21:32:41FromDiscord<kcvinker5420> In reply to @Elegantbeef "Paths is only 2.0": Thanks
21:33:11Amun-Raincal: https://github.com/dom96/snake
21:33:12incalI read the declaration of purpose, speed of C, devel speed of Python and modularity of List, that sounds like something I'd like
21:33:37incalah, thank, trying
21:34:23incalI got the compiler from the Debian repos and found a major-mode in MELPA so should be all set
21:37:01incalhm, it's a game for the web browser, maybe there is some simpler still to be run locally
21:47:59FromDiscord<luxurymode> sent a long message, see http://ix.io/4Iv2
21:48:56FromDiscord<Elegantbeef> There is not much more to it to be frank
21:50:13FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html#procedures-forward-declarations
21:50:13FromDiscord<Elegantbeef> also covers it
21:50:31FromDiscord<luxurymode> Ah, that's it. That's all I was looking for. Thank you
21:52:35incalgot it, looks clean
21:53:02incalmaybe not a minimal project but the author didn't have me in mind LOL
22:16:14*incal left #nim (ERC 5.6-git (IRC client for GNU Emacs 30.0.50))
22:21:22arkanoidcan defined(FOO) be used in nimble tasks? calling it with nimble mytask -d:FOO, or nimble -d:FOO mytask
22:25:06NimEventerNew thread by brainproxy: Learning Nim: Write an Interpreter [Episode 01], see https://forum.nim-lang.org/t/10538
22:25:53FromDiscord<Elegantbeef> Someone really likes their internet points 😄
22:26:24FromDiscord<michaelb.eth> just hadn't seen it shared there yet ¯\_(ツ)_/¯
22:27:21FromDiscord<Elegantbeef> I kid, I just see you sharing a lot of Nim related stuff on hackernews
23:03:26*lucasta quit (Quit: Leaving)
23:13:08FromDiscord<.aingel.> The more the better!
23:36:36NimEventerNew post on r/nim by Uwu_Uwu135: How to use nim for p2p, see https://reddit.com/r/nim/comments/173defc/how_to_use_nim_for_p2p/
23:51:35*krux02 quit (Remote host closed the connection)