<< 05-04-2021 >>

00:01:54FromDiscord<garett> hello all. I just finished a first draft of a Nim macro that converts Nim source code into GLSL. So far it just generates vertex and fragment shader code as strings, still working on making it generate an object initializer with the shader code strings and the necessary reflection info for uniforms and attributes
00:03:53FromDiscord<garett> Also made PRs to https://github.com/floooh/sokol-nim to update it to latest changes to sokol, making it possible to write simple graphical apps using OpenGL, D3D11, or Metal on Linux, Windows, and macOS
00:06:19FromDiscord<garett> I have a question. When I'm compiling the `sokol-nim` examples, I have to specify `--noMain`, because `sokol/app` implements the platform-specific entry point, then calls `NimMain`. I want to know whether it is possible to put the `--noMain` compiler switch in a `.nims` file so that when the main module depends on the module that implements the entry point, it will also automatically get the `--noMain` compiler switch
00:07:05FromDiscord<garett> It is not clear to me whether the `.nims` file for an imported module can add a compiler switch.
00:09:09FromDiscord<garett> In this case, let's say I'm compiling `nim c -r cube.nim`, where `cube.nim` is one of the examples that imports `main.nim`, which is another example module that implements the entry point required by the `sokol/app` module. Can `main.nims` introduce `--noMain` so that when I compile `cube.nim`, I don't have to type `nim c -r --noMain cube.nim`?
00:15:11PMunchYes
00:15:37PMunchDon't remember how, I think it's something like `switch(noMain)`
00:15:42PMunchAnayways, I'm off to bed
00:15:43*PMunch quit (Quit: leaving)
00:28:57*dgb_ quit (Quit: WeeChat 2.7.1)
00:29:11*dgb joined #nim
00:31:11FromDiscord<garett> either `switch("noMain")` or `--noMain` works if I put it in `cube.nims`, but has no effect if I put it in `main.nims`
00:38:55*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:39:15*njoseph joined #nim
00:43:10FromDiscord<ITS_N1GH7OWL> Hey there! So general question
00:43:29FromDiscord<ITS_N1GH7OWL> Am going into him, and I saw that it has the no gc option
00:43:39FromDiscord<ITS_N1GH7OWL> But I can’t find anything on freeing that memory..?
00:43:44FromDiscord<ITS_N1GH7OWL> Am I missing something orrrr
00:44:54*Fish-Face joined #nim
00:45:35Fish-FaceHello, I seem to have run into this bug https://github.com/nim-lang/Nim/issues/14873 but the "workaround" does not make sense and as far as I can tell in my case, does not work. Is any more known about this?
00:47:51FromDiscord<ITS_N1GH7OWL> --gc:none or does it just- never free anything literally
00:48:01FromDiscord<ITS_N1GH7OWL> There has to be some sort of manual control I’m missing 😅
01:06:21FromDiscord<ElegantBeef> you have to manuall dealloc with `none`
01:06:31FromDiscord<ElegantBeef> the is `alloc` `realloc` and `dealloc`
01:06:35FromDiscord<ElegantBeef> (edit) "the" => "there"
01:06:39FromDiscord<ElegantBeef> @ITS_N1GH7OWL ^
01:07:11FromDiscord<ITS_N1GH7OWL> Ohhhh thank you 😃
01:09:14FromDiscord<ITS_N1GH7OWL> @ElegantBeef just another question since I really don’t understand the underworkings of nim
01:09:34FromDiscord<ITS_N1GH7OWL> But a package built to use a gc would not work with no gc mode, correct?
01:10:57FromDiscord<ElegantBeef> Well it work but not free anything
01:11:51FromDiscord<ITS_N1GH7OWL> So for cases like that, it would be recommended to use arc mode for full performance?
01:11:54FromDiscord<ElegantBeef> With ARC/ORC there is very little reason to use gc:none
01:12:39FromDiscord<ITS_N1GH7OWL> Ohhh okay
01:13:03FromDiscord<ITS_N1GH7OWL> I’ll definitely do some benchmarking tonight, as I’m trying to build a heavily optimized minecraft Java based server and come from a C background
01:13:16FromDiscord<ElegantBeef> Arc is perfectly capable for running on embedded
01:13:17FromDiscord<ITS_N1GH7OWL> And well obviously building it in C would be idiotic syntax wise
01:13:33FromDiscord<ElegantBeef> So the overhead is clearly not a large amount 😄
01:13:48FromDiscord<ElegantBeef> If you want low latency you use arc, if you want high through put you checkout the GCs
01:14:14FromDiscord<ITS_N1GH7OWL> Okay I’ll definitely give arc a go! Thanks you!
01:14:36FromDiscord<ElegantBeef> Explains arc if you want to read about it/dont know what scope based memory management means https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html
01:15:26FromDiscord<ElegantBeef> Talks about the actual performance and where to use Orc https://nim-lang.org/blog/2020/12/08/introducing-orc.html
01:16:04FromDiscord<ITS_N1GH7OWL> I’ll definitely take a read into it now
01:20:17*NimBot joined #nim
01:45:50*beshr quit (Ping timeout: 268 seconds)
01:46:32*beshr joined #nim
01:49:55FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2V4O
01:50:13FromDiscord<mattrb> (edit) "https://play.nim-lang.org/#ix=2V4O" => "https://play.nim-lang.org/#ix=2V4P"
01:50:21FromDiscord<mattrb> I just don't want to put big `or` chains in the body of code
01:50:43*kwilczynski quit (Ping timeout: 250 seconds)
01:50:43*robertmeta quit (Ping timeout: 250 seconds)
01:51:03*fowl quit (Ping timeout: 258 seconds)
01:52:32*wasted_youth2 quit (Quit: Leaving)
01:55:19FromDiscord<ElegantBeef> Bitsets!
01:55:29FromDiscord<Rika> const ArithOps = {sub, rsb,... }
01:55:44FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2V4R
01:55:48FromDiscord<ElegantBeef> then you can just do that
01:55:52FromDiscord<Rika> You use in then in this case and not is
01:56:27*kwilczynski joined #nim
01:56:34*fowl joined #nim
01:56:38*robertmeta joined #nim
01:56:51FromDiscord<mattrb> Perfect, thank you!
02:41:14*shashlick left #nim ("Leaving")
02:41:15*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
02:41:34*Gustavo6046 joined #nim
03:05:41*rockcavera quit (Remote host closed the connection)
03:19:52*beenz joined #nim
03:32:57*spiderstew_ joined #nim
03:35:43*spiderstew quit (Ping timeout: 260 seconds)
03:37:23*waleee-cl quit (Quit: Connection closed for inactivity)
03:55:10ForumUpdaterBotNew thread by Xioren: Get size of block device?, see https://forum.nim-lang.org/t/7746
03:59:58*vicfred quit (Quit: Leaving)
04:01:59*vicfred joined #nim
04:58:36*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
04:58:45*njoseph joined #nim
05:15:40*sz0 joined #nim
06:12:53*teal joined #nim
06:37:27*teal quit (Quit: WeeChat 3.1)
07:59:22*Vladar joined #nim
08:41:23FromDiscord<sealmove> how to check if a string contains only valid ASCII chars?
08:43:14FromDiscord<Unaimend> https://nim-lang.org/docs/strutils.html
08:43:30FromDiscord<Unaimend> https://nim-lang.org/docs/strutils.html#isAlphaAscii%2Cchar
08:45:00FromDiscord<Unaimend> In reply to @รєคɭ๓๏שє "how to check if": https://nim-lang.org/docs/strutils.html↵https://nim-lang.org/docs/strutils.html#isAlphaAscii%2Cchar
08:46:26FromDiscord<sealmove> but I want spaced and other stuff too
08:46:59FromDiscord<sealmove> (edit) "spaced" => "spaces"
08:48:32FromDiscord<ElegantBeef> `str.contains(yourSet)`
08:48:40FromDiscord<ElegantBeef> Ah sorry `only`
08:49:01*sz0 quit (Quit: Connection closed for inactivity)
08:49:48FromDiscord<ElegantBeef> Guess you'd need your own impl then
08:50:01FromDiscord<ElegantBeef> Good reference https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/strutils.nim#L2389
08:51:03FromDiscord<Unaimend> Not sure if which data types the stuff it string utils are but if they are sets just unite them
08:51:08FromDiscord<sealmove> thx ElegantBeef
08:51:16FromDiscord<ElegantBeef> They's sets so you can just `a + b`
08:51:26FromDiscord<ElegantBeef> Or `{a, b}` iirc
08:51:42FromDiscord<Unaimend> so it just be easy to just compose the base sets
08:51:58FromDiscord<ElegantBeef> Wonder if we need a `matches(a: string, c: set[char])`
08:52:28FromDiscord<Unaimend> In reply to @รєคɭ๓๏שє "thx ElegantBeef": i.e. str.contains(whitespace + letters)
08:52:41FromDiscord<ElegantBeef> they said "only"
08:52:48FromDiscord<Unaimend> In reply to @ElegantBeef "Wonder if we need": but we have `contains(s: string; chars: set[char]):`
08:53:07FromDiscord<ElegantBeef> matches would return true if all chars in the string are in the set
08:53:10FromDiscord<sealmove> In reply to @Unaimend "but we have `contains(s:": we do?.
08:53:19FromDiscord<ElegantBeef> yes it's in strutils
08:53:27FromDiscord<sealmove> ah ok but yes, it means different thing
08:53:49FromDiscord<Unaimend> yeah, did not get what you mean by only, sry
08:54:07FromDiscord<Unaimend> yeah
08:54:21FromDiscord<ElegantBeef> But yea might need a matches in the stdlib for set of chars since it's fairly common
08:54:21FromDiscord<Unaimend> should have read your requirement more carefully
08:54:52FromDiscord<Unaimend> that would be a good first issues for beginners
08:55:01FromDiscord<Unaimend> In reply to @ElegantBeef "But yea might need": that would be a good first issues for beginners
08:55:50FromDiscord<ElegantBeef> I suppose, but it takes me about 30 minutes so if a beginner wants to they best do it by tomorrow 😉
08:57:22FromDiscord<ElegantBeef> I tend to add things to the stdlib when they seem semi important so i'm a terrible person to suggest that it's a good first issue to 😛
08:57:59FromDiscord<Unaimend> 😂 picking all the low hanging fruits of the tree
08:58:33FromDiscord<ElegantBeef> Hey take that back scantuple is fantastic
08:59:11FromDiscord<ElegantBeef> I've also fixed embedded vm issues!
08:59:19FromDiscord<Unaimend> In reply to @ElegantBeef "Hey take that back": whats scantuple, have not heard of it
08:59:38FromDiscord<ElegantBeef> https://nim-lang.github.io/Nim/strscans.html#scanTuple.m%2Cuntyped%2Cstatic%5Bstring%5D%2Cvarargs%5Buntyped%5D
08:59:59FromDiscord<ElegantBeef> scanf but it creates variables and returns them in a tuple
09:00:08FromDiscord<Unaimend> In reply to @ElegantBeef "scanf but it creates": pretty nice
09:00:08*Stephen[m]1 quit (Quit: Idle for 30+ days)
09:00:13FromDiscord<ElegantBeef> Thanks mom!
09:00:36FromDiscord<Unaimend> In reply to @ElegantBeef "I've also fixed embedded": not bad, thas way above my nim knowledge
09:00:48FromDiscord<ElegantBeef> I mean they were both like 3 line changes
09:00:59FromDiscord<ElegantBeef> One was a single line
09:01:16FromDiscord<ElegantBeef> Just had to reset the vm iteration count on a function call from compiled code
09:01:31Oddmongeri'm reading Salewski's book, and at the end there are « strange questions » (without answer alas): http://ssalewski.de/nimprogramming.html#_strange_questions
09:01:50FromDiscord<Unaimend> Im wasting time by adding unnecessary plugins to my neovim 🙈 instead of working on bionin
09:01:55Oddmongeri wonder if it's possible to get a ref from a non-ref , without copy the ref with «new»
09:02:18FromDiscord<ElegantBeef> You cannot convert a non-ref to ref
09:02:18Oddmonger(which is not exactly getting a ref, as it's new variable referenced)
09:02:40FromDiscord<ElegantBeef> Remember non-ref's exist on the stack(typically) and refs do not
09:02:57Oddmongerrefs are on the stack ?
09:03:07FromDiscord<ElegantBeef> Plus refs are managed by the memory management
09:03:11FromDiscord<ElegantBeef> No non-ref's are
09:03:23FromDiscord<ElegantBeef> the refs exist on the stack as a ptr
09:03:30FromDiscord<ElegantBeef> the object lies somewhere on the heap afaik
09:03:37Oddmongerah ok
09:04:05FromDiscord<ElegantBeef> So you need to either use a ref object initially, question if `decls`'s `{.byaddr.}` will help you or use a `var T`
09:04:11*lritter joined #nim
09:04:43Oddmonger{.byaddr.} returns a ptr, doesn't it ?
09:05:13FromDiscord<ElegantBeef> well `var a {.byAddr.} = b` would propogate back to b
09:05:26FromDiscord<ElegantBeef> so `a = 100` changes b
09:05:28FromDiscord<ElegantBeef> So yes
09:06:11FromDiscord<ElegantBeef> Actually seems it's considered an int
09:06:57Oddmongercannort import decls with inim ?!
09:07:12Oddmonger(for {.byaddr.}
09:07:14FromDiscord<ElegantBeef> Cmon it's 2021 you use `std/inim`
09:07:21FromDiscord<ElegantBeef> (edit) "`std/inim`" => "`std/decls`"
09:07:26FromDiscord<ElegantBeef> I'm not tired you're tired!
09:07:35Oddmongerhéhé
09:07:48FromDiscord<ElegantBeef> But joke aside you should preface all stdlib modules with `std`
09:08:25FromDiscord<ElegantBeef> And if you're really anal retentive you can do `pkg/`
09:08:44Oddmongerpkg/ ?
09:09:24FromDiscord<ElegantBeef> for package manager packages
09:10:32Oddmongeri understand the need of «std/», because «nim-1.4.4/lib/std/decls.nim», but pkg/ ?
09:11:12FromDiscord<ElegantBeef> It's just to tell nim "I certainly want this from my packages not from this file"
09:11:32FromDiscord<ElegantBeef> say you have a `coolModule` and a package installed named `coolModule`
09:11:52FromDiscord<ElegantBeef> If you want to import the package you cannot, hence `pkg/coolmodule`
09:12:06FromDiscord<ElegantBeef> Yes i just camelcased a module, you're still more tired than me
09:13:08Oddmongercamel and snakes are strange animals
09:13:43Oddmongerthank you for the explain^w reminding
09:13:54FromDiscord<ElegantBeef> No problem
09:17:04FromDiscord<ElegantBeef> It's what i do take my pretend knowledge and disperse it to people who want to play pretend with me
09:18:47FromDiscord<Rika> How do I ensure I have no cycles so that arc works properly?
09:19:59FromDiscord<ElegantBeef> Arent cycles just recursively dependant types
09:20:42FromDiscord<ElegantBeef> So if you have an object that could potentially be a cyclical object you mark it with `{.acyclic.}`
09:20:52FromDiscord<ElegantBeef> Assuming of course you dont need it to be cyclical
09:21:45FromDiscord<ElegantBeef> Aside from that i figure you just run the code with `-d:useMalloc` and valgrind or whatever else
09:34:08FromDiscord<Rika> In reply to @ElegantBeef "So if you have": Not sure if this will prevent me from accidentally making a cycle
09:34:25FromDiscord<Rika> In reply to @ElegantBeef "Aside from that i": Valgrind can run on embedded?
09:36:54FromDiscord<clyybber> @Rika compiler will warn you if cycles can be created with arv
09:36:59FromDiscord<clyybber> (edit) "arv" => "arc"
09:37:35FromDiscord<Rika> Okay
09:44:49*ecs joined #nim
10:02:47*tane joined #nim
10:08:26FromDiscord<mlokis> the documentation states that seq is managed by gc, is there a counterpart that has to be managed manually as pointer?
10:09:30FromDiscord<Rika> As in something you allocate and free manually?
10:09:33FromDiscord<Rika> Why?
10:10:17FromDiscord<mlokis> i might not need a gc in some cases
10:10:49FromDiscord<mlokis> just interested
10:11:02FromDiscord<mlokis> cannot find anything about it
10:11:39*willyboar joined #nim
10:14:36FromDiscord<Rika> There is arc, maybe look into that first
10:55:12*vicfred quit (Quit: Leaving)
11:05:35*krux02 joined #nim
11:17:40FromDiscord<Unaimend> sent a code paste, see https://play.nim-lang.org/#ix=2V6M
11:22:17*jess quit (Quit: Changing server)
11:22:50*jess joined #nim
11:28:59FromDiscord<nailuj29> what is `nimErrorFlag`
11:33:35*johnnynitwits joined #nim
11:33:36*threenp joined #nim
11:35:29threenpHi all! Been curious of nim for some time and finally have a good opportunity to try it out by patching a project. But I'm hitting a brick wall - I can't seem to read os env vars successfully
11:35:58*willyboar quit ()
11:36:58threenpSo this just produces an empty string:
11:36:58threenpfrom os import getEnv
11:36:58threenpconst x = getEnv("CONF_FILE").string
11:39:27threenprunning on alpine linux in docker, building with nim 1.4
11:39:27threenphere's how it's built
11:39:27threenphttps://github.com/zedeus/nitter/blob/52a0b530cc35c4a8ab28b58994d8c07322a58a51/Dockerfile#L10
11:39:27threenphttps://github.com/zedeus/nitter/blob/master/nitter.nimble
11:40:22PrestigeWhat happens threenp ? just returns an empty string?
11:41:02threenpyes exactly
11:41:36PrestigeHow do you know that env var is set?
11:41:42threenpif i do getEnv("CONF_FILE", "blabla") it falls back to blabla
11:42:07threenpi run it like so:
11:42:07threenpCONF_FILE=test ./nitter
11:42:15threenpwhere nitter is the binary artefact
11:42:44Prestigetry putEnv("CONF_FILE", "foo") before getEnv and see if it returns anything? Also I don't think you need .string after getEnv
11:43:15threenpre string yeah, same without.. thanks, will see what putenv gives
11:45:26PrestigeIf that works, might want to try https://play.nim-lang.org/#ix=2V6U in a standalone file just to see if it's a Nim problem or something else.. idk what it would be otherwise
11:46:16threenpyeah it's really odd, came here as i'm new to nim and thought it might be some ecosystem particularity involved i may not be aware of
11:48:06threenpother processes run in the same environment read env vars just fine
12:05:36*letto quit (Quit: Konversation terminated!)
12:06:19*letto joined #nim
12:07:27FromDiscord<dom96> `const` means the reading of env happens at compile-time
12:07:31FromDiscord<dom96> you probably want `let`
12:09:13FromDiscord<Clonkk> When bindings C++ class, is it necessary to hook the C++ destructor to `=destroy` or would that cause a double free ?
12:14:15FromDiscord<Recruit_main707> pretty sure thats how it should be done
12:20:40FromDiscord<Clonkk> Hmm
12:20:42*m33 joined #nim
12:20:43FromDiscord<Clonkk> I get double free
12:21:13FromDiscord<Recruit_main707> are you freeing it manually?
12:21:21FromDiscord<Recruit_main707> or the c++ lib somewhere?
12:21:44FromDiscord<Clonkk> I don't think so
12:22:56*m33[m] joined #nim
12:23:41*rockcavera joined #nim
12:23:44threenpaaah that explains everything, thanks dom96!!
12:25:08FromDiscord<Recruit_main707> @Clonkk try sharing a code snippet, some context could help
12:26:50*Rudde quit (Remote host closed the connection)
12:27:13FromDiscord<Clonkk> std::string wrapper ; branch feat_destructors https://github.com/Clonkk/nim-cppstl/tree/feat_destructors
12:27:41FromDiscord<Clonkk> If I try to execute tests tsring with --gc:arc and =destroy hooked on ~.basic_string() I get a double free
12:29:02*m33 left #nim ("WeeChat 2.3")
12:29:50FromDiscord<Clonkk> @Recruit_main707 Destrucotrs hooked here if you want to take a look 🙂 https://github.com/Clonkk/nim-cppstl/blob/feat_destructors/cppstl/string.nim#L195
12:31:14FromDiscord<Recruit_main707> =copy and =sink work?
12:31:15*wasted_youth2 joined #nim
12:31:56Zoom[m]Guys, was that Drew Devault here in the channel?
12:32:01FromDiscord<Clonkk> Commenting =destroy and keeping =copy / =move doesn't segfault
12:32:22ddevaultZoom[m]: hi, what's up
12:33:00Zoom[m]Nice seeing you here! How long you've been dabbling with Nim?
12:33:15ddevaultI don't exactly dabble with nim per-se, I just keep an eye on it
12:33:26ddevaultI poked at it several years ago
12:33:44ddevaultlanguages with C as an intermediate step are not generally my cup of tea
12:33:48FromDiscord<Recruit_main707> it probably wont work, but what happens if you wrap the dealloc function and then call that from within destroy?
12:33:58*rockcavera quit (Remote host closed the connection)
12:37:15Zoom[m]ddevault: I like your stuff a lot, SourceHut is very cool, though I didn't sign up yet. What's wrong with C as an intermediate?
12:37:17m33[m]Hi guys, I am giving nim a try... I would like to port my small python bots for mastodon (activitypub), I can't find mastodon/activitypub librairies, are you aware of such libs? (nim native)
12:37:27FromDiscord<Clonkk> In reply to @Recruit_main707 "it probably wont work,": I get C++ codegen error 😄
12:37:29FromDiscord<Rika> no, not that i know of
12:37:38ddevaultit's difficult (and complicated) to generate idiomatic C from another target, and it adds a layer of indirection which complicates debugging
12:37:54FromDiscord<Rika> does mastodon have anything specific for bot creation?
12:37:59FromDiscord<Rika> and not just a REST API?
12:38:10FromDiscord<Clonkk> In reply to @ddevault "languages with C as": Check NLVM it's Nim thart compile to LLVM IR
12:39:26*Vladar quit (Quit: Leaving)
12:39:34liblq-devyeah compiling to C is a double-edged sword
12:39:36*Gustavo6046 quit (Ping timeout: 260 seconds)
12:39:45liblq-devyou get easier FFI, but a worse debugging experience
12:41:01Zoom[m]ddevault: as a shameless plug, I know you post videos to Peertube (go Free Software!) and I'm picky about sound quality, so if you ever consider stepping up your game on that end: https://indiscipline.github.io/post/voice-sound-reference/
12:41:23federico3liblq-dev: you also get much better portability. Nim runs on a lot of platforms.
12:41:27Zoom[m]Also, I'd love to sometime read your thoughts on pijul
12:41:49*Vladar joined #nim
12:41:52ddevaultlet's take care not to get too off-topic for this channel
12:42:06Zoom[m]I'm done, sorry.
12:42:47Zoom[m]But I've been nagging everyone here to convince Araq to buy a mic for his talks for a while.
12:43:46FromDiscord<Rika> fitting for someone called zoom.
12:43:50FromDiscord<Rika> heehee
12:44:28federico3Zoom[m]: nice writeup
12:44:41m33[m]<FromDiscord "<Rika> does mastodon have anythi"> not that I am aware off. In python mastodon.py let you create a client easily, at least for token based authentication and posting (tooting).
12:45:11FromDiscord<Rika> might not be hard to translate that then, maybe try it to improve in nim 😛
12:46:17Zoom[m]To stay on topic, with Leorize's help I've beaten Go in my countwords version (https://github.com/ZoomRmc/countwords_nim).
12:46:20Zoom[m]I've noticed we can calculate the hash for words as we go along, but there's no *public* way to pass the hash into a table. I've just included tables and modified a couple of procs (`inc` and `rawGet`) which gave a solid 7% boost in speed.
12:46:38Zoom[m]Is there any more civilized way to achieve the same?
12:47:14Zoom[m]And, is it reasonable idea for a std tables to have a backhatch for passing a hash in?
12:47:26*rockcavera joined #nim
12:48:43Zoom[m]Thanks federico3 ! I've chosen this community as my victim for evangelizing better sound quality for talks a
12:48:43m33[m]<FromDiscord "<Rika> might not be hard to tran"> I would prefer simply port the app logic at first, not mess with low level stuff (networking & all). It would be rewarding quicker... maybe it's not the right use case to begin with.
12:50:22FromDiscord<Rika> you dont have to mess at too low of a level if its not proprietary (REST, websockets), there are libraries to interface with those already
12:50:36FromDiscord<Rika> JWT? prolly one already as well
12:50:59m33[m]Guess I should play on code.golf before all this...
12:54:25m33[m]<FromDiscord "<Rika> you dont have to mess at "> unfortunately I already have investigated in this direction, it seems activitypub is rather complex to implement :/
12:54:50FromDiscord<Rika> oh i see
13:38:34*beshr quit (Remote host closed the connection)
13:43:09FromDiscord<dain> do i need to know any C to use Nim
13:44:51FromDiscord<Clonkk> No you don't need to know C unless you're wrapping a C library in Nim
13:49:55Zoom[m]@dain it certainly wouldn't hurt, especially if you need to debug, but it's not strictly necessary.
13:54:40Fish-FaceHello, I seem to have run into this bug https://github.com/nim-lang/Nim/issues/14873 but the "workaround" does not make sense and as far as I can tell in my case, does not work. Is any more known about this?
14:16:17FromDiscord<dain> is there a way to get the implicit bool-casting that python does in if-statements
14:16:56FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=2V7w
14:16:56FromDiscord<dom96> yes, you can create a converter
14:16:59Fish-Faceand on the topic of concurrency, it seems there is very little information about the actual semantics of the `parallel` block - I had assumed that it was only stuff that was `spawn`ed that happened in threads and that other stuff in the parallel block would be synchronous, but this appears not to be the case... is there actually documentation about this somewhere that I haven't found?
14:16:59FromDiscord<Solitude> https://nim-lang.org/docs/manual.html#converters
14:18:24FromDiscord<dain> In reply to @Solitude "https://nim-lang.org/docs/manual.html#converters": ooo
14:18:27FromDiscord<dain> neato
14:24:57*filcuc_ joined #nim
14:26:40FromDiscord<dain> hm
14:26:47FromDiscord<dain> I'm not sure I understand the semantics of it?
14:28:22FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=2V7B
14:29:05FromDiscord<dain> if I remove the converter line it doesn't compile, so it is being used. but why is it echoing an integer rather than a boolean
14:30:28FromDiscord<Rika> not exists for integers
14:30:33FromDiscord<Rika> it is a bitwise not
14:30:40FromDiscord<Rika> so the converter does not run
14:30:51FromDiscord<dain> oh I se
14:30:52*willyboar joined #nim
14:31:06FromDiscord<dain> I thought it didn't compile but I was wrong, must have had a typo elsewhere
14:31:13FromDiscord<dain> (edit) "I thought it didn't compile ... but" added "without the converter"
14:31:19FromDiscord<dain> (edit) "se" => "see"
14:40:58FromDiscord<dain> sent a code paste, see https://paste.rs/ofO
14:41:02FromDiscord<dain> for project euler ex1
14:41:17*filcuc_ quit (Ping timeout: 246 seconds)
14:43:32FromDiscord<Rika> idiomatic is to not use stuff like that so no its not
14:43:44FromDiscord<dain> oh :(
14:44:03*Vladar quit (Remote host closed the connection)
14:49:10*Vladar joined #nim
15:18:38ForumUpdaterBotNew thread by Alexeypetrushin: Twitter in 100 lines of Nim, no JS, see https://forum.nim-lang.org/t/7749
15:26:55FromDiscord<rb3> Hey guys, is there a way to different assignment to a `var` and `let` variable? e.g. `var a = fn()` vs `let a = fn()`? I know there isn't return type overloading, so tried playing around with a proxy type that overloads `=copy`, but of course that didn't work. I just want to call a proc when a `var` instance of the proxy type goes out of scope.
15:27:11FromDiscord<rb3> (edit) "different" => "differentiate"
15:27:40FromDiscord<rb3> (edit) "and" => "vs"
15:28:02*Kumool left #nim ("Ploop")
15:36:59*xet7 quit (Quit: Leaving)
15:37:42*xet7 joined #nim
15:46:18*Gustavo6046 joined #nim
15:48:47*waleee-cl joined #nim
15:55:10*PMunch joined #nim
16:01:47leorize@rb3 there aren't any ways to do that
16:01:51leorizewhat are you trying to achieve?
16:06:48FromDiscord<mlokis> is there some stdlib numeric concept?
16:07:02FromDiscord<mlokis> that defines all operators numbers have
16:07:21leorizeno, the stdlib use little to no concepts atm due to their buggyness
16:27:19FromDiscord<mlokis> how do i requier operator like `/=` in constraint? if i use `c /= c` it does not want to accept numerical types
16:27:47leorizecan you provide an example of what you want to do?
16:29:52FromDiscord<mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2V8e
16:31:53*letto quit (Quit: Konversation terminated!)
16:33:56*letto joined #nim
16:34:36FromDiscord<mlokis> i see int does not have that operator
16:34:47FromDiscord<mlokis> that strange though
16:35:09*haxscramper joined #nim
16:37:51leorizeYardanico: not sure if it's a bridge bug, but `*` are rendered as a weird circle thing.
16:40:07leorizemlokis: yea since it's ambigous, but you can define it yourself: https://play.nim-lang.org/#ix=2V8i
16:40:36leorizenote that self assignment of `a / b` can't work since `int / int = float`
16:41:07FromDiscord<mlokis> oh i see
16:41:13FromDiscord<mlokis> did not know that
16:41:26FromDiscord<mlokis> that makes sense
16:41:50FromDiscord<mlokis> so `//` like in python?
16:42:11leorizeour operator for integer division is `div`
16:46:25FromDiscord<mrotaru> how to get the folder from which a nim executable is running ?
16:47:11leorizeos.getAppDir()
16:47:43PMunchleorize, yeah that's a bridge bug I think. It's really annoying..
16:48:04*PMunch quit (Quit: leaving)
17:15:58FromDiscord<Conifer> Atta shame. Found Better Comments on VSC kinda break code runner with Nim. :sad:
17:16:12FromDiscord<Conifer> (edit) "kinda" => ""
17:16:54FromDiscord<Goel> What does better comments?
17:19:16FromDiscord<Conifer> https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments
17:19:26FromDiscord<Conifer> Nim is supported tho.
17:19:33FromDiscord<Conifer> but obviously its code runner thing
17:30:39FromDiscord<Goel> Probably if you open an issue on Code Runner they will fix it (if you are sure its not a bug with Better comments)
17:32:57FromDiscord<Conifer> Yeah it's not. Code.Runner works fine without it. Will have to open an issue later
17:36:30ForumUpdaterBotNew post on r/nim by h234sd: Twitter in 100 lines of Nim, Interactive UI with no JS, see https://reddit.com/r/nim/comments/mkq777/twitter_in_100_lines_of_nim_interactive_ui_with/
17:44:31*vicfred joined #nim
17:56:55*mal`` quit (Quit: Leaving)
18:00:20*antranigv quit (Quit: ZNC 1.8.2 - https://znc.in)
18:00:43*antranigv joined #nim
18:01:18*willyboar quit (Remote host closed the connection)
18:01:50*willyboar joined #nim
18:05:05*willyboa_ joined #nim
18:06:31*willyboar quit (Ping timeout: 260 seconds)
18:10:46FromDiscord<elph> hello, does Nim have a "source format" tool?
18:18:07*mal`` joined #nim
18:25:18FromDiscord<Mustache Man> In reply to @leorize "our operator for integer": What about /%
18:25:35leorize`mod`?
18:25:55leorize@elph we do have `nimpretty`, but it's pretty lax and doesn't conform your code to a standard
18:26:41FromDiscord<Mustache Man> Not mod, 13 /% 3 == 4
18:27:30FromDiscord<Mustache Man> (edit) "4" => "4. %% is mod"
18:31:31leorize[m]what does the `/%` do then?
18:32:20FromDiscord<Mustache Man> Integer division, I believe
18:33:21FromDiscord<Mustache Man> (edit) "division, I believe" => "division"
18:37:46*lritter quit (Ping timeout: 265 seconds)
19:15:03*willyboa_ quit ()
19:31:21leorize@Mustache then `div`
19:31:59*antranigv quit (Quit: ZNC 1.8.2 - https://znc.in)
19:33:45*antranigv joined #nim
19:40:39*antranigv quit (Quit: ZNC 1.8.2 - https://znc.in)
19:40:59*antranigv joined #nim
19:42:59*willyboar joined #nim
20:05:53*willyboar quit (Remote host closed the connection)
20:06:27*willyboar joined #nim
20:25:49FromDiscord<mlokis> do you also sometimes ask your self, how to f this s compiles and is so fast, when looking at nim code, i feel like i will get wery leazy by writing something like this, the fact that i can write function and then right under it, write the test, run the module and move on feels unrealistic.
20:26:26FromDiscord<mlokis> (edit) "on" => "on,"
20:26:44FromDiscord<Technisha|💻⭐> Heya everyone- Y'all remember me?-
20:27:34ForumUpdaterBotNew thread by Kcvinu: What is happening under the hood of "cast" function ?, see https://forum.nim-lang.org/t/7750
20:28:25FromDiscord<Technisha> I came back with more issues then ever before ÙvÚ
20:28:31FromDiscord<exelotl> In reply to @Technisha|💻⭐ "Heya everyone- Y'all remember": yo!
20:28:51leorizelong time no see Technisha
20:28:57FromDiscord<Technisha> Heya everyone haha
20:29:05*willyboa_ joined #nim
20:29:20FromDiscord<Technisha> I quit programming a while ago since.. i exhausted my hobby of it- But I'm back and more ready then ever UvU
20:29:35ForumUpdaterBotNew thread by Alexeypetrushin: Multi-threaded features needed for Server, see https://forum.nim-lang.org/t/7751
20:30:02*willyboa_ is now known as willyboar_
20:30:59FromDiscord<Technisha> Time to try Dimscord again cuz yes-
20:32:39*willyboar quit (Ping timeout: 246 seconds)
20:33:23*willyboar joined #nim
20:34:47FromDiscord<Conifer> If possible, how can I create a procedure that has tuples as a param and returns tuples too?
20:35:02FromDiscord<Conifer> (edit) "has" => "takes"
20:35:32FromDiscord<Yardanico> just do that?
20:35:54FromDiscord<haxscramper> yes, `proc test(a: (int, int)): (int, string) = (a[0], $a)`
20:35:58FromDiscord<Conifer> In reply to @Yardanico "just do that?": getting confused with syntax.
20:36:05FromDiscord<Conifer> In reply to @haxscramper "yes, `proc test(a: (int,": Thank you.
20:36:09FromDiscord<Yardanico> or https://nim-lang.org/docs/manual.html#types-tuples-and-object-types for named tuples
20:36:47*willyboar_ quit (Ping timeout: 260 seconds)
20:38:17FromDiscord<mlokis> i hate how unions are called objects. it reminds me of java. and i dont like that
20:38:36FromDiscord<IDF(ardek66)> just forget java
20:40:00FromDiscord<Yardanico> In reply to @mlokis "i hate how unions": huh?
20:43:19FromDiscord<Technisha> What are some things about Nim that may have changed from 1.2?
20:43:21FromDiscord<haxscramper> In reply to @Yardanico "huh?": `Type {.union.} = object`
20:43:30FromDiscord<Yardanico> In reply to @haxscramper "`Type {.union.} = object`": yes, I know, but that's only for C interop
20:43:40FromDiscord<Yardanico> we have object variants which are unions inside too, but that's hidden
20:43:47FromDiscord<haxscramper> No, isn't it just to declare union in nim?
20:44:29FromDiscord<haxscramper> And I thought C interop does not care about `struct/union/class` on C side
20:44:58FromDiscord<haxscramper> And it just copy-pastes types and field access.
20:45:36leorizeit's useful for ABI-based interop
20:46:52FromDiscord<haxscramper> Yes, but if I understand correctly ABI-based interop just means I have to declare new nim object that exactly matches layout of the C counterpart
20:46:55FromDiscord<haxscramper> Is that correct?
20:47:20FromDiscord<haxscramper> So `{.union.}` is still just a way to declare C-style unions in nim
20:47:56FromDiscord<haxscramper> And I'm not saying anything about their usefulness or not, just got confused with "but that's only for C interop" part
20:48:01leorizeyes, so how are you gonna declare a Nim object that matches a C union?
20:48:06FromDiscord<Technisha> Shit i forgot Nim doesn't have OOP, time to yeet the Java outta the window-
20:48:25*Mister_Magister quit (Quit: bye)
20:48:58FromDiscord<dom96> Nim does have OOP
20:49:23FromDiscord<Technisha> Wait what
20:49:27FromDiscord<dom96> but it leads to less ideal solutions in Nim so you shouldn't use it 🙂
20:49:43FromDiscord<dom96> unless you have a really good reason, there are use cases out there that demand it
20:49:48FromDiscord<Technisha> Does Nim have classes now? If so that's unholy...
20:50:18FromDiscord<Yardanico> @Technisha nim always had OOP
20:50:23FromDiscord<Yardanico> you can have OOP without classes
20:50:29FromDiscord<Technisha> Oh yeah i meant classes
20:50:34FromDiscord<Technisha> Sorry brain isn't 100% today
20:50:37FromDiscord<Technisha> Or anyday-
20:53:29FromDiscord<Technisha> I wonder if there's a program to turn Nim code into pure brainfuck
20:53:34FromDiscord<Technisha> ...aka impossible but meg
20:53:40FromDiscord<Technisha> Aaaa I'm getting distracted again
20:54:17FromDiscord<Technisha> (edit) "meg" => "meh"
20:54:38FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2V9L
20:55:18FromDiscord<haxscramper> Nothing C-interop-special or only-for-C-interop here from what I can tell
20:56:01*xet7 quit (Ping timeout: 260 seconds)
20:59:21*Mister_Magister joined #nim
21:03:12*vicfred quit (Quit: Leaving)
21:11:46*haxscramper quit (Remote host closed the connection)
21:27:07*tane quit (Quit: Leaving)
21:27:12*willyboar quit ()
21:29:08*xet7 joined #nim
21:39:06FromDiscord<nailuj29> I want to make a more modern version of nimkernel, but I get an error about `nimErrorFlag` what is that
21:56:51*Vladar quit (Quit: Leaving)
22:08:29FromDiscord<ElegantBeef> @nailuj29 using `--os:any` or `--os:standalone`?
22:08:37FromDiscord<nailuj29> Ye
22:09:06FromDiscord<ElegantBeef> That wasnt a yes or no question
22:09:47FromDiscord<ElegantBeef> I assume you're using `standalone` so use `any`
22:11:01FromDiscord<nailuj29> Oh I thought you meant either
22:11:03FromDiscord<nailuj29> I'm using any
22:14:48FromDiscord<nailuj29> wait i accidentally nuked my PATH
22:15:44FromDiscord<nailuj29> @ElegantBeef i actually was using `standalone` lmao
22:15:54FromDiscord<nailuj29> now i get this error: `Error: Port memory manager to your platform`
22:16:31FromDiscord<ElegantBeef> now use `-d:useMalloc`
22:16:33FromDiscord<ElegantBeef> and you're done!
22:21:06FromDiscord<nailuj29> In reply to @ElegantBeef "and you're done!": no https://media.discordapp.net/attachments/371759389889003532/828756156503293964/unknown.png
22:22:39FromDiscord<ElegantBeef> Uhhh
22:22:57FromDiscord<ElegantBeef> Something isnt listing the default include paths?
22:24:37FromDiscord<nailuj29> i dont think you can use the include paths in an os
22:24:47FromDiscord<nailuj29> so it makes sense that it fails
22:25:07FromDiscord<ElegantBeef> No clue, you're compiling an OS so i dont see why you cannot
22:26:18FromDiscord<ElegantBeef> Like i know for the pico i had no issue with string.h
22:26:27FromDiscord<nailuj29> huh
22:26:31FromDiscord<ElegantBeef> Though your build options might be different i guess
22:26:47FromDiscord<Yardanico> In reply to @ElegantBeef "Like i know for": when you're doing something fully standalone without libc - you don't have string.h
22:26:50FromDiscord<Yardanico> string.h is a part of libc
22:27:23FromDiscord<ElegantBeef> Shouldnt the string.h be included in the compilation, i dont C?
22:28:03FromDiscord<Yardanico> wdym?
22:28:12FromDiscord<Yardanico> string.h is a part of libc, it's not a part of C
22:30:23FromDiscord<ElegantBeef> Like i say, i know nothing
22:31:19FromDiscord<nailuj29> In reply to @Yardanico "string.h is a part": why would it be included then, or can you set nim to not use it
22:31:38FromDiscord<Yardanico> In reply to @nailuj29 "why would it be": because --os:any usually wants a libc, just a tiny one, but still
22:31:42FromDiscord<Yardanico> you can try -d:nimNoLibc also
22:32:01FromDiscord<Yardanico> ah yeah it should work in your case
22:32:11leorizea kernel usually have a libc fwiw
22:32:19FromDiscord<Yardanico> yep
22:32:19FromDiscord<nailuj29> https://media.discordapp.net/attachments/371759389889003532/828758978657517619/unknown.png
22:32:44FromDiscord<Yardanico> just create an empty stdlib.h :)
22:33:09FromDiscord<nailuj29> still errors
22:33:16FromDiscord<Yardanico> ?
22:33:29FromDiscord<Yardanico> did you modify any of nimkernel?
22:33:47FromDiscord<nailuj29> i modified jackos
22:33:55FromDiscord<nailuj29> which is a modified nimkernel
22:34:09FromDiscord<nailuj29> it has this https://media.discordapp.net/attachments/371759389889003532/828759440278159370/unknown.png
22:34:10FromDiscord<Yardanico> see, then it's not nimkernel
22:34:20FromDiscord<nailuj29> modified nimkernel
22:34:36FromDiscord<Yardanico> i have a bit of an old fork of it in https://github.com/Yardanico/JackOS with some experiments towards string.h
22:34:37FromDiscord<Yardanico> but it compiled
22:35:15FromDiscord<Yardanico> also there's a mistake, -d:danger should be in Makefile not in the cfg :)
22:35:28FromDiscord<nailuj29> ill try forking that
22:35:48FromDiscord<Yardanico> and i have some notes for it in the readme
22:36:13FromDiscord<Yardanico> but no support for that repo, sorry :)
22:36:17FromDiscord<Yardanico> it is what it is
22:37:11FromDiscord<nailuj29> there is no makefile
22:37:42*justsomeguy joined #nim
22:37:43FromDiscord<Yardanico> there's a .sh file
22:37:56FromDiscord<nailuj29> yes but now what
22:38:02FromDiscord<Yardanico> line 6 don't forget to add -d:danger to build full release mode
22:38:11FromDiscord<Yardanico> In reply to @nailuj29 "yes but now what": idk, try to make it work
22:38:22FromDiscord<nailuj29> i dont have an iso, but i have a bin file
22:43:39FromDiscord<nailuj29> it just does this, it doesnt boot https://media.discordapp.net/attachments/371759389889003532/828761831015317544/unknown.png
22:49:19FromDiscord<nailuj29> @Yardanico
23:11:21*aenesidemus joined #nim
23:14:05FromDiscord<Technisha> Okay, if i use JNI in Java, is there a way to use that JVM instance to call JVM functions and stuff?
23:21:47FromDiscord<Technisha> :p
23:22:23FromDiscord<Technisha> Also is there a way to embed the Nim compiler in my Java project without having a separate binary for each version?-
23:22:38leorizethere's jnim for calling java from nim if that's what you're looking for
23:23:29FromDiscord<Technisha> Partly but i wanna use JNI so i can interact with the JVM, in a Jar file, so it can be loaded easily
23:24:00FromDiscord<Technisha> But i also want it so I don't need to make a new JVM VM, outside of the original JVM i already am using from JNI :p
23:25:43FromDiscord<ElegantBeef> Will technisha ever just write nim, find out next week when they attempt to use another language instead of nim!
23:26:19FromDiscord<Technisha> Lmaoooo
23:26:27FromDiscord<Technisha> ~~Good to see you remember me-~~
23:26:31*aenesidemus quit (Quit: Leaving)
23:26:33FromDiscord<Technisha> And i will
23:26:39FromDiscord<Technisha> For a GUI application i'ma be working on
23:26:45FromDiscord<Technisha> But not at my PC soooo
23:26:50FromDiscord<Technisha> Phone dev timeeeee-
23:27:24FromDiscord<ElegantBeef> No i still disbelieve anyone writes code on a phone and will never accept it as real
23:27:38FromDiscord<Technisha> How can I prove it-
23:28:03FromDiscord<Technisha> Want me to screen record me writing a program in Nim on phone?-
23:29:07FromDiscord<ElegantBeef> Nope i'd still say it was manipulated content
23:29:12FromDiscord<ElegantBeef> No one is that masochistic they'd do that
23:29:26FromDiscord<Technisha> https://media.discordapp.net/attachments/371759389889003532/828773352679145512/SVID_20210406_002814_1.mp4
23:29:27FromDiscord<Technisha> Did it anyway
23:30:17FromDiscord<Technisha> :D
23:30:47FromDiscord<Technisha> Tune in next week to see me write a small Java plugin for Spigot and run an MC server on my phone!~
23:34:22FromDiscord<Technisha> In reply to @ElegantBeef "No one is that": Also, guess I'm the most masochistic person ever-
23:34:45FromDiscord<Technisha> I also used to use my phone's notepad to write out code then run it on my RPI later via SFTP soooo
23:36:28*teal joined #nim
23:37:32FromDiscord<Technisha> Anyway, anyone know of a good alternative to Nimble?
23:37:39FromDiscord<Technisha> That i can use for my Nim projects
23:37:54FromDiscord<Technisha> I just wanna keep all of the dependencies separate really :p
23:38:16FromDiscord<ElegantBeef> Nimph though dont know if it currently builds
23:38:25FromDiscord<ElegantBeef> "keep all the dependancies seperate"?
23:38:50FromDiscord<Technisha> Self-contained(?)
23:39:09FromDiscord<Technisha> Idk the word
23:39:13FromDiscord<Technisha> Brain is goo rn
23:39:14FromDiscord<InventorMatt> Like virtual environments?
23:39:19FromDiscord<Technisha> Yeah
23:39:30FromDiscord<ElegantBeef> You can pin to commits or versions, though not suggested i guess
23:40:59FromDiscord<Technisha> Wdym?
23:41:11FromDiscord<Technisha> Anyway... I should think of a Nim project to do
23:41:21FromDiscord<Technisha> Uhhhh... What can i code on my phone-
23:41:31FromDiscord<clyybber> nimble can do local dependencies now
23:41:33FromDiscord<ElegantBeef> I mean you can do `requires "packageName == 0.1.0"`
23:41:36FromDiscord<Technisha> (edit) "can" => "can"
23:41:37FromDiscord<Technisha> Oh?
23:42:46*krux02 quit (Remote host closed the connection)
23:42:49FromDiscord<ElegantBeef> I do think there is a pr to pin it to a specific minor version so you could do `^= 0.1` so any patches would be accepted by major or minor changes dont
23:42:56FromDiscord<ElegantBeef> (edit) "by" => "but"