<< 30-08-2021 >>

00:06:11FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3xnQ
00:06:35FromDiscord<retkid> does nim come with a server tulity
00:06:37FromDiscord<retkid> (edit) "tulity" => "utility"
00:06:45FromDiscord<impbox [ftsf]> what does a server utility do?
00:07:00FromDiscord<retkid> not utility sorry my vocab sucks
00:07:04FromDiscord<retkid> uh
00:07:19FromDiscord<retkid> a library which can listen to ports and send and recieve data
00:07:23FromDiscord<retkid> (edit) "recieve" => "receive"
00:07:38FromDiscord<Elegantbeef> `std/net`
00:07:40FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3xnR
00:08:06FromDiscord<retkid> thank you, time to read docs <3
00:08:10FromDiscord<impbox [ftsf]> https://nim-lang.org/docs/net.html
00:08:47FromDiscord<impbox [ftsf]> @ElegantBeef what's with the std vs no std?
00:09:16FromDiscord<Elegantbeef> New modules are hidden in a `std` path so you need it for some, so best to encourage it
00:09:46FromDiscord<impbox [ftsf]> hmm, any docs about it?
00:10:03FromDiscord<impbox [ftsf]> https://nim-lang.org/docs/lib.html i see a couple have std/ prefix but most don't
00:10:16FromDiscord<retkid> that is a very useful link
00:10:17FromDiscord<impbox [ftsf]> should std import be used for all std library libs?
00:10:20FromDiscord<retkid> i will keep that one
00:10:30FromDiscord<Elegantbeef> Yes it should be
00:10:49FromDiscord<Elegantbeef> Old libraries are grandfathered in, but all new ones will require it
00:11:22FromDiscord<Elegantbeef> So like `setutils` in devel requires `std`
00:11:35FromDiscord<impbox [ftsf]> https://nim-lang.org/docs/manual.html#modules-pseudo-importslashinclude-paths aha found the docs on it
00:12:01FromDiscord<Elegantbeef> And as such the devel docs https://nim-lang.github.io/Nim/strutils.html have it now
00:12:15FromDiscord<impbox [ftsf]> cool
00:12:42FromDiscord<Rika> ~~same could be said with `pkg` and `.` prefixes~~
00:12:47FromDiscord<Elegantbeef> Though dont know how the new atlas tooling will play
00:13:11FromDiscord<impbox [ftsf]> atlas tooling?
00:13:45FromDiscord<Rika> atlas should not interfere with normal user code that doesnt have anything to do with the compiler
00:13:45FromDiscord<Elegantbeef> Atlas is for stdlib management, allowing version selection of the stdlib(or modules in it)
00:14:02FromDiscord<impbox [ftsf]> ahh
00:14:07FromDiscord<Rika> In reply to @Rika "atlas should not interfere": i mean this in terms of imports
00:14:32FromDiscord<Rika> like i dont see how it would change anything
00:14:48FromDiscord<Rika> there arent any new modules that dont require std after all as you said
00:14:56FromDiscord<Elegantbeef> Well lik i said "I dont know" 😀
00:15:08FromDiscord<Elegantbeef> Damn my E key isnt playing nice
00:15:34FromDiscord<Rika> did you mean "nic"
00:19:26FromDiscord<retkid> fuck
00:19:31FromDiscord<retkid> my attention span is non-existant today
00:19:35FromDiscord<retkid> (edit) "non-existant" => "non-existent"
00:19:36FromDiscord<retkid> im dying
00:21:32FromDiscord<impbox [ftsf]> D:
00:21:37FromDiscord<impbox [ftsf]> don't die plz
00:22:32madpropswhy would a case say not all cases are covered if I have an else ..
00:22:44FromDiscord<Rika> code?
00:22:47FromDiscord<impbox [ftsf]> it shouldn't .. show plz?
00:23:11madpropshttps://play.nim-lang.org/#ix=3xnU
00:23:48FromDiscord<impbox [ftsf]> remove the commas
00:24:03madpropsoh haha
00:24:15*arkurious quit (Quit: Leaving)
00:24:16madpropsthis was after turning a table to a case
00:24:20FromDiscord<impbox [ftsf]> and escape the `'` correctly
00:24:28FromDiscord<impbox [ftsf]> `'\''`
00:24:55madpropsyeah
00:26:04madpropsstill don't think this should be a case anyway
00:26:11madpropssince I used the keys with the table
00:26:17madpropsfor k in Morse.keys:
00:26:57FromDiscord<impbox [ftsf]> https://play.nim-lang.org/#ix=3xnW
00:28:16FromDiscord<impbox [ftsf]> array would make more sense to me than table, just some empty entries but who cares
00:28:44FromDiscord<impbox [ftsf]> but you can populate the lookup array from the func
00:29:34madpropsi think table makes sense,
00:29:39madpropsit's just that it looks ugly in docs
00:29:59madpropssince it uses the compiled version
00:54:01FromDiscord<Elegantbeef> array + set is the best combination
00:58:00FromDiscord<impbox [ftsf]> i'm sure there's a way to populate an array from a proc at compile time but i can never remember how
01:01:33FromDiscord<Elegantbeef> Here you go imp https://play.nim-lang.org/#ix=3xo5
01:02:48FromDiscord<impbox [ftsf]> rad
01:02:50FromDiscord<impbox [ftsf]> thanks
01:03:19FromDiscord<Elegantbeef> Ideally you'd limit the range of the array to the lowest/highest character so `array[lowest..highest, string]`
01:03:28FromDiscord<Elegantbeef> But i couldnt be arsed to figure out which those were
01:10:27*Gustavo6046 quit (Ping timeout: 250 seconds)
01:12:02*Gustavo6046 joined #nim
01:12:06madpropsoh cool
01:12:48*krux02 quit (Remote host closed the connection)
01:18:45*neurocyte2 joined #nim
01:18:45*neurocyte2 quit (Changing host)
01:18:45*neurocyte2 joined #nim
01:20:51*neurocyte quit (Ping timeout: 250 seconds)
01:20:51*neurocyte2 is now known as neurocyte
01:27:06FromDiscord<Rika> its unnecessarily expensive to use a table for a char LUT
01:28:39FromDiscord<Elegantbeef> Indeed, reminds me of the powerPC emulator that was using an enum table and just by changing it to an array instead gave them all the performance
01:29:21FromDiscord<Elegantbeef> The important note is not all `O(1)` are equal 😛
01:30:19FromDiscord<Elegantbeef> Then there is also the memory consumption
01:31:02FromDiscord<Rika> big o notation only shows shape
01:31:20FromDiscord<Rika> and there is time complexity versus space complexity
01:31:22FromDiscord<Rika> as you say
01:50:25*auxym_ quit (Ping timeout: 248 seconds)
02:15:27FromDiscord<Rika> what the heck?
02:15:44FromDiscord<Rika> `import pkg/xxx` doesnt work if you have done `nimble develop xxx`
02:20:12nrds<Prestige99> is that a recent bug? I'm pretty sure I've done that
02:22:17FromDiscord<Rika> not sure
02:44:07FromDiscord<retkid> does anyone have any memory on "out of memory"
02:45:39FromDiscord<Rika> ?
02:45:41FromDiscord<Rika> what?
02:47:03FromDiscord<retkid> ah i see the error i think
02:49:10FromDiscord<retkid> yea no i dont
02:49:39FromDiscord<retkid> so, i have a server, but when i call a proc to send data to it, it it quits with "out of memory"
02:50:24FromDiscord<retkid> lemme try some workarounds
02:52:49*notchris quit (Ping timeout: 248 seconds)
02:53:52FromDiscord<retkid> so the issue is that java sucks
02:54:23FromDiscord<Elegantbeef> What do you mean?
02:54:45FromDiscord<retkid> im just working with java socket stuff and got confused
02:54:46FromDiscord<retkid> dont worry
02:56:01*notchris joined #nim
03:08:39*rockcavera joined #nim
03:08:39*rockcavera quit (Changing host)
03:08:39*rockcavera joined #nim
03:19:56madpropsso what is it actually ok to use a table? o_O
03:20:08madpropswhen*
03:20:31FromDiscord<Rika> when the key type is not ordinal
03:21:51madpropsthat morse code table was only partly ordinal
03:22:13FromDiscord<Rika> why>
03:22:17FromDiscord<Rika> i mean the key type
03:22:24FromDiscord<Rika> char is ordinal
03:22:29madpropsoh
03:22:41FromDiscord<impbox [ftsf]> Tables are also good for very sparse data
03:31:15*vicfred quit (Quit: Leaving)
03:33:37FromDiscord<retkid> tables are an effective way of handeling data
03:33:40FromDiscord<retkid> (edit) "handeling" => "handling"
03:34:34FromDiscord<retkid> i'm having a lot of trouble getting nim to get packets from java, and its not nim's fault, its 100% java's fault and i don't know what its doing
03:35:21FromDiscord<Arathanis> I've always thought you should use what is the most readable or makes the most sense to you. If performance ultimately becomes an issue you can come back and optimize later, but I think readability and "sense" trumps chasing performance every time unless you can demonstrate the performance is insufficient.
03:36:05FromDiscord<retkid> what if im building something big and want to be able to scale it
03:36:23FromDiscord<Arathanis> in which cause, the right time to use tables is whenever it makes sense.
03:36:59FromDiscord<Arathanis> i still think you should stick to this philosophy when building something big
03:38:29FromDiscord<Arathanis> 99% of the time your performance bottleneck is going to be a single function, maybe two. You can profile and optimize the slow parts if its too slow when everything comes together and you try to scale.↵↵I'm not saying that you shouldn't design for scalability if you know you need it, only that you shouldn't chase performance in everything you do. Readability really does count. Dev time is expensive, computational power less so.
03:39:01FromDiscord<retkid> well, im not making money and i'm not taking off work so dev time is worthless
03:39:06FromDiscord<retkid> and i want this stuff to run on a potato
03:39:20FromDiscord<Arathanis> Don't say that, your time is never worthless. Money or not. :]
03:40:06FromDiscord<Rika> In reply to @Arathanis "Don't say that, your": ~~this is very true, esp if youre in uni loooool~
03:40:07FromDiscord<Rika> (edit) "loooool~" => "loooool~~"
03:40:28FromDiscord<Arathanis> I also find it easier to make things run on a potato if I just make it worse with good, readable, elegant code. And if it ultimately fails to run on the potatoes, then you can find out what is bottlenecking your nightshades and make them faster!
03:40:42FromDiscord<Arathanis> (edit) "worse" => "work"
03:40:43FromDiscord<retkid> I'm doing some really dubious stuff with my current project. Dunno if it will increase performance or not, and once its finished it'll be nearly impossibly to practically know
03:40:47FromDiscord<retkid> but
03:40:49FromDiscord<Arathanis> edited: worse -> work
03:40:51FromDiscord<retkid> im taking it as a learning thing\
03:40:52FromDiscord<retkid> (edit) "thing\" => "thing"
03:41:00FromDiscord<retkid> (edit) "thing" => "thing, even if it doesn't matter"
03:41:04FromDiscord<retkid> im still learning stuff so eh
03:41:44FromDiscord<Arathanis> sure, learning is always good and it never hearts to learn how to optimize! but if you plan to take this into industry, i really think you will benefit a lot from the approach I outlined above
03:41:48FromDiscord<Rika> In reply to @retkid "I'm doing some really": you can just profile the code tho
03:41:48FromDiscord<Arathanis> In reply to @Rika "~~this is very true,": ha
03:42:06FromDiscord<retkid> its a tad more complicated than that
03:42:08FromDiscord<Rika> me when i entered uni: 😄↵me after a year in uni: 😐
03:42:09FromDiscord<Arathanis> In reply to @Rika "you can just profile": yeah, write it in an elegant readable way tahts easy to maintain and extend
03:42:21FromDiscord<Arathanis> if its too slow you can make it hideous, but fast, monstrosity later
03:42:29FromDiscord<Arathanis> (edit) "if its too slow you can make it ... hideous," added "a"
03:42:32FromDiscord<Rika> you can make elegant fast code
03:42:45FromDiscord<Rika> it just takes much more time than either choice proposed before
03:42:46FromDiscord<Arathanis> not always but i agree with you 99% of the time
03:42:48FromDiscord<Arathanis> maybe more than 99%
03:42:58FromDiscord<Arathanis> there are always edge cases
03:43:01FromDiscord<retkid> nim makes it pretty easy to write fast code
03:43:06FromDiscord<Arathanis> yeah its nice for that
03:43:09FromDiscord<retkid> its kinda built to make fast elegent code
03:43:09FromDiscord<Rika> In reply to @Arathanis "not always but i": id say 90%
03:43:11FromDiscord<retkid> (edit) "elegent" => "elegant"
03:43:17FromDiscord<retkid> if you write fast code in python it looks like php
03:43:28FromDiscord<Arathanis> love me some python
03:43:34FromDiscord<Rika> if you write python may god help you
03:43:44FromDiscord<Arathanis> python is actually my favorite language :P
03:44:04FromDiscord<Rika> its the language i abandoned due to a lot of things i dont like about it
03:44:09FromDiscord<retkid> Python is easy provided you have no performance goals
03:44:23FromDiscord<Arathanis> python is pretty performant if you know what you are doing
03:44:32FromDiscord<Rika> well my issue with it was not performance
03:44:50FromDiscord<retkid> I dunno, python's design goal is very simple
03:44:58FromDiscord<retkid> be like English ((or dutch))
03:45:13FromDiscord<retkid> if you don't like that, c'est la vie
03:45:17FromDiscord<Arathanis> pseudo code that runs!
03:45:21FromDiscord<Arathanis> i actually love it
03:45:25FromDiscord<Arathanis> easily my favorite language.
03:45:40FromDiscord<Arathanis> i started looking into nim because it based its syntax so clearly on python
03:45:53FromDiscord<retkid> thats surface level
03:45:58FromDiscord<retkid> skin deep
03:45:58FromDiscord<Rika> there are things i am fine with wrt. python
03:46:07FromDiscord<Rika> i just really do not like dynamic typing
03:46:13FromDiscord<retkid> under the hood, nim is closer to pascal
03:46:36FromDiscord<Rika> In reply to @Rika "i just really do": and the lack of CTEs too i guess
03:46:43FromDiscord<Arathanis> i like dynamic typing
03:46:49FromDiscord<Arathanis> i like that i can use static typing when i want it
03:47:02FromDiscord<Arathanis> and when i want a quick dirty script for some one off i dont have to fight a type system
03:47:17FromDiscord<Arathanis> but when im doing anything bigger i can get my typing
03:47:20FromDiscord<Rika> those scenarios are rare to me
03:47:30FromDiscord<Rika> i dont remember the last time i had to fight the type system
03:47:30FromDiscord<Arathanis> they are common enough for me to appreciate it
03:47:34FromDiscord<retkid> the only time typing has been annoying for me
03:47:38FromDiscord<retkid> is anything involving java
03:47:51FromDiscord<Rika> java typing is inelegant
03:48:01FromDiscord<Arathanis> well now we have 40in widescreen monitors
03:48:12FromDiscord<Arathanis> so you might be able to display a java class name on a single line now
03:48:31FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/881747183433551902/unknown.png
03:48:57FromDiscord<retkid> kotlin writes and look a lot better than java
03:49:04FromDiscord<retkid> however still has the haulmarks of its bad typing stuff
03:49:11FromDiscord<retkid> (edit) "however still has the haulmarks of its bad typing stuff ... " added "as it intergrates with java"
03:49:13FromDiscord<retkid> (edit) "intergrates" => "integrates"
03:49:35FromDiscord<Arathanis> yeah, i agree
03:49:38FromDiscord<retkid> i write code like a maniac i know
03:49:42FromDiscord<retkid> (edit) "know" => "know, lemm be"
03:49:44FromDiscord<retkid> (edit) "lemm" => "lemme"
03:50:14FromDiscord<Arathanis> but yes my favorite language is python and i looked into nim for the syntactical similarities
03:50:28FromDiscord<retkid> yea
03:50:30FromDiscord<Arathanis> i hate "character noise"
03:50:32FromDiscord<retkid> still dont see that one
03:50:34FromDiscord<Rika> how fun that people who both hate and love python look to nim
03:50:38FromDiscord<Arathanis> and nim does a good job of managing that
03:50:48FromDiscord<Arathanis> i dont really hate any language
03:50:58FromDiscord<retkid> Rika, its because nim is very different than python but looks like it
03:51:02FromDiscord<Arathanis> except maybe JS for breaking boolean algebra u_u
03:51:13FromDiscord<Arathanis> and PHP for being... you know
03:51:19FromDiscord<retkid> don't like java
03:51:25FromDiscord<retkid> never have to program JS because nim
03:51:26FromDiscord<retkid> so im golden
03:51:44FromDiscord<Rika> hate is a strong word, i just use it as it is the inverse immediately thought of when thinking of love
03:51:51FromDiscord<Arathanis> yeah i dont really hate anything
03:51:57FromDiscord<Arathanis> java's verbosity really turns me off
03:52:01FromDiscord<retkid> yea no java makes furious
03:52:04FromDiscord<retkid> like genuinely
03:52:06FromDiscord<Arathanis> maybe APL for being a "write only" language lmao
03:52:18FromDiscord<retkid> even after learning a lot of java
03:52:24FromDiscord<retkid> writing it is like molasiss
03:52:27FromDiscord<retkid> (edit) "molasiss" => "molasses"
03:52:30FromDiscord<Rika> In reply to @Arathanis "and PHP for being...": you remind me of the php project i have to set up and maintain (but have been putting it off for months)
03:52:38FromDiscord<Arathanis> https://media.discordapp.net/attachments/371759389889003532/881748215114924052/unknown.png
03:52:49FromDiscord<Arathanis> Conway's Game of Life written in APL
03:52:53FromDiscord<Arathanis> write only language im telling you
03:53:08FromDiscord<retkid> well
03:53:10FromDiscord<impbox [ftsf]> I loved python until I used it for a long time, mostly due to the lack of typing and it's standard library.
03:53:27FromDiscord<retkid> py's standard library is infuriating
03:53:28FromDiscord<Arathanis> In reply to @impbox "I loved python until": ive been using python for so long, still love it
03:53:30FromDiscord<retkid> almost as bad as java
03:53:45FromDiscord<retkid> dunno what they're thinking with it
03:53:52FromDiscord<Arathanis> you dont liek the standard library? huh, color me surprisefd
03:53:53FromDiscord<Arathanis> (edit) "surprisefd" => "surprised"
03:53:55FromDiscord<impbox [ftsf]> Nim has the bits of python i like without the bits I don't so it's great
03:54:16FromDiscord<retkid> nim is kinda like a language blender
03:54:19FromDiscord<retkid> with some new ideas thrown in
03:54:26FromDiscord<Rika> In reply to @Arathanis "you dont liek the": its gained a lot of cruft and inconsistencies over the years
03:54:35FromDiscord<Rika> its not really annoying to me though
03:54:46FromDiscord<impbox [ftsf]> Oh also distributing python apps is a massive pain
03:54:51FromDiscord<impbox [ftsf]> Nim is easy
03:54:59FromDiscord<retkid> i think, when i want to do simple tasks, i have to go on PIP
03:55:02FromDiscord<retkid> thats a bad sign
03:55:14FromDiscord<retkid> and i do the same thing for java except its a pain in the ass to get dependencies to work with Maven
03:55:19FromDiscord<retkid> so i end up just fucking using it anyway
03:55:20FromDiscord<Arathanis> oh ive never had issue with distributing python apps I use either PyInstaller or Nuitka if im feeling spicy.
03:55:36FromDiscord<retkid> i just leave the scripts out there and tell them to figure it out
03:55:37FromDiscord<retkid> 😎
03:58:39FromDiscord<retkid> yea so sometimes on the server recieve
03:58:48FromDiscord<retkid> random characters get thrown into the strings i recieve
03:58:53FromDiscord<retkid> (edit) "recieve" => "receive"
03:59:09FromDiscord<retkid> and other times it doesn't send, for no reason
04:02:46FromDiscord<Arathanis> sounds like an encoding problem?
04:03:03FromDiscord<Arathanis> you got something sending utf-8 and something expecting to receive ascii or vice versa?
04:03:55FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/881751061600276550/unknown.png
04:04:06FromDiscord<retkid> so yea it seems that
04:04:36FromDiscord<retkid> after the default length it spits out a character
04:04:41FromDiscord<retkid> on some overflow issue or something
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:07FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/881751611351891999/unknown.png
04:06:19FromDiscord<retkid> only happens at the start
04:06:23FromDiscord<retkid> (edit) "only happens at the start ... " added "1 time"
04:06:30*supakeen joined #nim
04:06:32FromDiscord<retkid> (edit) "time" => "time, i could filter that out probably"
04:08:24FromDiscord<garett> In C, it is possible to define an enum type with no constants. Is there a way to do that in Nim? Maybe if I use `discard` in the body of the enum type declaration?
04:09:35FromDiscord<Yardanico> In reply to @garett "In C, it is": I don't think it's possible, besides, what would you use it for?
04:09:48FromDiscord<Yardanico> I mean what do you actually want to do with an empty enum?
04:10:17FromDiscord<garett> declare a set type with no valid flags, because this is something that appears in vulkan API
04:10:51FromDiscord<garett> The reason it appears is because future versions of the API may add some flags
04:11:06FromDiscord<garett> I will just use a `distinct uint32` to approximate it
04:12:07FromDiscord<Yardanico> oh okay then, your way should work I think
04:12:18FromDiscord<garett> I confirmed in nim playground that you can't put `discard` in the body of an enum declaration
04:12:32FromDiscord<Yardanico> i know :)
04:12:37FromDiscord<garett> Thanks Yardanico 🙂
04:12:58FromDiscord<Yardanico> `discard` in type declarations can only be placed when you have some branching with e.g. `case` or `when`
04:13:00FromDiscord<Yardanico> iirc
04:13:11FromDiscord<Yardanico> you don't need it to create an empty object for example
04:13:14FromDiscord<Yardanico> `type EmptyObj = object`
04:13:21FromDiscord<Yardanico> that's all what's needed, no discard
04:14:01FromDiscord<garett> I was playing with NimGL's vulkan.nim, and found it awkward to deal with flags. I refactored it to use sets, which makes the code pretty nice, but I must have messed up something somewhere because it breaks the example program 😄
04:14:25FromDiscord<Yardanico> there's also a few other vulkan binding repos for nim
04:14:39FromDiscord<garett> I was surprised that an empty enum can't be declared similar to an empty object, but I don't find it unreasonable.
04:14:46FromDiscord<Yardanico> https://github.com/nimious/vulkan
04:14:47FromDiscord<Yardanico> https://github.com/Clyybber/vulkanim
04:14:48nrds<R2D299> itHub: 7"Nim bindings for Vulkan, the API for access to graphics and compute on GPUs."
04:14:49nrds<R2D299> itHub: 7"Vulkan bindings for nim"
04:18:21FromDiscord<garett> both interesting, thanks for the links. Neither is quite as idiomatic as I would like, but I may be able to take inspiration from all three to cobble something nice together
04:19:44*rockcavera quit (Remote host closed the connection)
04:19:44FromDiscord<garett> Nim `set` is really ideal for all of the bit flag fields in the vulkan API, makes the code much nicer to read and write, without all the int-casting and bitops
04:20:53FromDiscord<garett> I'll probably end up doing what I did for D3D11, and just manually translating the headers to Nim 😛
04:21:07madpropswhat's the idea behind toUpperAscii ?
04:21:13madpropsinstead of using toUpper all the time
04:21:21madpropsperformance gains?
04:21:37FromDiscord<garett> I think it indicates that it doesn't support uppercasing Unicode letters
04:21:43FromDiscord<garett> outside the ASCII range
04:22:28FromDiscord<garett> like converting a lowercase a with umlauts over it into an uppercase A with umlauts over it
04:24:11FromDiscord<garett> sent a code paste, see https://play.nim-lang.org/#ix=3xoA
04:24:58FromDiscord<garett> Uppercasing arbitrary Unicode glyphs requires a lot of tables to figure out whether there is an uppercase equivalent and what it is.
04:25:19madpropsI see
04:25:19FromDiscord<garett> Uppercasing ASCII characters is just an `if` and an add
04:25:30FromDiscord<retkid> alright
04:26:04FromDiscord<garett> So, I think your initial inclination is correct, `isUpperAscii` should be faster, but only operates on a subset of possible text
04:26:23FromDiscord<Yardanico> In reply to @garett "I think it indicates": yes, exactly
04:26:31FromDiscord<impbox [ftsf]> toUpperAscii also might break unicode characters
04:26:32FromDiscord<retkid> there is some base 16 in here↵@['\x00', '\x0F', 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!']
04:26:40FromDiscord<Yardanico> wdym? that's not base 16
04:26:41FromDiscord<impbox [ftsf]> if you pass it unicode text
04:27:06FromDiscord<retkid> yep
04:27:07FromDiscord<impbox [ftsf]> if you're using ascii functions you want to be sure you're passing them ascii
04:27:15FromDiscord<retkid> thats just a non printable character
04:27:35FromDiscord<retkid> i saw \x0F and went... 0x0000F???
04:28:01FromDiscord<garett> I think for unicode characters it would be `"\u00000000"`
04:28:15FromDiscord<retkid> I have a solution, but do you know where these are coming from
04:28:22FromDiscord<retkid> the second one is seemingly rtandom
04:28:25FromDiscord<retkid> (edit) "rtandom" => "random"
04:28:29FromDiscord<Yardanico> then something's wrong with your code
04:28:31FromDiscord<retkid> is it the sum of the characters
04:28:37FromDiscord<Yardanico> are you doing FFI or what?
04:28:42FromDiscord<Yardanico> and what are you interfacing with?
04:28:48FromDiscord<retkid> server stuff
04:29:06FromDiscord<retkid> sending a packet
04:29:09FromDiscord<retkid> might be an encoding thing
04:29:18FromDiscord<retkid> lemme see if i can change the encoding to UTF in nim
04:29:23FromDiscord<garett> `'\x0F'` is the ASCII control sequence `SI`
04:29:36FromDiscord<Yardanico> In reply to @retkid "sending a packet": well, maybe you're sending/receiving it incorrectly :P
04:29:51FromDiscord<garett> (edit) "`'\x0F'` is the ASCII control sequence `SI` ... " added "(shift in)"
04:30:21FromDiscord<retkid> In reply to @garett "`'\x0F'` is the ASCII": well, that one is made from the following characters
04:30:23FromDiscord<Yardanico> having a null terminator at the start of your string isn't a good sign
04:30:59FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wYC
04:31:20FromDiscord<Yardanico> yes, exactly, \x00 at the start signifies that something's wrong
04:31:30FromDiscord<Yardanico> you shouldn't have a null character at the start of your string
04:31:48FromDiscord<retkid> it would be cool if i could see it without converting it to a C string tho
04:31:55FromDiscord<Yardanico> ?
04:32:13FromDiscord<retkid> so, i only looked at this because i was doing string checks and it didn't work
04:32:32FromDiscord<Yardanico> you can use `repr`
04:32:43FromDiscord<Yardanico> !eval echo repr "\x00abc"
04:32:46NimBot0x55e15e6f6870"\0abc"
04:32:53FromDiscord<Yardanico> see the \0 at the start
04:33:11FromDiscord<retkid> yea
04:33:20FromDiscord<retkid> repr might be more insightful
04:34:12FromDiscord<retkid> ahhh
04:34:17FromDiscord<retkid> repr just shows the full thing
04:34:18FromDiscord<retkid> thanks
04:35:49FromDiscord<retkid> well, the origin of this null origin is somewhere in java as this isn't a problem with python or any other lang on this server
04:40:59*lucerne quit (*.net *.split)
04:41:00*ecs quit (*.net *.split)
04:41:00*Amun-Ra quit (*.net *.split)
04:41:00*Onionhammer quit (*.net *.split)
04:41:00*crem quit (*.net *.split)
04:41:17*crem joined #nim
04:41:18*Onionhammer joined #nim
04:41:44*Amun-Ra joined #nim
04:42:32*ecs joined #nim
04:45:07*dom96 quit (*.net *.split)
04:45:08*federico3 quit (*.net *.split)
04:45:08*ormiret quit (*.net *.split)
04:45:08*NimEventer quit (*.net *.split)
04:45:08*clemens3 quit (*.net *.split)
04:45:08*drewr quit (*.net *.split)
04:45:08*koltrast quit (*.net *.split)
04:45:29*ormiret joined #nim
04:45:55*NimEventer joined #nim
04:46:34*drewr joined #nim
04:46:47*clemens3 joined #nim
04:46:52*dom96 joined #nim
04:46:54*koltrast joined #nim
04:46:58*federico3 joined #nim
05:09:26arkanoidWhen I should use cint and when not? c2nim generates code with ctypes, but offer I see the opposite, like in https://github.com/zevv/nimcoro/blob/master/ucontext.nim
05:09:48arkanoids/offer/often/
05:11:52FromDiscord<impbox [ftsf]> use cint when you want an int in c
05:12:20FromDiscord<impbox [ftsf]> if you're calling a c function that takes an int argument, it should take a cint in nim
05:13:44FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3xoK
05:26:37FromDiscord<retkid> yea c interop seems annoying
05:26:49FromDiscord<retkid> im only dealing with c interop on one side which is much more pleasent
05:27:07FromDiscord<impbox [ftsf]> it's a bit annoying, nicer than i've experienced in other languages though
05:27:29FromDiscord<retkid> currently my kotlin/java interop is going very nice and running at full speed
05:27:57FromDiscord<retkid> with communicate over servers
05:28:37FromDiscord<impbox [ftsf]> JRE calling C functions?
05:30:30arkanoidImpbox, thanks. But in the linked example he used nim ints for imported struct attributes. Is cint to be used for function arguments only?
05:30:42FromDiscord<retkid> In reply to @impbox "JRE calling C functions?": YEP
05:30:43FromDiscord<retkid> (edit) "YEP" => "Yep"
05:30:44FromDiscord<impbox [ftsf]> arkanoid, anywhere where you'd use int in c
05:31:25FromDiscord<impbox [ftsf]> so, yes for structs as well, if the struct has an int field in c, use cint in nim
05:31:56FromDiscord<retkid> cint =/=
05:32:21FromDiscord<retkid> (edit) "cint =/= ... " added "int"
05:32:28FromDiscord<retkid> anywhere c is grabbing an int you want to pass ints
05:32:36FromDiscord<retkid> (edit) "ints" => "cints"
05:33:12FromDiscord<impbox [ftsf]> cint in nim = int in c↵int in nim != int in c
05:34:10FromDiscord<impbox [ftsf]> (but depending on platform/compiler int in nim might == int in c so it might look like it works, but if you move to another platform or architecture it might break)
05:34:24FromDiscord<cabboose> Anyone know if chronos async works with dynamic dispatch? I'm encountering some strange behaviour
05:34:41FromDiscord<retkid> on linux
05:34:50FromDiscord<retkid> int and cint work
05:34:56FromDiscord<retkid> cstrings are still character array's tho
05:35:07FromDiscord<retkid> (edit) "array's" => "array"
05:36:10FromDiscord<impbox [ftsf]> i haven't looked but i'd guess they become `char`
05:36:55FromDiscord<retkid> pretty sure nim just stitches them back into strings and then puts them back in arrays
05:41:03NimEventerNew post on r/nim by Ether-naut: How to get the type of an instance of a subclass, see https://reddit.com/r/nim/comments/pebwxi/how_to_get_the_type_of_an_instance_of_a_subclass/
05:57:27FromDiscord<cabboose> Man i'm stupid; I forgot to import chronos on the module that had the base methods with async -.-
06:07:52FromDiscord<linux user> -
06:08:01FromDiscord<linux user> (edit) "-" => "-_-"
06:41:06*PMunch joined #nim
06:48:29*flynn quit (Read error: Connection reset by peer)
06:49:36*flynn joined #nim
07:00:04FromDiscord<fae> idk if i'm doing something wrong in nim or xcode but i can't seem to get a simple proc call working
07:00:43FromDiscord<fae> sent a code paste, see https://play.nim-lang.org/#ix=3xp8
07:02:01FromDiscord<Rika> ?
07:02:03FromDiscord<Rika> whats the issue?
07:02:17FromDiscord<Rika> in what way does it not work
07:02:30FromDiscord<fae> and build it with `nim c -c --os:ios --noMain:on factorial.nim` and copy the resulting C files into my xcode project, I get a linker error saying `ld: 1 duplicate symbol for architecture arm64`
07:02:42FromDiscord<fae> `duplicate symbol '_factorial' in:`
07:03:38FromDiscord<fae> pretty sure i'm not configuring xcode correctly
07:05:57FromDiscord<Elegantbeef> May want to add `cdecl` to that proc definition
07:07:17FromDiscord<enthus1ast> Also asyncnet and asyncdispatch↵(@retkid)
07:07:54FromDiscord<retkid> In reply to @enthus1ast "Also asyncnet and asyncdispatch": I’m long since been down the net rabbithole
07:08:03FromDiscord<enthus1ast> I ser
07:08:09FromDiscord<retkid> How is asyncnet different
07:08:54FromDiscord<fae> In reply to @Elegantbeef "May want to add": hmm tried that but still same linker issue
07:09:05FromDiscord<enthus1ast> They contain Async sockets
07:09:47FromDiscord<retkid> In what usecase are asynchronous sockets be useful
07:10:59FromDiscord<impbox [ftsf]> when you want to do other stuff while you wait for sockets to do their thing
07:11:08FromDiscord<enthus1ast> The netcode i usually write is async.↵You can easily handle multiple clients, states etc without threads and non blocking sockets etc
07:11:35FromDiscord<Elegantbeef> One of the major use cases of async is to avoid blocking io
07:11:36FromDiscord<Elegantbeef> Sockets are io
07:11:40FromDiscord<retkid> Well, my usecase is completely local
07:11:47FromDiscord<retkid> Only 1 client
07:12:24*xet7 quit (Remote host closed the connection)
07:12:24FromDiscord<retkid> The only thing asynchronous might be useful for is handeling multiple commands Being sent in
07:12:27FromDiscord<impbox [ftsf]> but maybe you want to process the last request while you make another request for example
07:13:07FromDiscord<impbox [ftsf]> they're useful in a lot of cases, but for very simple cases you might not need them
07:13:18FromDiscord<retkid> Thinking about it
07:13:26*xet7 joined #nim
07:13:34FromDiscord<retkid> Yea the nim sever might be getting pinged like 60 times a second
07:14:46FromDiscord<enthus1ast> The good thing is that they're quite similar, in fact there even is a multisync pragma so that you can use your code in async or non async fashion↵(@retkid)
07:15:59FromDiscord<enthus1ast> So quite easy to switch to async later when you need it
07:17:00FromDiscord<retkid> I’ll switch over to asynchronous sockets tomorrow. Problem is no matter what with a high volume of sends, I’ll be bottlenecked by Java
07:17:36FromDiscord<retkid> Unless I do some fancy Java parallelism which might not be a thing
07:18:40FromDiscord<impbox [ftsf]> what are you making?
07:19:11FromDiscord<retkid> Nim server for maths and atmospherics and physics
07:19:17FromDiscord<retkid> (edit) "Nim server for maths and atmospherics and ... physics" added "partial"
07:19:35FromDiscord<retkid> Java for applying the outcomes
07:20:14FromDiscord<retkid> This frees me to make things as detailed as I want without worrying about performance, practically
07:30:00PMunchCongrats @exelotl on the Goodboy Galaxy Kickstarter!
07:30:24FromDiscord<impbox [ftsf]> oh yeah! i need to add my fund that!
07:36:53PMunchAh damn, the demo doesn't seem to run under Wine..
07:37:36PMunchI just get an error from wTextCtrl.nim(993) init: Error: unhandled exception: cannot wrap this textctrl. [wError]
07:47:11*xet7 quit (Remote host closed the connection)
07:48:33*xet7 joined #nim
07:49:03*xet7 quit (Read error: Connection reset by peer)
07:50:10*xet7 joined #nim
07:58:42FromDiscord<fae> https://media.discordapp.net/attachments/371759389889003532/881810143766020116/image0.png
07:58:50FromDiscord<fae> Yay I got it working on iOS
07:59:19FromDiscord<fae> Time for Android 😅
07:59:55PMunchOh nice
08:00:10PMunchWhat is it that you're running?
08:01:02FromDiscord<fae> just trying to compile nim procs to c and call them from swift
08:02:05FromDiscord<fae> is there a way to generate header only files with the c compiler? I needed to manually add my function declarations to the `Bridging-Header.h` file
08:03:30*max22- joined #nim
08:04:36*jjido joined #nim
08:05:53FromDiscord<haxscramper> `--header` is deprecated, so currently the only "official" way to do this is to write things manually
08:06:37PMunchWait, is `--header` deprecated?
08:06:43PMunchThat's a shame
08:07:16FromDiscord<haxscramper> But if you want I suppose you can use `--header`, since it was deprecated because of https://github.com/nim-lang/Nim/commit/279df834bae8b6972af6cbcbdd57c1d53e1df9c7
08:07:50*Vladar joined #nim
08:08:37FromDiscord<fae> ahh. Well considering I only plan on having one entry point it’s not really a big deal
08:09:00FromDiscord<haxscramper> It is still even in devel docs https://nim-lang.github.io/Nim/backends.html#interfacing-backend-code-calling-nim
08:09:22FromDiscord<haxscramper> > ↵> The Nim compiler can generate a C interface header through the --header command-line switch. The generated header will contain all the exported symbols and the NimMain proc which you need to call before any other Nim code.↵>
08:10:03FromDiscord<haxscramper> So I suppose you can use it, just be aware that it is "kind of not recommended to do so"
08:10:16FromDiscord<fae> Gotcha, ty for the reference
08:10:34FromDiscord<xflywind> PR is welcome to remove the docs.
08:11:30FromDiscord<haxscramper> I'm the wrong person to do so, if anything I'd prefer to have `--header` or something similar to this
08:12:18*xet7 quit (Remote host closed the connection)
08:13:05FromDiscord<xflywind> I see, I'll make an issue
08:13:57*xet7 joined #nim
08:14:32FromDiscord<haxscramper> Maybe there is no need to push so hard for this to be completely eradicated?
08:15:58FromDiscord<fae> It could be helpful to people like myself who aren’t very familiar with native compilation
08:17:20FromDiscord<xflywind> ok
08:17:21FromDiscord<haxscramper> I suppose something like `--header` is deprecated, please write your 120 exported procs by hand in C
08:17:22FromDiscord<haxscramper> Would be more appropriate for now
08:17:43FromDiscord<haxscramper> Util it is completely removed from the compiler
08:18:03FromDiscord<Elegantbeef> I do have to ask hax, did it need much/any manual touch up?
08:18:35FromDiscord<dom96> I wish it wasn’t deprecated :/
08:18:37FromDiscord<dom96> I use it
08:18:45FromDiscord<haxscramper> `--header`?
08:18:45FromDiscord<xflywind> It has been removed from command helps though
08:18:45FromDiscord<Elegantbeef> The output file
08:18:47FromDiscord<haxscramper> No, I don't recall doing any manual modifications to it
08:19:14FromDiscord<dom96> If it’s really deprecated though. The compiler should output a warning when it’s used
08:19:24FromDiscord<Rika> It is a shame it was removed, but is there anyone to maintain it?
08:19:25FromDiscord<Elegantbeef> I mean it's clearly a beneficial feature to have
08:20:05FromDiscord<haxscramper> If we could `{.push` custom macros it would mostly solve the problem I think
08:20:06FromDiscord<haxscramper> https://github.com/nim-lang/Nim/commit/279df834bae8b6972af6cbcbdd57c1d53e1df9c7#commitcomment-53179688
08:20:47FromDiscord<linux user> repost
08:22:31FromDiscord<fae> i feel i brought up a touchy subject lol
08:22:57FromDiscord<Rika> Doesn’t seem to be touchy
08:23:35PMunchEveryone seems to agree that we want the feature, just no-one wants to maintain it :P
08:23:40FromDiscord<fae> it didnt until i read the comments on the commit
08:23:46FromDiscord<impbox [ftsf]> seems like a useful feature to have, but sounds like it's a pain to implement
08:23:47FromDiscord<fae> from at least one individual
08:23:48FromDiscord<dom96> Could we reimplement it with macros? 😄
08:24:36PMunchHmm, I guess some of it could be done by a macro
08:24:49PMunchBut it might be hard to get totally right
08:24:52FromDiscord<dom96> I’m wondering where the complexity is
08:25:01FromDiscord<dom96> I did just wake up though
08:25:17PMunchWell it requires you to turn Nim AST into C signatures, something the compiler already knows how to do..
08:25:40FromDiscord<Elegantbeef> I mean you'd do the same work the compiler did
08:26:02PMunchAnd then you'd need to figure out how this all should be written to a file, something which sounds easy until you start considering imports, ordering, etc.
08:26:02FromDiscord<Elegantbeef> You'd be rewriting cgen inside the nim vm basically
08:26:18PMunchExactly, so it's definitely beneficial for the compiler to handle it
08:26:50PMunchI mean it is already generating the C code, so it's just a matter of not generating the code, but just the signatures.
08:27:06FromDiscord<Elegantbeef> There is also a possible issue of naming of types/fields but idk about that one
08:27:23FromDiscord<haxscramper> In reply to @dom96 "Could we reimplement it": we can, just make something like `.exportcWithHeader.` and then call compile-time `writeHeaders()`
08:27:33FromDiscord<dom96> Hm. Could it be restricted in such a way that it makes generation easier? For example: only C types allowed (cstring etc)
08:27:40FromDiscord<haxscramper> `const headerDir {.strdefine.} = <get nimcache directory>`
08:27:46FromDiscord<Elegantbeef> when a programmer uses the word "just" be cautious 😛
08:27:48FromDiscord<dom96> In reply to @haxscramper "we can, just make": Yeah. That’s what I have in mind.
08:28:21*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:29:01PMunchYou'd still need to get Nims C mangling rules right
08:29:07FromDiscord<haxscramper> No
08:29:12PMunchWhich might actually be impossible to do from a macro
08:29:21FromDiscord<fae> I dont really understand C very well but it looks like the compiler already kind of generates headers inside of the generated `.c.` files even without the `--headers` flag
08:29:25FromDiscord<haxscramper> When nim generates headers it generates regular names
08:29:36FromDiscord<impbox [ftsf]> for exportc procs they should be the same right?
08:29:41FromDiscord<impbox [ftsf]> not mangled
08:29:43FromDiscord<haxscramper> I have `.exportc.` already, so I don't have to deal with `sdjf;klasjdfklasjd` sighashes
08:29:46FromDiscord<fae> sent a code paste, see https://play.nim-lang.org/#ix=3xpF
08:29:49FromDiscord<Elegantbeef> Seems the idea is you search the nim output dir to get the signtures
08:29:55FromDiscord<fae> and then the definition is bleow
08:30:24FromDiscord<fae> (edit) "`.c.`" => "`.c`"
08:30:54FromDiscord<haxscramper> In reply to @Elegantbeef "Seems the idea is": No, signatures have nothing to do with anything, we want to generate usable header, which means there is no signatures involved as I have all procs already annotated with `.exportc`
08:30:54FromDiscord<Elegantbeef> Those are forward declared
08:30:57FromDiscord<haxscramper> That does not mangle names
08:31:14FromDiscord<Elegantbeef> But parameters names can be no?
08:31:22FromDiscord<Elegantbeef> say you take a `seq[byte]`
08:31:45FromDiscord<haxscramper> Well, the moment I find out how to sanely interface between C and nim generics I will let you know
08:32:13FromDiscord<haxscramper> and `seq[byte]` details is an impl. detail
08:32:16FromDiscord<Elegantbeef> Can you exportc an alias?
08:33:01FromDiscord<dom96> Usually you’d avoid exporting Nim procs that take Nim types.
08:33:18FromDiscord<dom96> So I think it’s fair to not bother supporting those
08:34:01FromDiscord<haxscramper> For `seq[int]` `--header` generates `N_LIB_PRIVATE N_NIMCALL(tySequenceqwqHTkRvwhrRyENtudHQ7g, aa)(void);`
08:34:13FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3xpH
08:34:16FromDiscord<Elegantbeef> Ah you can export aliases
08:34:17FromDiscord<haxscramper> You can't get around it
08:34:54FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3xpJ
08:35:04FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3xpK
08:35:13FromDiscord<haxscramper> But that's just `{.exportc.}` everything just as I said
08:35:23FromDiscord<haxscramper> but still
08:35:54FromDiscord<haxscramper> So in the end it can be just done via simple name-based translation
08:36:23FromDiscord<Elegantbeef> Yea i was just curious if you could get a usable C type name for generics
08:40:23FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3xpL
08:40:51FromDiscord<haxscramper> `exHeader` implementation is left as an exercise for the reader
08:40:52FromDiscord<Elegantbeef> Could just link the cgen directory for that 😜
08:41:18FromDiscord<haxscramper> Well, maybe I will implement something like that in hmisc
09:00:11*krux02 joined #nim
09:00:11*jjido joined #nim
09:15:09*razzlom joined #nim
09:27:14*razzlom quit (Quit: Quit)
09:28:55*razzlom joined #nim
09:30:04emerycan anyone see anything oviously wrong with this type? I'm losing a layer of the generic typing with the sets https://play.nim-lang.org/#ix=3xq3
09:36:16*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:37:23FromDiscord<KnorrFG> Hey, is anyone aware of a "bidirectional table" for nim?
09:40:24FromDiscord<impbox [ftsf]> not that i know of, but it seems like it'd be trivial to make
09:41:53*zargot joined #nim
09:52:39FromDiscord<impbox [ftsf]> @KnorrFG https://play.nim-lang.org/#ix=3xqn
09:53:24emerymy bad type, but simpler https://play.nim-lang.org/#ix=3xqp
09:53:36*razzlom quit (Remote host closed the connection)
09:54:31FromDiscord<impbox [ftsf]> @KnorrFG though this implementation won't work if your key and value are the same type since the calls will be ambigious
10:10:12FromDiscord<KnorrFG> thanks for the answer. Yeah I know, its not that hard superficially, but I foggily remember that just wrapping 2 tableswasnt a good idea for some reason. Also I didnt want to reimplement all the methods 😛
10:10:30FromDiscord<impbox [ftsf]> just implement the ones you need =)
10:11:47FromDiscord<impbox [ftsf]> i guess there's probably less memory heavy ways where you'd only store the data once and then use indices or something, but depends if that's a bottleneck
10:24:05*arkurious joined #nim
10:32:55FromDiscord<Rika> In reply to @impbox "<@!689821975463460892> https://play.nim-lang.org/#i": If the types are the same you can just use the same table
10:33:03FromDiscord<Rika> Rather a single table
10:45:50FromDiscord<impbox [ftsf]> not necessarily
10:46:34FromDiscord<Rika> I don’t see why
10:46:38FromDiscord<Rika> Not
10:46:39FromDiscord<impbox [ftsf]> both types might be strings, but A"foo" -> B"bar" but A"bar" -> B"baz"
10:47:07FromDiscord<Rika> I thought the invariant was that the value points to the key and the key points to the value
10:48:39FromDiscord<impbox [ftsf]> Key"foo" -> Value"bar"↵Key"bar" -> Value"baz"↵but to get the reverse you need a separate table that maps Value"bar"->Key"foo"
10:49:41FromDiscord<Rika> Well how would you access the bar that points to baz?
10:50:07FromDiscord<Rika> Are there two procs for “key index” and “value index”?
10:50:34FromDiscord<impbox [ftsf]> that's what I was saying, that implementation wouldn't work because it'd be ambiguous
10:50:43FromDiscord<impbox [ftsf]> but you could use distinct types
10:51:08FromDiscord<impbox [ftsf]> or add a reverse lookup proc
10:51:10FromDiscord<haxscramper> For bidirectional `Set[Key] -> Value` I had to do https://haxscramper.github.io/hmisc/hmisc/types/rev_set_table.html
10:51:26FromDiscord<haxscramper> Which has explicit reverse lookup procs
10:52:00FromDiscord<haxscramper> If I drop `Value -> Set[Key]` getters, I still need to have two bidirectional checks
10:52:56FromDiscord<Rika> Okay I get it
10:53:07FromDiscord<haxscramper> And double all API parts, like `hasKey()`, `hasValue()`, `getKey(V)`, `getValue(K)`
10:59:29*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
11:04:44FromDiscord<enthus1ast> Or have 3 tables one with the data, one with one relation, one with the other, then lookup In relation table and get the data in a second lookup
11:05:25FromDiscord<enthus1ast> Have build a "database" this way
11:13:12FromDiscord<Rika> In reply to @enthus1ast "Have build a "database"": So a graph database
11:15:12FromDiscord<haxscramper> How do I debug 'generic instantiation is too nested', especially when it seems like everything is working as expected? I did `static: echo` for instantiated types, and it does not show any weird loops or anything of that sort
11:15:20FromDiscord<haxscramper> I do have relatively deep instantiation though
11:18:49FromDiscord<exelotl> Thanks PMunch and @impbox [ftsf] <3
11:19:30PMunchIt looks awesome as always!
11:19:39PMunchBut I can't run the emulated version under Wine (:
11:19:41PMunch:(*
11:20:42FromDiscord<exelotl> Oh, the PC download doesn't work in Wine due to something going wrong in wNim I think
11:21:00PMunchYeah I got an error from wNim
11:21:14PMunchwTextCtrl.nim(993) init: Error: unhandled exception: cannot wrap this textctrl. [wError]
11:22:05FromDiscord<exelotl> It's strange, just some winapi function returning null when it shouldn't, but I didn't have time to figure it out :(
11:23:06FromDiscord<exelotl> But you can always install mGBA or another emulator of your choice and run the game in there ^^
11:25:20FromDiscord<exelotl> Also we added more physical copies to the KS page, these are the "regular" First Press editions, but will be unlimited hopefully! :D
11:41:20PMunchOh nice, unfortunately I'm so old that I only have a GBC..
11:46:13*jjido joined #nim
12:02:50PMunchIs there a way to get the names of built-in stuff?
12:03:09PMunchOr should I just used declared or whatever it's called to avoid collisions with existing names?
12:06:01*supakeen quit (Quit: WeeChat 3.2)
12:06:16PMunchHmm "declared" doesn't work for e.g. "else"
12:06:30*supakeen joined #nim
12:06:30PMunchI just want to check if something would be a valid type name or if it would collide with anything
12:07:30PMunchI guess I could manually copy this list.. https://nim-lang.org/docs/manual.html#lexical-analysis-identifiers-amp-keywords
12:08:09FromDiscord<Rika> I’m interested in why you need this haha
12:09:00FromDiscord<impbox [ftsf]> maybe there's a isValidIdentifier function in nim somewhere
12:09:22FromDiscord<impbox [ftsf]> https://github.com/nim-lang/Nim/blob/8ccde68f132be4dba330eb6ec50f4679e564efac/doc/keywords.txt
12:10:37FromDiscord<haxscramper> `std/strutils.validIdentifier`
12:10:55FromDiscord<haxscramper> PMunch\: do you need this for your clang bindings?
12:11:23FromDiscord<impbox [ftsf]> https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/strutils.nim#L2389 doesn't look like that checks against keywords
12:11:36PMunch@Rika, I'm using libclang to automatically create Nim bindings for C libraries
12:11:40FromDiscord<haxscramper> https://haxscramper.github.io/hmisc/hmisc/algo/namegen.html#isReservedNimWord%2Cstring
12:12:41PMunchOh cool, that'll be helpful
12:12:50FromDiscord<haxscramper> ffs, nim "--PrOJeCt" is randomly breaks source links. Anyway, full list is https://github.com/haxscramper/hmisc/blob/master/src/hmisc/algo/namegen.nim#L147
12:13:37FromDiscord<whisperdev> Hmm how does one zip a single file with this library? https://github.com/guzba/zippy
12:13:40nrds<R2D299> itHub: 7"Pure Nim implementation of deflate, zlib, gzip and zip."
12:14:09FromDiscord<haxscramper> `readFile().compress()`?
12:14:25FromDiscord<haxscramper> `writeFile("out", "in".readFile().compress())`
12:15:01FromDiscord<whisperdev> aha
12:16:01FromDiscord<whisperdev> Thanks!
12:21:11*xet7 quit (Read error: Connection reset by peer)
12:21:32*xet7 joined #nim
12:23:19PMunchUhm, that would read the entire file into memory though
12:23:20PMunchSo beware
12:26:38FromDiscord<whisperdev> It seems I cant just unzip the file afterwards in Windows
12:26:58FromDiscord<impbox [ftsf]> it's probably not a zip
12:27:10FromDiscord<impbox [ftsf]> just a compressed file
12:27:24FromDiscord<impbox [ftsf]> rather than an archive of multiple files
12:28:25FromDiscord<Rika> In reply to @PMunch "<@259277943275126785>, I'm using libclang": Ooh I see
12:28:29FromDiscord<impbox [ftsf]> https://github.com/guzba/zippy/blob/master/examples/ziparchive_compose.nim#L5
12:28:37FromDiscord<impbox [ftsf]> @whisperdev try this
12:28:55FromDiscord<whisperdev> I was looking at it before
12:28:58FromDiscord<whisperdev> now it makes sense
12:40:15*rockcavera joined #nim
12:40:15*rockcavera quit (Changing host)
12:40:15*rockcavera joined #nim
12:48:07*max22- quit (Ping timeout: 250 seconds)
12:51:37FromDiscord<Cark> how can I get an openarray from a bunch of bytes at some pointer address (i have the length too)
12:52:41FromDiscord<Cark> (edit) "how can I get an openarray from a bunch of bytes at some pointer address (i have the length too) ... " added "?"
12:53:10PMunch@Cark, probably this: https://nim-lang.github.io/Nim/system.html#toOpenArray%2Cptr.UncheckedArray%5BT%5D%2Cint%2Cint
12:53:33FromDiscord<Cark> mhh worth a try, thanks !
12:55:04*flynn quit (Read error: Connection reset by peer)
12:56:11*flynn joined #nim
12:56:51FromDiscord<Neko~Neko~ni> sent a long message, see http://ix.io/3xr6
13:01:22FromDiscord<impbox [ftsf]> nim doesn't create the executable, the C linker does, so it's up to that to support it
13:01:32FromDiscord<impbox [ftsf]> you can pass arguments to the linker to specify the icon
13:02:07FromDiscord<Neko~Neko~ni> i know that but aren't there option in gcc for adding icons
13:02:27*kayabaNerve_ joined #nim
13:02:42FromDiscord<impbox [ftsf]> --passL:"icon.res"
13:03:16*kayabaNerve quit (Killed (NickServ (GHOST command used by kayabaNerve_)))
13:03:20FromDiscord<Neko~Neko~ni> i see.how do i pass arguments to the linker?
13:03:20*kayabaNerve_ is now known as kayabaNerve
13:03:29FromDiscord<impbox [ftsf]> with --passL
13:03:46FromDiscord<impbox [ftsf]> `--passL:"this is an argument to the linker"`
13:03:58FromDiscord<impbox [ftsf]> https://nim-lang.org/docs/nimc.html
13:03:59FromDiscord<Neko~Neko~ni> gottcha👍
13:07:48FromDiscord<whisperdev> @impbox [ftsf] That worked great.
13:08:31FromDiscord<whisperdev> How would I overwrite the the compression method parameters when calling the writeZipArchive method?
13:08:39FromDiscord<whisperdev> Or would I just make my own declaration with what I want?
13:12:50FromDiscord<impbox [ftsf]> i'm not sure sorry
13:14:02FromDiscord<whisperdev> Not a question for you and in regard to zippy just in general 😄
13:44:36*PMunch quit (Quit: Leaving)
14:11:36*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:22:26*krux02 quit (Quit: Leaving)
14:55:00FromDiscord<Cark> ok so I think I'm missing some declarations in winuser.h, which i guess is the one in my mingw64 distribution. I'm on windows, my guess is that nim uses the mingw64 which is in the path
14:55:32FromDiscord<Cark> that version is quite outdated on my computer, and i see the current mingw64 has that declaration
14:55:56FromDiscord<Cark> can i just replace the content of that folder with the updated version ?
14:57:50FromDiscord<Cark> btw i've been trying clang-cl and vcc, but so many warnings =)
14:58:48*flynn quit (Read error: Connection reset by peer)
14:59:30FromDiscord<Yardanico> In reply to @Cark "btw i've been trying": that's not really an issue, nim silences them usually, if it doesn't then something's wrong :P
14:59:33FromDiscord<Yardanico> In reply to @Cark "can i just replace": yes
14:59:49FromDiscord<Cark> @Yardanico thanks !
14:59:55*flynn joined #nim
15:00:04FromDiscord<Cark> doesn't silence them on my computer though ...maybe something wrong here
15:02:36FromDiscord<Cark> ah i now can declare the missing function, and it actually works, thanks again
15:10:08*max22- joined #nim
15:19:33*jjido joined #nim
15:40:20*beshr joined #nim
15:48:50FromDiscord<dauuricus (haywhnk)> i'm searching for info about how to build Nim compiler on termux ...
16:05:38*pch_ is now known as pch
16:19:19NimEventerNew thread by JohnLuck: Any way to avoid the SQL bugs and execute raw strings?, see https://forum.nim-lang.org/t/8382
16:34:48*zargot quit (Quit: leaving)
17:14:10*pro joined #nim
17:24:29FromDiscord<Goat> Anyone here know of a good Emacs .org parser for nim?
17:32:55*lucerne joined #nim
17:40:54*flynn quit (Read error: Connection reset by peer)
17:42:01*flynn joined #nim
17:49:15FromDiscord<haxscramper> Good/working - no, but I'm finally (after N months of delays) got back to https://github.com/haxscramper/haxorg and I want to finish it
17:49:18nrds<R2D299> itHub: 7"<No Description>"
17:51:16FromDiscord<haxscramper> Right now I got implementation of the main lexer logic, some parsing, tree pretty-printing for parsed tree, AST spec for untyped and WIP spec for semchecked AST
18:16:59*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
18:24:17*flynn quit (Remote host closed the connection)
18:25:20*jjido joined #nim
18:25:24*flynn joined #nim
18:44:07*pro quit (Quit: WeeChat 3.2)
19:03:42FromDiscord<RattleyCooper> I compiled nim 1.4.8 on my rapsberry pi 4 but for some reason it really doesn't like this line from `netty`: `r.rand(high(uint32).int).uint32` . For some reason it doesn't want to convert an `int` to an `int32` (or maybe it's the other way around).
19:05:23FromDiscord<RattleyCooper> The `netty` script is the same on both my windows machines and the raspberry pi machine and it still throws an error when I try to use it on the rpi
19:41:41FromDiscord<Varriount> In reply to @RattleyCooper "I compiled nim 1.4.8": What message do you get?
19:45:16FromDiscord<RattleyCooper> I will have to check tonight. I really should have written it down or screencapped it. I was refraining from posting the error until I could confirm there was actually an issue.
19:45:36FromDiscord<RattleyCooper> I believe it was an OSError though. I can check after work and update.
21:03:33*Vladar quit (Quit: Leaving)
21:16:42*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
21:25:21*ozzz quit (Ping timeout: 248 seconds)
21:27:40FromDiscord<brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=3xud
21:28:16FromDiscord<brainproxy> I feel I'm hitting an encoding problem, maybe, or maybe I've misunderstood how to defined `hash`
21:30:53FromDiscord<Yardanico> to properly define `hash` you have to run `hash` on all fields of your character, and all types of the fields of the object should have `hash` defined too
21:31:00FromDiscord<Yardanico> see https://nim-lang.org/docs/hashes.html
21:31:09FromDiscord<Yardanico> for an example on defining a hash proc for a custom type
21:31:34FromDiscord<brainproxy> but if hash for that type is `hash $instance`
21:31:41FromDiscord<brainproxy> then should string hashes get compared?
21:31:51FromDiscord<brainproxy> (edit) "should" => "shouldn't"
21:40:28FromDiscord<Yardanico> In reply to @brainproxy "then shouldn't string hashes": yes, but IMO it's not good to rely on this
21:57:34FromDiscord<konsumlamm> In reply to @brainproxy "I have an `OrderedSet[MyType]`.": `hash` should return an `int`, not a `string`↵are you sure that your `hash` implementation is consistent with `==`?
22:02:30FromDiscord<Yardanico> oh lol, didn't see that
22:13:31*Gustavo6046 quit (Ping timeout: 252 seconds)
22:15:57*Gustavo6046 joined #nim
22:16:17*max22- quit (Quit: Leaving)
22:22:17FromDiscord<trenta3> sent a code paste, see https://play.nim-lang.org/#ix=3xuo
22:28:10*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
22:30:45*Gustavo6046 joined #nim
22:35:34*Gustavo6046_ joined #nim
22:35:40*Gustavo6046 quit (Ping timeout: 240 seconds)
22:38:00*Gustavo6046_ is now known as Gustavo6046
22:39:19FromDiscord<RattleyCooper> In reply to @trenta3 "Is there a way": IIRC you can do this in a template with `unpackVarargs` from the `macros` library. You can also use a tuple
22:41:26FromDiscord<trenta3> In reply to @RattleyCooper "IIRC you can do": I did find `unpackVarargs` by searching in the documentation. What I don't understand is how to implement the part in the line `args += (element,)`, where I need to update a tuple by adding an element at the end of it. This is a part that I cannot realize using unpackVarargs or other methods that I know of.
22:46:07*byanka__ quit (Ping timeout: 240 seconds)
22:55:23FromDiscord<RattleyCooper> In reply to @trenta3 "I did find `unpackVarargs`": So, it looks like the decorator parses stuff and then runs some kind of function using the aggregated outputs from the parsing functions. It's kinda difficult to give you direction though because depending on what you're parsing, and the variability of the types used as inputs to that last function call, it's gonna be a different answer
22:56:28FromDiscord<RattleyCooper> Bc you can definitely do what you're trying to accomplish, but depending on types and that kind of stuff it'll likely just end up working different than python.
23:01:21*Gustavo6046 quit (Read error: Connection reset by peer)
23:01:25*Gustavo6046_ joined #nim
23:02:20FromDiscord<trenta3> In reply to @RattleyCooper "So, it looks like": Yes the types of the parsed elements are widely different, and it doesn't really matter to me if it ends up working differently from python.↵I would like to have something that works and performs more or less such kind of recursive usage of varargs.
23:02:56FromDiscord<trenta3> Searching on the internet I couldn't find any examples and I feel it is too early for me to start writing macros
23:03:25*Gustavo6046_ is now known as Gustavo6046
23:06:47FromDiscord<trenta3> If you could just point me to a possible way to archieve it, that would be awesome
23:07:10FromDiscord<Elegantbeef> Could you give a more elaborate input/output example?
23:08:46FromDiscord<trenta3> In reply to @Elegantbeef "Could you give a": I'm really just interested in how to handle packing and unpacking of tuples, since this is what I don't know how to archieve. The example was mainly "motivating". I will write a more complete example shortly.
23:10:00FromDiscord<RattleyCooper> There is no "pythonic" way to pass args using an arbitrary iterable like python's `someFunc(someArgs, someKwargs)`
23:10:59FromDiscord<RattleyCooper> You can unpack args similar to python: `(arg1, arg2) = someFuncThatReturnsTuple()`
23:11:10FromDiscord<RattleyCooper> (edit) "args" => "tuples"
23:11:50*stkrdknmibalz joined #nim
23:12:22FromDiscord<RattleyCooper> It's kind of funny bc I was coming from python a few weeks ago and had the same exact question lol. Unfortunately it's just not an easy answer due to Nim's strict type system
23:13:16nrds<Prestige99> or fortunately :P
23:14:26FromDiscord<Elegantbeef> Well there is but to a template rattley and it's in devel
23:14:28FromDiscord<Elegantbeef> `iterable[T]` exists in `devel` \:D
23:14:35FromDiscord<RattleyCooper> 😮
23:15:06FromDiscord<Elegantbeef> For examples of it in use https://github.com/beef331/truss3d/blob/master/src/truss3D/models.nim#L176-L221
23:15:07FromDiscord<trenta3> In reply to @RattleyCooper "It's kind of funny": Ouch, that was actually unexpected, since the `varargs[untyped]` seemed to be exactly the kind of way out of the type system that allows you to do it.↵I see that the implementation of `unpackVarargs` is very short. Maybe I can try to write similar thing to pack and unpack tuples
23:15:48FromDiscord<RattleyCooper> Lol, same thing I though XD
23:15:54FromDiscord<Elegantbeef> Well Nim has tuple unpacking
23:16:29FromDiscord<Elegantbeef> Could also look at https://github.com/technicallyagd/unpack
23:16:32nrds<R2D299> itHub: 7"sequence/object unpacking/destructuring for nim"
23:16:34FromDiscord<Elegantbeef> Alternatively https://hlaaftana.github.io/assigns/assigns.html
23:18:32FromDiscord<RattleyCooper> In reply to @trenta3 "Ouch, that was actually": You should definitely check out macros when you have a few minutes. It's kind of confusing at first but it is well worth the time to learn
23:19:26FromDiscord<trenta3> In reply to @Elegantbeef "Could also look at": Thanks a lot! This seems a really interesting project to look at and I should definitely try to understand the implementation
23:21:02FromDiscord<trenta3> In reply to @RattleyCooper "You should definitely check": I know it pays. Unfortunately nim macro syntax does seem wizardry to me
23:21:39FromDiscord<trenta3> Building the AST components manually is no fun
23:21:48FromDiscord<Elegantbeef> It's simply writing code to write code. Bit confusing at start but once you get to the AST it's fine
23:21:54FromDiscord<RattleyCooper> In reply to @trenta3 "Building the AST components": You need some `quote do` in your life
23:22:07FromDiscord<Elegantbeef> Well that's why there are things like genast and quote, use those as much as you can
23:22:52FromDiscord<Elegantbeef> You can also break the macro into smaller procedures to make it more managable
23:23:23FromDiscord<RattleyCooper> Looking at actual macros helps too... I didn't get it until I looked at your macro in nettyrpc beef
23:23:43FromDiscord<RattleyCooper> and started using treerepr/repr etc
23:23:53FromDiscord<Elegantbeef> Yep if you need a source of macros, i've got more than a couple libraries that use htem
23:24:22FromDiscord<Elegantbeef> kashae, constructor, nettyrpc, sumtypes(shittiest) 😀
23:25:06FromDiscord<Elegantbeef> You also can ask here i'm more than happy to help
23:25:10FromDiscord<RattleyCooper> I'm gonna check out kashae and constructor macros next.
23:26:15*krux02 joined #nim
23:26:37FromDiscord<Elegantbeef> Kashae i think uses more quote do than nettyrpc did, so should be more understandable, but yea still AST manipulation in there
23:26:58FromDiscord<trenta3> In reply to @Elegantbeef "Well that's why there": Thanks I'm gonna look at those.
23:40:37*flynn quit (Read error: Connection reset by peer)
23:41:43*flynn joined #nim
23:49:19*auxym_ joined #nim