00:39:42 | FromDiscord | <Phil> In reply to @_ 🎄 "does Nim have pattern": You mean rust style pattern matching? Not in the default syntax, but may be in packages as amadan through in there |
00:40:46 | FromDiscord | <Phil> (edit) "through in there" => "stated" |
00:43:25 | FromDiscord | <newgreenshoot> what would be the best cross-platform way to check the available disk space at a given path? I need to download a large file, but if the user doesn't have enough space for it, I need to catch that beforehand so I can tell them how much free space is required. I can't find anything in the standard library for this, nor any Nimble packages. |
01:07:40 | madprops | merry christmas |
01:18:42 | * | xet7 quit (Quit: Leaving) |
01:22:16 | NimEventer | New post on r/nim by abionic: [Feedback] My first Nim Project, and a Blog, see https://reddit.com/r/nim/comments/1008lqu/feedback_my_first_nim_project_and_a_blog/ |
01:28:19 | * | arik_ joined #nim |
01:35:22 | * | nick1 quit (Quit: WeeChat 3.7.1) |
02:47:03 | FromDiscord | <Boston> In reply to @newgreenshoot "what would be the": Fileapi.h? Does winim implement that |
03:32:38 | * | arik_ quit (Quit: Konversation terminated!) |
03:34:48 | FromDiscord | <albassort> is there a nim formatter |
03:34:50 | FromDiscord | <albassort> in vscode |
03:37:46 | * | Batzy quit (Quit: No Ping reply in 180 seconds.) |
03:39:06 | * | Batzy joined #nim |
03:52:45 | * | Batzy quit (Ping timeout: 268 seconds) |
04:12:55 | FromDiscord | <arik> The one that exists is nimpretty, I don't think it's integrated in vscode |
04:14:43 | FromDiscord | <sOkam!> How would you approach parsing a string representation of objects into nim types?↵Is there a pre-existing configurable parser that's usable for different cases, or would I need to write the whole lexer-parser-ast from scratch? |
04:17:22 | * | xet7 joined #nim |
04:32:35 | FromDiscord | <beans> is there a way in nim to see if any files have open file handles, like with the linux command `lsof`? |
05:01:54 | FromDiscord | <Rika> You can always ad hoc it with parse utils module (combined lexer parser) |
05:02:18 | FromDiscord | <Rika> If you want you can skip the AST generation too and parse into the object |
05:43:12 | FromDiscord | <sOkam!> That's what i did for an early impl of the game levels format, yep. Was just wondering if there is some other more specific tool, since I know so little about lang parsing/etc |
05:43:56 | FromDiscord | <sOkam!> But I guess it makes sense, that it would be just using that module + customizing whatever behavior it needs to have |
05:51:01 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4k5t |
05:52:55 | FromDiscord | <sOkam!> ah i see. if I remove the explicit numbers they work↵why do these not work? any ideas? https://media.discordapp.net/attachments/371759389889003532/1058986155820986468/image.png |
06:00:24 | FromDiscord | <Rika> In reply to @sOkam! "ah i see. if": A set of enums stores the enum like this: 1 << value of enum |
06:00:37 | FromDiscord | <Rika> So you store the bit shift count, not the or’ed value |
06:00:57 | FromDiscord | <Rika> So no steps should be 14 or something and not 0x2000 |
06:01:05 | FromDiscord | <Rika> Non solid should be 15 |
06:01:09 | FromDiscord | <Rika> And etcetera |
06:02:21 | FromDiscord | <Rika> Does that make sense? I don’t know lol |
06:11:37 | FromDiscord | <newgreenshoot> In reply to @Boston "Fileapi.h? Does winim implement": seems a little low-level, but either way, only accounts for Windows at best. Would be nice to have something like Python's shutil.disk_usage that provides a universal way of querying usage stats, since that seems fairly basic, but I haven't been able to find anything like that |
06:19:57 | FromDiscord | <newgreenshoot> I did find <https://github.com/johnscillieri/psutil-nim> which apparently has a disk_usage function but it seems like it's abandoned↵equally I found <https://nimble.directory/pkg/psutilim> which says it's an updated version, but the GH link is a 404 |
06:21:20 | FromDiscord | <newgreenshoot> ah wait, I think they just changed their username without updating the Nimble package, so the link is now <https://github.com/Techno-Fox/psutil-nim>↵↵this might be just what I need |
06:23:45 | * | arkurious quit (Quit: Leaving) |
06:39:41 | FromDiscord | <that_dude> In reply to @newgreenshoot "seems a little low-level,": Well you you're interested in how python does it, there should be modules that provide good interop with python modules |
06:40:50 | FromDiscord | <that_dude> https://github.com/yglukhov/nimpy May be of interest. I'm not sure how non stdlib modules would work tho |
07:56:50 | FromDiscord | <ShalokShalom> In reply to @newgreenshoot "ah wait, I think": It explicitly says, it only works on Linux |
08:15:59 | * | rockcavera quit (Remote host closed the connection) |
08:21:55 | * | kenran joined #nim |
08:22:24 | * | kenran quit (Remote host closed the connection) |
08:44:35 | FromDiscord | <untoreh> sent a code paste, see https://play.nim-lang.org/#ix=4k5O |
08:49:32 | FromDiscord | <sOkam!> In reply to @Rika "Non solid should be": the values are preset from C↵I was trying to keep compatibility to avoid the middle step of translating one system to the other... but... f it. I'll usie nim syntax instead, and translate if required |
08:50:17 | FromDiscord | <sOkam!> (edit) "C↵I" => "C, all old maps come with the values compiled in them↵I" | "other..." => "other on loading..." | "if required" => "them. There are not that many anyway" |
08:51:27 | FromDiscord | <sOkam!> With Nim I've learn the insane power of not having to fight the syntax, so I'll stick to that |
08:51:38 | FromDiscord | <Rika> In reply to @sOkam! "the values are preset": You will keep compatibility if you use solely sets since they will have the correct value |
08:51:59 | FromDiscord | <sOkam!> you mean sets of const, instead of enums? |
08:52:10 | FromDiscord | <Rika> Sets of enums |
08:52:25 | FromDiscord | <sOkam!> i don't catch what you mean then |
08:53:11 | FromDiscord | <Bung> any thoughts on this ? https://github.com/nim-lang/website/pull/353 |
08:53:24 | FromDiscord | <Rika> {NoSteps} where nosteps is value 14 will be valued 0x2000 when casted to an integer |
08:53:42 | FromDiscord | <Rika> Given the enum starts at 0x1, thoufh |
08:53:46 | FromDiscord | <Rika> (edit) "thoufh" => "though" |
08:54:24 | FromDiscord | <sOkam!> yeah, but what about the gaps? there must be some, i imagine |
08:54:36 | FromDiscord | <Rika> Gaps dont matter if your enum starts at 1 |
08:54:57 | FromDiscord | <Rika> I dont understand otherwise what you mean by gaps |
08:55:27 | FromDiscord | <sOkam!> 1000001 is a gap, if i only mark the first and the last in the list of values for the enum |
08:55:59 | FromDiscord | <sOkam!> the enum would be 0000011, but I intended 1000001 |
08:56:46 | FromDiscord | <Rika> If you have an enum a = 1 and b = 4 then the set {a, b} will be 0b1001 |
08:56:51 | FromDiscord | <Rika> I think |
08:57:01 | FromDiscord | <Rika> Idk exactly the gap but there will be |
08:57:12 | FromDiscord | <sOkam!> right, but that's what I had and it was complaining about 2^16 |
08:57:12 | FromDiscord | <Rika> This relies on the fact that the first entry is valued 1 |
08:57:42 | FromDiscord | <Rika> Because you had the values as 1 << x and not just x |
08:58:00 | FromDiscord | <Rika> Because putting it into the set would result in 1 << (1 << x) |
08:58:05 | FromDiscord | <Rika> As a value |
08:58:17 | FromDiscord | <sOkam!> you mean because of the 0xNUMBER syntax? |
08:58:20 | FromDiscord | <Rika> Yes |
08:58:23 | FromDiscord | <sOkam!> ohhh |
08:58:24 | FromDiscord | <sOkam!> ic |
08:59:00 | FromDiscord | <sOkam!> didn't know that. i will make a note, in case it becomes important when i actually load the maps |
09:01:27 | FromDiscord | <ShalokShalom> Is << bitwise shift? |
09:01:35 | FromDiscord | <ShalokShalom> In Nim? |
09:01:39 | FromDiscord | <Rika> No |
09:01:48 | FromDiscord | <Rika> It’s just something that wouldn’t trigger my autocorrect on my phone |
09:01:54 | FromDiscord | <Rika> Hahah |
09:01:56 | FromDiscord | <ShalokShalom> So, then I am confused |
09:02:00 | FromDiscord | <ShalokShalom> Ah, haha |
09:02:03 | FromDiscord | <Rika> I would have used the right shl |
09:02:11 | FromDiscord | <Rika> But that’s a pain sorry hahaha |
09:02:22 | FromDiscord | <Rika> (edit) "right" => "correct" |
09:07:58 | FromDiscord | <ShalokShalom> I turn autocorrection off |
09:08:06 | FromDiscord | <ShalokShalom> Idk how anyone can live with that |
09:08:22 | FromDiscord | <ShalokShalom> I would rather not use electronical devices 😅 |
09:08:44 | FromDiscord | <Rika> I don’t have too much issues with it until I speak code |
09:22:11 | FromDiscord | <haxscramper> In reply to @haxscramper "as you can see": lmao https://media.discordapp.net/attachments/371759389889003532/1059038822568046612/image.png |
09:32:10 | FromDiscord | <Rika> Lol |
09:34:12 | FromDiscord | <newgreenshoot> In reply to @ShalokShalom "It explicitly says, it": right, but with the previous suggestion of Winim, there's a workable solution for both Windows and Linux, if not a single cross-platform package |
09:34:49 | FromDiscord | <newgreenshoot> not great, not terrible |
09:36:54 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4k5W |
09:37:17 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4k5W" => "https://paste.rs/L51" |
09:38:26 | FromDiscord | <newgreenshoot> In reply to @newgreenshoot "right, but with the": though, there's a separate Windows section in the docs and supposedly that function should work on Windows, so I don't know why it only claims to work on Linux https://media.discordapp.net/attachments/371759389889003532/1059042906717032520/image.png |
09:40:24 | FromDiscord | <Phil> In reply to @Vindaar "as an aside: whenever": I think that one may be hard to implement. ↵I haven't looked at the documentation-generating code in general, but from what I see it basically just generates a static site.↵Enabling user generated content with such examples mean you must have a database somewhere and at that point things start getting ugly if you want to integrate that into the normal docs |
09:41:34 | FromDiscord | <Phil> Like, you can bodge a solution together (Throw up a second server for the dynamic content and redirect to it whenever a URL contains `/example` but that's kind of a gotcha long-term, |
09:41:44 | FromDiscord | <Phil> (edit) "Like, you can bodge a solution together (Throw up a second server for the dynamic content and redirect to it whenever a URL contains `/example` ... but" added ")" |
09:46:03 | FromDiscord | <Phil> And I'm not really seeing a good solution design-wise, I only see either:↵1) Keep the user-submitted example pages as an entirely separate project from the main docs↵2) Integrate them both, leading to a massive re-write that you'd only want to apply for the official docs, as otherwise you'd lose your ability to use github pages (at least AFAIK you can't do anything non-static on github pages) |
10:00:07 | FromDiscord | <untoreh> is it fine to cast a named/tuple to an array to do a membership test? |
10:00:32 | FromDiscord | <untoreh> assuming the tuple is all same types |
10:21:50 | * | derpydoo quit (Ping timeout: 252 seconds) |
10:34:30 | * | derpydoo joined #nim |
10:41:09 | NimEventer | New Nimble package! p5nim - Nim bindings for p5.js., see https://github.com/pietroppeter/p5nim |
11:09:36 | FromDiscord | <Vindaar> @Phil Yes, implementing such a thing with the current docs would be difficult. I'm not saying we need to have that anyway, but it's useful to be aware of good ideas other places use. Also such a thing could of course be also a completely separate project that only reproduces all available procs in the stdlib. That way it could even be extended to include arbitrary nimble packages and people could provide examples etc in one single place t |
11:10:14 | FromDiscord | <Phil> I think I'd be up for that, sounds interesting |
11:13:24 | FromDiscord | <demotomohiro> In reply to @untoreh "is it fine to": I think casting from a tuple to an array is safe as long as all type of tuple members are same and length of the tuple and the array is same.↵But you would better to find another way to solve the problem without cast as cast is generally unsafe. |
11:15:12 | FromDiscord | <Phil> sent a long message, see https://paste.rs/KfL |
11:15:38 | FromDiscord | <Phil> We'd actually need to make sure none of the examples ever get executed since we can't know what code will be put in |
11:17:58 | FromDiscord | <Vindaar> All of it sounds reasonable to me |
11:18:13 | FromDiscord | <Vindaar> I guess one could have a way to approve examples and at that point they are added to some CI |
11:18:46 | FromDiscord | <Vindaar> I'm no web person, so I'm not going to attempt to build such a thing though 😅 |
11:38:33 | FromDiscord | <willyboar> In reply to @haxscramper "lmao": Are you shocked? I am not. 😜 |
11:48:56 | FromDiscord | <Bung> how is the new design nimble directory progress ? wanna see it in new year |
12:00:38 | * | derpydoo quit (Ping timeout: 246 seconds) |
12:03:30 | * | xet7 quit (Remote host closed the connection) |
12:05:45 | * | xxgg joined #nim |
12:13:01 | FromDiscord | <haxscramper> https://github.com/FedericoCeratto/nim-package-directory/pull/48 |
12:13:35 | FromDiscord | <haxscramper> > This PR has been tested and ready to merge for four months. I do not understand what you are expecting to happen.↵> I believe we addressed all of your comments. |
12:13:36 | FromDiscord | <haxscramper> tl;dr |
12:27:15 | FromDiscord | <ShalokShalom> In reply to @newgreenshoot "ah wait, I think": I changed this https://github.com/nim-lang/packages/pull/2447/files |
12:27:34 | FromDiscord | <ShalokShalom> @newgreenshoot |
12:36:08 | FromDiscord | <Bung> so I guess it need seperated to serveral prs |
12:38:34 | FromDiscord | <vindaar> sigh↵(@haxscramper) |
12:38:51 | FromDiscord | <willyboar> In reply to @Bung "how is the new": Ask Federico I think is here |
12:39:28 | FromDiscord | <haxscramper> on irc `federico:` yes |
12:40:31 | FromDiscord | <ShalokShalom> My username/account got deleted or is inaccessible from the forums for the second time+ |
12:42:50 | FromDiscord | <vindaar> what was it? |
12:44:21 | FromDiscord | <ShalokShalom> Sorry |
12:44:28 | FromDiscord | <ShalokShalom> It is case sensitive 😄 |
12:44:44 | FromDiscord | <ShalokShalom> Opposite to the language 🤔 |
12:56:21 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4k6z |
12:56:27 | FromDiscord | <ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/1059092741000273940/function.png |
12:56:46 | FromDiscord | <ShalokShalom> You can try to use whatever term you might already know from other languages. |
12:57:01 | FromDiscord | <ShalokShalom> The Nim search seems to find nothing of that. |
12:58:51 | FromDiscord | <Bung> you can do google site search |
13:01:10 | FromDiscord | <Bung> doing that will require external service, whether by search engine or custom implementation, can't do that in pure static site. |
13:03:55 | FromDiscord | <ShalokShalom> In reply to @Bung "you can do google": you are joking |
13:03:59 | FromDiscord | <ShalokShalom> i hope so |
13:04:12 | FromDiscord | <demotomohiro> It seems search text box in Nim manual only search for procedure/constant/type names in stdlib. |
13:04:46 | FromDiscord | <ShalokShalom> In reply to @demotomohiro "It seems search text": there is no discoverability for basic features by Nim itself |
13:04:49 | FromDiscord | <Bung> In reply to @ShalokShalom "you are joking": so what's you expected? |
13:04:57 | FromDiscord | <ShalokShalom> search |
13:05:01 | FromDiscord | <ShalokShalom> feature |
13:05:06 | FromDiscord | <EchoPouet> I use devdocs.io to my dev documentation. |
13:05:21 | FromDiscord | <Bung> so how that implemented in your mind? |
13:05:26 | FromDiscord | <ShalokShalom> ok, we are having a serious issue here |
13:05:33 | FromDiscord | <demotomohiro> Open nim manual and use ctrl + f is only way to basic feature |
13:05:45 | FromDiscord | <ShalokShalom> if you think, this is not an absolute necessity |
13:06:16 | FromDiscord | <ShalokShalom> In reply to @demotomohiro "Open nim manual and": the point is, that a lot of things lack tags |
13:06:19 | FromDiscord | <ShalokShalom> As an example |
13:06:27 | FromDiscord | <ShalokShalom> proc is what many languages list as function |
13:06:39 | FromDiscord | <ShalokShalom> ctrl + f function wont find proc |
13:06:40 | FromDiscord | <ShalokShalom> and so on |
13:07:47 | FromDiscord | <Bung> weird idea, the way you think like there's AI bot behind the search box.. |
13:11:32 | FromDiscord | <ShalokShalom> Intelligent search is common |
13:11:38 | FromDiscord | <ShalokShalom> For like two decades |
13:11:42 | FromDiscord | <ShalokShalom> Other than in Nim |
13:13:12 | FromDiscord | <Bung> I guess the simple solution is replace to google site search |
13:13:53 | FromDiscord | <Bung> but still search on procedure won |
13:14:10 | FromDiscord | <Bung> 't show function |
13:33:58 | FromDiscord | <cow> In reply to @Bung "I guess the simple": but why involve a third party in a simple search |
13:34:11 | FromDiscord | <cow> in the stdlib it usually works, if you know the name of a package or function |
13:34:39 | FromDiscord | <cow> you can also ctrl+f for words |
13:35:44 | FromDiscord | <cow> In reply to @ShalokShalom "proc is what many": there's also `func` which arguably should be preferred if you have a pure function and not a procedure with side effects |
13:35:56 | FromDiscord | <Bung> yeah, this solution cons part is google might be blocked in some area |
13:36:26 | FromDiscord | <Bung> the lack part of current implementation it does not contains manual words |
13:37:29 | FromDiscord | <cow> and there's a table of contents if you are looking for ideas |
13:37:36 | FromDiscord | <cow> there's a section for "procedures" for example |
13:38:26 | FromDiscord | <Bung> I know, just user may not always be patient |
13:40:52 | FromDiscord | <Bung> the alternative is encourage download offline book, so they can relys on book reader search. |
13:41:33 | FromDiscord | <cow> in the nim manual, wouldn't ctrl+f work equally |
13:42:32 | FromDiscord | <Bung> no, it requires people know it's the right page they do search on a word |
13:43:26 | * | neceve joined #nim |
13:43:35 | FromDiscord | <cow> i mean, a more intelligent search sounds nice, but I think many people would be upset if it involved a third party script, especially if it was google |
13:44:55 | FromDiscord | <Bung> yeah , someone may find the good solution for nim and do that, am not interested very much. |
13:54:27 | * | derpydoo joined #nim |
14:03:24 | FromDiscord | <haxscramper> In reply to @ShalokShalom "What I currently miss": learn the power of "ctrl + f" on `theindex.html` |
14:03:48 | FromDiscord | <haxscramper> > There is also https://nim-lang.org/docs/theindex.html, I do search for "server" and it points me to https://nim-lang.org/docs/asynchttpserver.html which contains: |
14:06:52 | * | xxgg quit (Quit: Ping timeout (120 seconds)) |
14:08:40 | FromDiscord | <haxscramper> it also contains 55 other responses, I wonder if there is some magic omniscience thing that this Word Of God conveniently does not mention |
14:11:53 | * | neceve quit (Ping timeout: 268 seconds) |
14:23:04 | FromDiscord | <ShalokShalom> In reply to @haxscramper "learn the power of": No. There needs to be a proper search out of the box |
14:23:17 | FromDiscord | <ShalokShalom> Not some weird hack, that 99% of the people are not doing |
14:23:23 | FromDiscord | <ShalokShalom> That's weird as fuck |
14:23:46 | FromDiscord | <haxscramper> You are talking to a person who scraped the whole forum into sqlite db in order to be able to search for messages |
14:23:50 | FromDiscord | <haxscramper> tell me about weird hacks |
14:24:16 | FromDiscord | <ShalokShalom> In reply to @cow "i mean, a more": You could literally use one of the dozens services, that anonymously search on Google for you |
14:24:28 | FromDiscord | <ShalokShalom> @haxscramper well then! |
14:24:34 | FromDiscord | <ShalokShalom> Even more of an argument |
14:24:35 | FromDiscord | <haxscramper> IDK why I haven't though about that before, but maybe 80% of the features can be implemented using out of the box solution |
14:24:44 | FromDiscord | <ShalokShalom> That's just borderline unemphatic |
14:24:45 | FromDiscord | <haxscramper> is there something like discourse for documentation? |
14:24:50 | FromDiscord | <haxscramper> readthedocs.io for exaple |
14:25:01 | FromDiscord | <ShalokShalom> There is tons of stuff |
14:25:08 | FromDiscord | <ShalokShalom> Docusaurus |
14:25:12 | FromDiscord | <ShalokShalom> Lots of options. |
14:25:58 | FromDiscord | <ShalokShalom> In reply to @cow "there's also `func` which": And intelligent documentation would tell you exactly that |
14:29:14 | FromDiscord | <cow> In reply to @ShalokShalom "And intelligent documentation would": i'm not saying the documentation is perfect |
14:29:39 | FromDiscord | <cow> + for intelligent search |
14:30:13 | FromDiscord | <cow> but just adding google search onto the site is just forcing a third party down users' throat if they want search |
14:32:29 | FromDiscord | <haxscramper> I like cppreference search, they just throw you to duckduckgo with `site:cppreference.com` |
14:33:07 | FromDiscord | <Bung> many language official sites use search engine's site search. |
14:38:48 | FromDiscord | <haxscramper> this is the easiest solution |
14:40:01 | * | jmdaemon quit (Ping timeout: 252 seconds) |
14:47:13 | * | PMunch joined #nim |
14:55:51 | FromDiscord | <scruz> Question: does a compiled nim file (.exe) work properly with every other platform? |
14:56:25 | FromDiscord | <scruz> Because I can see things like 'Android' inside the binary file when I compiled the file on Termux |
14:57:02 | FromDiscord | <scruz> This is the command I ran: `nim c -d:release --opt:size main.nim` |
14:57:57 | FromDiscord | <Bung> short answer: no |
14:58:49 | PMunch | @scruz, an .exe file is a Windows thing, so it should run on most Windows machines. But it obviously won't run on e.g. Linux without something like Wine. |
14:59:04 | FromDiscord | <scruz> Ah I see |
14:59:26 | FromDiscord | <scruz> I don't have much experience with Linux, other than running some small scripts on my Android device using Termux |
14:59:59 | FromDiscord | <scruz> But I was however able to run the exe file on Termux like so: `./main` |
15:01:23 | FromDiscord | <scruz> Oh wait, nvm there's no .exe extension lmao |
15:01:30 | FromDiscord | <scruz> why am I hallucinating |
15:10:33 | PMunch | Haha |
15:10:57 | FromDiscord | <cow> In reply to @scruz "But I *was* however": but you probably compiled that main on termux |
15:11:12 | PMunch | I mean you could put a .exe extension on there, Linux doesn't determine what to do with files based on extensions |
15:11:13 | FromDiscord | <scruz> That's what I did |
15:11:25 | FromDiscord | <scruz> In reply to @PMunch "I mean you could": Hmm I see |
15:12:32 | FromDiscord | <scruz> Ok so is there a universal solution to share the executable file to someone and expect the program to work regardless of what OS they are using? |
15:13:40 | FromDiscord | <scruz> Otherwise the only solution is to ask them to: install Nim -> clone repo on GitHub -> compile locally |
15:14:29 | PMunch | Well there are certain things like Constantine |
15:14:52 | PMunch | But most people would just create one Windows build, a Mac build, and a Linux build and distribute those |
15:14:55 | FromDiscord | <cow> In reply to @scruz "Ok so is there": the answer to that question is the same as is there an universal solution for C |
15:15:14 | FromDiscord | <scruz> In reply to @PMunch "But most people would": Ah, right |
15:15:16 | FromDiscord | <Rika> In reply to @PMunch "Well there are certain": Do you mean cosmopolitan |
15:15:18 | FromDiscord | <Rika> Or what |
15:15:21 | FromDiscord | <Rika> Did I miss something |
15:15:24 | PMunch | Ah yes :P |
15:15:24 | FromDiscord | <cow> In reply to @PMunch "Well there are certain": it'd still not work for ARM then tho, right? |
15:16:00 | FromDiscord | <scruz> Maybe I'll just share the executable file for each OS separately |
15:16:03 | FromDiscord | <Rika> Cosmopolitan doesn’t cover GUI applications either by the way |
15:16:04 | FromDiscord | <cow> https://github.com/jart/cosmopolitan this right? |
15:16:09 | FromDiscord | <Rika> Yes |
15:16:16 | PMunch | @cow, cosmopolitan or multiple binaries? |
15:16:24 | FromDiscord | <cow> cosmo |
15:16:32 | FromDiscord | <cow> cosmo is also a waste of disk space, right? |
15:16:41 | FromDiscord | <Rika> Kind of |
15:16:50 | FromDiscord | <Rika> I don’t think it’s that much of a waste |
15:16:52 | PMunch | I mean you could probably do a cosmopolitan wrapper which unzipped the actual binary based on your OS and then ran that.. |
15:17:21 | FromDiscord | <scruz> Is there a guide on publishing an executable file? (Specifically for an application written in Nim) |
15:17:35 | FromDiscord | <cow> In reply to @PMunch "I mean you could": wouldn't that trigger many AV heuristics |
15:17:56 | FromDiscord | <scruz> (edit) "file?" => "file for different OSs?" |
15:17:59 | PMunch | Sure, but it would be a possible solution :P |
15:18:03 | FromDiscord | <Rika> Sure, Nim itself triggers AV heuristics as well anyway |
15:18:16 | PMunch | @scruz, compile with `-d:release`, host it somewhere |
15:18:21 | PMunch | That's pretty much it |
15:18:37 | FromDiscord | <scruz> Alright thanks |
15:19:02 | FromDiscord | <cow> In reply to @PMunch "<@794527403580981248>, compile with `-d:release`,": does that work if C libs like SDL are used? |
15:19:10 | FromDiscord | <scruz> that's what I did rn so I thought compiling a program locally would only work on the machine it was compiled on |
15:19:14 | FromDiscord | <cow> I think on linux at least, you still need a system wide install of SDL if you use SDL |
15:19:42 | PMunch | And I'm not saying the cosmopolitan route is necessarily a good idea, just a possibility. Most people would distribute different binaries, and then use things in the browser to serve the correct link for the OS you're on |
15:19:52 | PMunch | Take Google Chrome for example: https://www.google.com/chrome/ |
15:20:25 | PMunch | That "Download Chrome" button for me asks which architecture I want my Linux build for. If you open that page on Windows it'd probably just download an installer |
15:21:00 | PMunch | @cow, I mean for Linux software you'd really want to create packages for the different package managers |
15:21:04 | FromDiscord | <cow> the problem with this is user agent spoofing |
15:21:26 | FromDiscord | <cow> which firefox does by default if privacy.resistFingerprinting is on |
15:21:30 | FromDiscord | <Rika> You can always provide all links |
15:21:32 | PMunch | @cow, that's a very small problem, and you can easily fix it by just having a "click here for more options" button |
15:21:33 | FromDiscord | <Rika> On the same page |
15:21:36 | FromDiscord | <ShalokShalom> In reply to @cow "the problem with this": I was just about to point this out |
15:21:48 | FromDiscord | <ShalokShalom> Mine even directs to Windows default |
15:21:56 | FromDiscord | <ShalokShalom> Despite being on Linux |
15:22:00 | FromDiscord | <cow> In reply to @Rika "You can always provide": yeah, I have seen sites that don't though |
15:22:14 | FromDiscord | <cow> yes it is a site problem |
15:22:20 | FromDiscord | <cow> (edit) "yes it is a site ... problemwith" added "problem, not a" | "problem, not aproblem ... " added "with the idea" |
15:22:31 | FromDiscord | <Rika> In reply to @cow "yes it is a": Pretty much |
15:22:50 | PMunch | But yeah if you dynamically link to a library you'd need to tell the end users to install this library |
15:23:47 | PMunch | What you usually do on Windows is have a checkbox in the installer which asks if you want to install dependencies (potentially with auto-detection of found dependencies), on Linux you just mark it as a dependency it whichever packaging format you use |
15:24:10 | FromDiscord | <ShalokShalom> Or AppImage / whatever |
15:25:40 | FromDiscord | <scruz> In reply to @PMunch "<@794527403580981248>, compile with `-d:release`,": So I have to run this command on 2 different OS (i.e, Windows & Linux) and then host it somewhere, right? |
15:26:10 | PMunch | I mean you can cross-compile |
15:26:20 | FromDiscord | <scruz> how do I do that |
15:26:29 | FromDiscord | <cow> isn't it easier to create a linux vm nowadays |
15:26:30 | PMunch | I.e. compile a Linux build on a Windows machine or vice versa |
15:26:47 | FromDiscord | <cow> (edit) "nowadays" => "nowadays, or to use WSL" |
15:26:48 | PMunch | Dunno, I've only done Linux -> Windows builds |
15:27:27 | PMunch | It's not that hard, you basically install a cross-compilation capable compiler, set up a few flags and bobs your uncle |
15:27:44 | PMunch | https://nim-lang.org/docs/nimc.html#crossminuscompilation |
15:28:49 | FromDiscord | <scruz> Alright, I'll have a look. Thanks! |
15:33:06 | FromDiscord | <ShalokShalom> You can also cross compile with the Zig compiler |
15:33:08 | FromDiscord | <ShalokShalom> https://github.com/enthus1ast/zigcc |
15:35:25 | FromDiscord | <scruz> I'm making a simple CLI app, if anyone was curious: https://media.discordapp.net/attachments/371759389889003532/1059132744547979385/Record_2023-01-01-18-19-51_84d3000e3f4017145260f7618db1d683.mp4 |
15:35:35 | FromDiscord | <scruz> this is me compiling it on Termux and running it |
15:36:26 | FromDiscord | <cow> seems useful! |
15:37:13 | FromDiscord | <scruz> :P |
15:37:22 | FromDiscord | <ShalokShalom> @scruz you are using micro? |
15:37:33 | FromDiscord | <scruz> wdym, I don't know what that is |
15:37:34 | FromDiscord | <ShalokShalom> That's what's working for me on Termux |
15:37:42 | FromDiscord | <ShalokShalom> In reply to @scruz "wdym, I don't know": A text editor |
15:37:48 | FromDiscord | <scruz> I'm using nvim |
15:37:51 | FromDiscord | <scruz> neovim |
15:38:00 | FromDiscord | <ShalokShalom> Ah, you dont develop on your phone |
15:38:08 | FromDiscord | <ShalokShalom> Or do you? |
15:38:18 | * | arkurious joined #nim |
15:38:27 | FromDiscord | <ShalokShalom> Does Nvim work with lsp on Termux? |
15:39:01 | FromDiscord | <scruz> I just write simple python scripts usually so no there's nothing fancy like LSP |
15:39:11 | FromDiscord | <scruz> (edit) "no" => "no," |
15:39:31 | FromDiscord | <scruz> maybe I could set it up, but I don't think it's necessary |
15:55:01 | FromDiscord | <willm> Anyone have resources for how to make nim bindings to a JS library? |
15:55:20 | FromDiscord | <willm> I’d like to use two JS libs in my nim project and then compile to JS |
16:01:08 | FromDiscord | <Bung> https://nim-lang.org/docs/backends.html#introduction |
16:07:44 | FromDiscord | <willm> In reply to @Bung "https://nim-lang.org/docs/backends.html#introductio": Ty |
16:08:34 | FromDiscord | <Riku> In reply to @Riku "Hi there, I was": Hey there. It's been a bit, but I was wondering if anyone could help me with this? I think it would be awesome to call c++ stuff from within Nim |
16:10:26 | * | rockcavera joined #nim |
16:11:04 | * | rockcavera quit (Remote host closed the connection) |
16:13:12 | FromDiscord | <Bung> https://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-procs |
16:13:32 | FromDiscord | <Bung> https://nim-lang.org/docs/dynlib.html#examples-loading-a-simple-c-function |
16:13:45 | * | rockcavera joined #nim |
16:14:55 | FromDiscord | <Riku> Huh, I've never seen the dynlib module before. I wonder if it's portable? |
16:15:05 | FromDiscord | <Riku> I'll try it though,thanks |
16:15:07 | FromDiscord | <Riku> (edit) "though,thanks" => "though, thanks" |
16:17:28 | FromDiscord | <Vindaar> In reply to @Riku "Hey there. It's been": your problem has nothing to do with Nim, but how you compile your library / the fact that you get name mangling in your shared library from the C++ side. Annotate the `libTest` function with `extern "C"`. You can inspect the symbol names in the shared library e.g. with `nm -D` |
16:22:32 | FromDiscord | <Riku> Hmm is there a way to get g++ to compile without mangling names without `extern "C"`? I'm just thinking in my head how you would go about wrapping a c++ library that contains mangled names without modifying the source code |
16:22:47 | Amun-Ra | iirc no |
16:33:58 | PMunch | Has @Rika gotten an imposter? |
16:35:12 | FromDiscord | <Rika> Hahaha |
16:35:34 | FromDiscord | <Rika> Wait until some mf called Riko chats |
16:38:03 | FromDiscord | <Riku> Steam deck be like:↵`bash: gcc: command not found` |
16:38:59 | FromDiscord | <Rika> Not often does one compile on a steam deck |
16:39:21 | FromDiscord | <Riku> True |
16:39:34 | * | DarrylTheFish joined #nim |
16:45:37 | FromDiscord | <alex.boisvert> In reply to @willm "Anyone have resources for": Some good JS interop resources on this page too:↵https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers/#javascript-interoperability |
16:47:27 | FromDiscord | <Riku> Damn dynlib can't find mangled stuff either. Is there literally any library written in c++? I mean I even checked SDL2, and it has c++ code in there, but opening the library in a disassembler reveals that all of the names are not mangled. This is crazy lol |
17:12:25 | FromDiscord | <Yepoleb> Just compile the library as usual and add extern C shims for all the functions. You can call mangled c++ code inside extern blocks.↵(@Riku) |
17:17:49 | FromDiscord | <untoreh> sent a code paste, see https://play.nim-lang.org/#ix=4k7u |
17:18:09 | FromDiscord | <untoreh> (from a memory perspective) |
17:39:54 | FromDiscord | <sOkam!> What are the equivalents to memset and memmove for pointers in gc:none? |
17:58:24 | FromDiscord | <sOkam!> I found `moveMem` for `memmove`... but is there anything similar for `memset` replacement? |
18:02:23 | FromDiscord | <sOkam!> Found it! `zeroMem` |
18:25:00 | FromDiscord | <Riku> In reply to @Yepoleb "Just compile the library": How would you make those kinds of shims? |
18:48:25 | NimEventer | New thread by tmsa04: What Nim version introduces "except CatchableError" ?, see https://forum.nim-lang.org/t/9787 |
18:58:31 | * | xet7 joined #nim |
19:15:36 | * | xet7 quit (Quit: Leaving) |
19:57:25 | * | pro joined #nim |
20:00:11 | * | pro quit (Client Quit) |
20:00:51 | FromDiscord | <Guhnoo> quick question, if i'm casting a user inputted value from a string to int or float - where the value could be any number - should I use `int` & `float` or `int64` & `float64`? |
20:04:02 | FromDiscord | <cow> i think int and float should be fine for general use |
20:04:54 | FromDiscord | <Guhnoo> i'm assuming it'll infer its bit width? |
20:05:02 | FromDiscord | <cow> on most platforms int = int64 and float = float64 |
20:05:02 | FromDiscord | <luteva> In reply to @jtv "<@954521401073754212> Occurs to me": Hi jtv! Sorry i couldn't answer, i had to leave the day before yesterday. Just want to say that i now read all of your posts. Thanks a lot for your help!! |
20:05:50 | FromDiscord | <Guhnoo> In reply to @cow "on most platforms int": gotchu. thanks |
20:05:58 | FromDiscord | <cow> https://media.discordapp.net/attachments/371759389889003532/1059200834266734632/image.png |
20:06:03 | FromDiscord | <cow> seems like float = float64 always? |
20:06:32 | FromDiscord | <Guhnoo> ahh |
20:06:54 | FromDiscord | <Guhnoo> i take it that's in the docs |
20:06:58 | FromDiscord | <cow> meanwhile, int depends on your processor https://media.discordapp.net/attachments/371759389889003532/1059201084826058823/image.png |
20:07:03 | FromDiscord | <cow> In reply to @Guhnoo "i take it that's": source code actually |
20:07:12 | FromDiscord | <cow> you can click `source` when browsing docs |
20:07:29 | FromDiscord | <cow> so on 64 bit processors, int = int64 |
20:07:38 | FromDiscord | <jtv> In reply to @luteva "Hi jtv! Sorry i": Seems like the Nim playground might be down though. So let me know if you still need anything |
20:08:49 | FromDiscord | <Guhnoo> i'm unsure what `int`'s "always the same as a pointer" means |
20:08:57 | FromDiscord | <Guhnoo> i did see that in the docs |
20:09:31 | FromDiscord | <cow> In reply to @Guhnoo "i'm unsure what `int`'s": in practice im pretty sure it will just mean that 64 bit processors will have int = int64 |
20:09:37 | FromDiscord | <cow> and 32 bit processors will have int = int32 |
20:10:33 | FromDiscord | <Guhnoo> In reply to @cow "and 32 bit processors": so, if float is aliased to float64, what does that mean for float on non 64-bit systems? |
20:11:31 | FromDiscord | <cow> float64 is aliased to float |
20:11:52 | FromDiscord | <Guhnoo> oh... facepalm |
20:12:02 | FromDiscord | <cow> i don't get it either, don't ask |
20:12:16 | FromDiscord | <cow> if you have a 32 bit system you can check sizeof(float64) |
20:12:22 | FromDiscord | <cow> it'll tell you how many bytes it has |
20:12:36 | FromDiscord | <jtv> I think theoretically it's like C in that float's size depends on the natural float size of the machine. But I can't remember the last architecture in common use w/ 32 bit floats, so it's probably 64 bits everywhere nim runs |
20:13:06 | FromDiscord | <Guhnoo> In reply to @cow "if you have a": i doubt that issue will come up. at least i hope not |
20:13:27 | FromDiscord | <jtv> sizeof(float) not sizeof(float64) 🙂 |
20:13:29 | FromDiscord | <cow> In reply to @Guhnoo "i doubt that issue": i think it's generally better to use sizeof than to hardcode byte sizes anyways |
20:14:12 | FromDiscord | <Guhnoo> good point. i'll make use it |
20:14:18 | FromDiscord | <Guhnoo> (edit) "good point. i'll make use ... it" added "of" |
20:15:00 | FromDiscord | <Guhnoo> there's only a handful of 32 bit systems that are in use where i am |
20:15:06 | FromDiscord | <Guhnoo> damn legacy software |
20:18:14 | FromDiscord | <cow> In reply to @jtv "sizeof(float) not sizeof(float64) 🙂": depends which one you use |
20:18:22 | FromDiscord | <cow> but yes, better to use float() |
20:18:28 | FromDiscord | <cow> (edit) "float()" => "`float`" |
20:19:15 | FromDiscord | <cow> In reply to @Guhnoo "oh... *facepalm*": in practice, float and float64 are probably just `double` and float32 is `float` in C |
20:19:29 | FromDiscord | <cow> maybe i can dig around in the compiler to find it 🤔 |
20:27:00 | FromDiscord | <cow> https://media.discordapp.net/attachments/371759389889003532/1059206125960048680/image.png |
20:27:00 | FromDiscord | <cow> i found this |
20:31:24 | FromDiscord | <Guhnoo> does that mean the actual bit width can deviate from what the data type says? |
20:32:24 | FromDiscord | <demotomohiro> At least, 32bit x86 CPUs support 64bit float and int. |
20:33:28 | FromDiscord | <Guhnoo> maybe a nooby question, but what about a 32-bit os? |
20:33:52 | FromDiscord | <luteva> In reply to @jtv "Seems like the Nim": yeah i'll just try again in a while. |
20:34:20 | FromDiscord | <demotomohiro> Nim has https://nim-lang.org/docs/system.html#BiggestFloat↵and ↵https://nim-lang.org/docs/system.html#BiggestInt |
20:34:53 | FromDiscord | <cow> In reply to @Guhnoo "does that mean the": i think you're fine in general, seems like `float`s are 64 bit pretty much everywhere |
20:35:07 | FromDiscord | <cow> even on many 32 bit processors |
20:35:25 | FromDiscord | <cow> In reply to @Guhnoo "maybe a nooby question,": why would you install a 32 bit os on a 64 bit processor |
20:35:25 | FromDiscord | <Guhnoo> yeah, i'm pretty sure it's a very extreme edge case i'm worrying about |
20:35:34 | FromDiscord | <cow> (edit) "os" => "OS" |
20:35:54 | FromDiscord | <Guhnoo> In reply to @cow "why would you install": trust me, it exists where i work |
20:36:15 | FromDiscord | <Guhnoo> some people need a piece of software that literally only works properly on 32-bit installs |
20:36:30 | FromDiscord | <cow> I think you'll have 64 bit floats there too, since x86 also seems to have 64 bit floats |
20:37:16 | FromDiscord | <cow> if everything I'm seeing makes sense, only 16 bit systems seem to have 32 bit `float64`s |
20:37:39 | FromDiscord | <jtv> The point I was making is sizeof(float64) will always be 8 🙂 |
20:37:56 | FromDiscord | <Guhnoo> In reply to @cow "I think you'll have": good to know, thanks for the info |
20:38:03 | FromDiscord | <Guhnoo> much appreciated |
20:38:38 | FromDiscord | <jtv> Yeah, my recollection of x86-32 bits was they had 64-bit floats, which is why I said I can't remember the last time people were using something in the real world w/ only 32-bit floats |
20:39:09 | FromDiscord | <demotomohiro> iirc, pentium CPUs and newer have FPU with 80bit registers. They are converted to 64 or 32 bit floats when it is stored on memory. |
20:39:26 | FromDiscord | <jtv> Yup exactly |
20:39:31 | FromDiscord | <cow> In reply to @Guhnoo "good to know, thanks": but `int` will be 32 bit on 32 bit systems, while `int64` should be 64 bit there |
20:39:36 | FromDiscord | <jtv> Correct |
20:40:10 | FromDiscord | <demotomohiro> Do you need to care about non-x86 32bit CPU machines? |
20:41:39 | FromDiscord | <Guhnoo> In reply to @demotomohiro "Do you need to": i'd say no |
20:41:54 | FromDiscord | <Guhnoo> in fact, definitely no |
20:42:22 | FromDiscord | <ShalokShalom> @haxscramper Just see this documentation |
20:42:22 | FromDiscord | <ShalokShalom> https://rescript-lang.org/docs/manual/v8.0.0/overview |
20:42:37 | FromDiscord | <ShalokShalom> Type in something in that search function 😄 |
20:43:21 | FromDiscord | <demotomohiro> @Guhnoo Then you should be able to use 64 floats on all 32 bit x86 CPU. |
20:44:27 | FromDiscord | <Guhnoo> is `BiggestInt` and `BiggestFloat` my best option? |
20:44:29 | * | derpydoo quit (Ping timeout: 260 seconds) |
20:44:45 | FromDiscord | <cow> are you doing bitwise operations? |
20:44:54 | FromDiscord | <cow> what is your use case |
20:45:33 | FromDiscord | <cow> (edit) "are you doing bitwise operations? ... " added "crypto?" |
20:45:45 | FromDiscord | <cow> I'd say just use `int` and `float` |
20:45:54 | FromDiscord | <cow> and change when you run into a problem |
20:45:57 | FromDiscord | <Guhnoo> i think i'm overthinking this |
20:46:34 | FromDiscord | <Guhnoo> it's really not that critical |
20:46:52 | FromDiscord | <Guhnoo> i just wanted to try and cover all bases |
20:47:43 | FromDiscord | <luteva> i just scanned through the posts of the last 2 days and i saw some discussion about Qt / QML. So maybe i am not up-to-date: Did someone manage to use Qt Widget from nim? Afaik there are only Qt/QML bindings, no bindings to Qt Widgets. So what is the current state? |
20:47:49 | FromDiscord | <cow> I would say then use `int` for integers that are guaranteed to not exceed the 32 bit int limit, and use `float` otherwise, unless you need precision |
20:49:41 | FromDiscord | <Phil> In reply to @Vindaar "All of it sounds": Out of curiosity, is there some kind of project policy regarding what tech to use in those scenarios?↵Particularly since most of what I've noticed in terms of web is done in karax which I have absolutely 0 experience with |
20:50:04 | FromDiscord | <Phil> Or if there is and you don't know, who would? I'm like 20% sure pinging Araq is not the way to go for that question |
20:51:26 | FromDiscord | <Phil> This is kind of a docs proposal... do I make a forum post for this? Do I talk to somebody first? |
20:53:27 | FromDiscord | <Phil> (I will be honest, when it comes to ideas, you and ringabout are pretty much my 2 go-to people at the moment) |
20:53:57 | FromDiscord | <Phil> (edit) "ideas," => "discussing ideas at large," |
20:55:42 | FromDiscord | <Vindaar> I'm definitely not the right person to ask about this, yes haha. I mean if it's separate from the regular docs then essentially you can use whatever you want, as it wouldn't be an official tool after all. It might become one, sure. But just building something useful would be the start |
20:56:24 | FromDiscord | <Vindaar> Writing a forum post about it isn't necessarily a bad idea, but I worry it would either be ignored or gets all sorts of "do bla bla instead" "this is a bad idea because" responses 😅 |
20:58:21 | PMunch | @Phil, what're you discussing? |
20:58:49 | FromDiscord | <Phil> Ages ago, as in something longer than 24h, we had a discussion about docs and what could be done to improve them |
20:59:18 | FromDiscord | <Phil> Vindaar shared an example on how you can have webpages with examples that users can up/down vote for relevance, so user-generated doc-examples essentially |
20:59:55 | FromDiscord | <Phil> I stared at it a bit and was like "That seems buildable. Couldn't be on github pages but if I can somehow integrate that with forum-auth or sth. that could work well enough" |
21:00:08 | FromDiscord | <Vindaar> (I was referring to the Clojure docs, which you might know PMunch) |
21:00:33 | PMunch | Oh yes, I've been wanting to build something like Clojure docs for Nim ever since I started using it |
21:01:12 | PMunch | I've actually even done a bit of work towards it, by improving the jsondoc documentation generation |
21:01:27 | FromDiscord | <Phil> Seems interesting to me too. Imo the trickiest part could be possibly to get it to integrate into nims general ecosystem |
21:01:32 | FromDiscord | <Phil> Oh? |
21:01:42 | PMunch | My idea was to use Nim to generate documentation in the JSON format, ingest that into a database, and then serve that data up as a website |
21:01:47 | FromDiscord | <Phil> Seems like you were thinking about this from a different avenue |
21:02:10 | FromDiscord | <Phil> Ahhh, and then allow an alternate client to make use of that JSON-data? |
21:02:16 | PMunch | As for auth and such I haven't really looked much into it, but integrating with the forum would be great |
21:02:20 | FromDiscord | <Phil> Since that client could use the data to provide examples per symbol etc. |
21:02:30 | PMunch | Exactly |
21:02:43 | PMunch | I've already used the jsondoc thing to generate the docs for Ratel |
21:03:55 | PMunch | In my opinion we should have the compiler only spit out something like JSON, and then have the JSON -> HTML a separate tool. Of course Nim would then call this separate tool when you do `nim doc` |
21:04:15 | PMunch | This would ensure that all the data used to generate the documentation was also available in the machine-readable output |
21:05:04 | PMunch | Traditionally people seem to have added things into the HTML doc-generation part, but forgotten or neglected to add it to the JSON part. Then I've come along and done some batch updates, so jsondoc should now be mostly up to par with the HTML generation |
21:05:11 | FromDiscord | <Phil> sent a long message, see http://ix.io/4k8g |
21:05:26 | PMunch | Of course with the JSON output in a database you could even generate docs per version of a package as well |
21:05:40 | PMunch | And show how things evolve from one version to the next |
21:07:13 | PMunch | Integrating authentication with the forum should be a secondary goal, while cool it would require some politics for acceptance |
21:07:45 | PMunch | As for how to technically build a website I've been toying around with type-based templates and HTMX for a while |
21:08:01 | PMunch | I'm currently testing it out for my home automation stuff, but it seems promising |
21:08:01 | FromDiscord | <Phil> Even if not, I'd still want to steal how it's done in the forum simply so that I don't have to wire that up myself. |
21:08:21 | PMunch | Basically all my routes just return types, then I use my autotemplates package to build HTML from those types. |
21:09:09 | PMunch | The idea is to combine that with my deriveable package to build a pretty nifty pattern |
21:09:14 | FromDiscord | <Phil> It's something interesting to look into for me at least, given that I kinda gave up on my mock-idea as I just am lacking too much macro knowledge. |
21:09:36 | FromDiscord | <Phil> It was really cool to finally get the first grasp of how macros work though |
21:09:54 | PMunch | Definitely one of the cooler Nim features |
21:09:59 | PMunch | But it takes a while to get used to |
21:10:28 | FromDiscord | <Phil> Imo it particularly takes a fair bit of learning by heart before it start to become "nice" to deal with |
21:10:38 | FromDiscord | <Phil> And by that I mean the node-patterns that make up the various syntax constructs |
21:10:59 | FromDiscord | <Phil> Or I guess that's my current take with my limited understanding of macros after my first deeper dive into them |
21:11:26 | FromDiscord | <4zv4l> I was thinking, since Nim memory can be managed in lot of different ways, that the syntax is really clean↵it is as much as Rust a good candidate to be in the Linux Kernel right ?↵(I'm not saying that either of Nim or Rust should be in the kernel, just saying that is there any reason why Rust is more worth than Nim) |
21:11:57 | PMunch | One thing I have on my eternally growing todo list is to write a long article or short book on how to think about and write macros |
21:12:02 | FromDiscord | <Phil> As far as my understanding goes the Rust ecosystem is just more mature - more packages, less bugs in the compiler etc. |
21:12:39 | FromDiscord | <Phil> It is because of that I'd be hesitant to put nim on the same level for kernel readiness. |
21:16:08 | FromDiscord | <4zv4l> any idea of what made Rust suddenly doing a boom and become super famous ? and if/what could happen for Nim to get the same ?↵I might be wrong about why most people go for Rust but I think Nim is really a great language, high performance, syntax really clean and mostly memory safe↵I get that people screams everywhere that "Rust is a safe language" but at what cost (dev time/complexity) and really that safe ? |
21:16:54 | PMunch | Rust has money and PR, that certainly helps |
21:16:58 | FromDiscord | <Phil> I think that debate may best be had in offtopic |
21:17:42 | FromDiscord | <ShalokShalom> In reply to @luteva "i just scanned through": https://forum.nim-lang.org/t/9785 |
21:18:00 | FromDiscord | <Rika> In reply to @4zv4l "any idea of what": It is pretty safe. It’s just really dev intensive |
21:18:16 | FromDiscord | <Rika> But kernel devs are willing to take that bump, safety is really critical to them |
21:19:56 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4k8k |
21:20:15 | FromDiscord | <matkuki> sent a code paste, see https://paste.rs/9Li |
21:20:28 | FromDiscord | <ShalokShalom> 3) Rust solved the issues, that C++ people had with their language. |
21:20:34 | FromDiscord | <matkuki> (edit) "https://play.nim-lang.org/#ix=4k8m" => "https://paste.rs/MzZ" |
21:20:38 | FromDiscord | <ShalokShalom> Nim does this as well, and fails to look like C++. |
21:21:00 | FromDiscord | <ShalokShalom> Bad mistake. The same people will tell you, syntax doesnt matter. 🙂 |
21:21:22 | FromDiscord | <4zv4l> In reply to @ShalokShalom "Nim does this as": "fails" ? to me it's better not to look like it 🥺 |
21:21:25 | FromDiscord | <ShalokShalom> There is one thing to say, about Nim not being explicit like Rust and having not the same degree of safety as Rust. |
21:21:35 | FromDiscord | <ShalokShalom> In reply to @4zv4l ""fails" ? to me": To me as well. |
21:21:42 | FromDiscord | <ShalokShalom> But in their eyes, it fails. |
21:22:10 | FromDiscord | <Rika> Mainly the issue of some features that are controversial to non users |
21:22:39 | FromDiscord | <ShalokShalom> Nim has lesser safety than Rust. And to me, that hardly doesnt matter. Most issues in C++ are categorically outsourced in Nim as well, so they dont have a specific advantage here. |
21:22:51 | FromDiscord | <ShalokShalom> In reply to @Rika "Mainly the issue of": How you mean, dear? |
21:23:26 | FromDiscord | <ShalokShalom> Once Nim gets adopted and officially developed by a huge company, you can bet for sure it will skyrocket. |
21:23:32 | FromDiscord | <ShalokShalom> Until then, its a "niche language" |
21:23:41 | FromDiscord | <Rika> In reply to @ShalokShalom "How you mean, dear?": Style insensitivity, etc |
21:23:53 | FromDiscord | <ShalokShalom> I assume, without the C/C++ ecosystem at its hand, 90% of the people here wouldnt here. |
21:23:53 | FromDiscord | <Rika> Additionally most people dislike indentation basis |
21:24:05 | FromDiscord | <ShalokShalom> Yes, as I said. |
21:24:14 | FromDiscord | <ShalokShalom> The syntax looks unfamiliar. |
21:24:36 | FromDiscord | <ShalokShalom> I think style insensitivity doesnt play a role, though. |
21:24:39 | FromDiscord | <Rika> It’s not just because it’s unfamiliar to C++ users, it’s unfamiliar to basically all users |
21:24:45 | FromDiscord | <ShalokShalom> Thats just a thing for Hackernews. |
21:24:47 | FromDiscord | <Rika> In reply to @ShalokShalom "I think style insensitivity": Haha I wish |
21:25:03 | FromDiscord | <ShalokShalom> Well, Python is the most prominent programming language |
21:25:05 | FromDiscord | <4zv4l> In reply to @Rika "It’s not just because": looks like Python doesn't it ? |
21:25:05 | FromDiscord | <ShalokShalom> Or at least one of |
21:25:17 | FromDiscord | <4zv4l> In reply to @matkuki "Question: what is the": I really don't know tbh |
21:25:18 | FromDiscord | <Rika> In reply to @4zv4l "looks like Python doesn't": Only in one way pretty much |
21:25:26 | FromDiscord | <ShalokShalom> The point is, as Python people regularly point out: |
21:25:30 | FromDiscord | <Rika> In reply to @matkuki "Question: what is the": Sure doesn’t seem normal to me |
21:25:40 | FromDiscord | <4zv4l> looks like Python with type informations |
21:25:46 | FromDiscord | <ShalokShalom> People are think indentation based is a problem, have not tried it. |
21:25:53 | FromDiscord | <ShalokShalom> Thats the case in nearly all the cases. |
21:26:10 | FromDiscord | <ShalokShalom> They came to make it a convention, to ask "did you try it?" |
21:26:19 | FromDiscord | <ShalokShalom> This would shut down such discussions almost always. |
21:26:44 | FromDiscord | <ShalokShalom> I dont think people would ditch a language because of that |
21:26:53 | FromDiscord | <4zv4l> I always thought I didn't like Python because of the syntax but after using Nim I definitely know that the syntax is not the issue at all |
21:26:54 | FromDiscord | <ShalokShalom> And its also not, what Python users complain about. |
21:27:13 | FromDiscord | <ShalokShalom> They complain about speed, types and crude implementations. |
21:29:43 | FromDiscord | <4zv4l> I had an interview with Accenture for a cyber sec internship and I told them about Nim and they seemed pretty interested, will see how it goes when I start in February |
21:34:49 | FromDiscord | <! Nilts> How would i turn an object into a ref? |
21:36:34 | PMunch | By copying it onto the heap |
21:38:47 | FromDiscord | <Rika> (No you can’t avoid a copy) |
21:39:56 | FromDiscord | <cow> can't you cast its unsafeAddr into a ref type technically |
21:41:57 | FromDiscord | <demotomohiro> Casting from (pointer to object) to ref object is unsafe. |
21:44:32 | FromDiscord | <! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4k8q |
21:45:29 | FromDiscord | <cow> is aw a variable created with `let` or a proc argument |
21:45:38 | FromDiscord | <cow> In reply to @demotomohiro "Casting from (pointer to": definitely, hence `technically` |
21:46:05 | FromDiscord | <! Nilts> In reply to @cow "is aw a variable": proc arg |
21:46:18 | FromDiscord | <cow> change the parameter type to `var` |
21:46:25 | FromDiscord | <cow> or if you don't want to mutate the argument |
21:46:31 | FromDiscord | <cow> you need to create a copy |
21:46:52 | NimEventer | New thread by matkuki: Assigning array to itself with different order, see https://forum.nim-lang.org/t/9788 |
21:46:53 | FromDiscord | <cow> (edit) "or if you don't want to mutate the argument ... " added "directly (as in it will affect the caller's argument that they passed in)" |
21:47:12 | FromDiscord | <newgreenshoot> In reply to @ShalokShalom "I changed this https://github.com/nim-lang/packages": The repo was renamed too, so <https://github.com/Techno-Fox/psutilim> still 404s↵should instead be <https://github.com/Techno-Fox/psutil-nim> |
21:47:52 | FromDiscord | <! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4k8r |
21:49:01 | FromDiscord | <cow> the thread you have is not mutable |
21:49:14 | FromDiscord | <cow> it would be better if you sent the whole snippet |
21:49:53 | FromDiscord | <cow> (edit) "thread you have" => "proc type" | "not mutable" => "wrong?" |
21:50:20 | FromDiscord | <jtv> In reply to @matkuki "Question: what is the": [0xC2, 0xC2] is the correct output, because you are mutating the bytes array in-place, as it's a fixed-sized array. Generally, there will be an evaluation order for expressions, it's usually left-to-right. So you should expect your code to translate to: bytes[0] = bytes[1]; bytes[1] = bytes[0] |
21:50:29 | FromDiscord | <planetis> you can't use a var argument for the tp proc |
21:50:34 | FromDiscord | <! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4k8t |
21:51:16 | FromDiscord | <Rika> In reply to @cow "can't you cast its": It wouldn’t work. |
21:51:18 | FromDiscord | <Rika> At all |
21:51:23 | FromDiscord | <cow> oh good to know |
21:51:24 | FromDiscord | <jtv> In reply to @jtv "[0xC2, 0xC2] is the": Specifically, there's no temporary array constructed. |
21:52:06 | FromDiscord | <jtv> But it is unintuitive because of the fact that you used an array literal there |
21:52:08 | * | jmdaemon joined #nim |
21:52:37 | FromDiscord | <jtv> You might rightly expect you should get semantics as if there WERE a literal. The problem is, in this case, it REQUIRES it, or else some swap logic |
21:52:38 | FromDiscord | <cow> sent a code paste, see https://play.nim-lang.org/#ix=4k8u |
21:52:50 | FromDiscord | <cow> planetis is right |
21:52:51 | FromDiscord | <ShalokShalom> In reply to @newgreenshoot "The repo was renamed": Ah, yeah |
21:52:52 | FromDiscord | <ShalokShalom> True |
21:52:58 | FromDiscord | <ShalokShalom> Thanks for pointing it out |
21:54:03 | FromDiscord | <! Nilts> In reply to @cow "yeah you can't use": than what do i do, im back at the start |
21:56:44 | FromDiscord | <! Nilts> same `cannot be assigned to` error |
21:58:51 | FromDiscord | <planetis> The current std/threadtyped kind of sucks, but it might be reworked for v2. For example it would be better if it used raw pointers instead. There is an rfc that suggests it should be low-level, so stuff like std/tasks can build upon. You can just use a global thread and call it a day or wrap pthread yourself, should be hard actually. others have done it, so... |
21:59:23 | FromDiscord | <planetis> shouldn't be hard |
22:02:02 | FromDiscord | <! Nilts> whenever i have ever tried to use pointers i get an error saying core dumped |
22:03:35 | FromDiscord | <planetis> are you porting code? |
22:04:45 | FromDiscord | <planetis> are you sure it's supposed to work this way? Its thread safe to modify the t.status variable from the child thread. |
22:04:56 | FromDiscord | <planetis> (edit) "thread." => "thread?" |
22:06:16 | FromDiscord | <planetis> (edit) "Its" => "Is it" | "variable" => "field" |
22:07:10 | FromDiscord | <@thatrandomperson5-6310e3b26da03> > are you porting code?↵No, btw this is not logged in#4644’s gitter account |
22:07:24 | * | estiquelapice quit () |
22:08:36 | * | estiquelapice joined #nim |
22:10:32 | FromDiscord | <planetis> well there is a segmentation fault that says otherwise. Anyway to help you out try running with -d:useMalloc -t:"-fsanitize=thread" -l:"-fsanitize=thread" -d:nosignalhandler |
22:11:01 | FromDiscord | <@thatrandomperson5-6310e3b26da03> > are you sure it's supposed to work this way? Its thread safe to modify the t.status variable from the child thread?↵I mean hopefully |
22:12:50 | FromDiscord | <planetis> if anyone else can help but if I remember correctly you can't return Thread like that. |
22:14:18 | FromDiscord | <@thatrandomperson5-6310e3b26da03> what do you mean? |
22:14:52 | FromDiscord | <.tochka> how could one chain iterator and some value at the end for the same block |
22:15:32 | FromDiscord | <.tochka> for macro facilitates making expanding block two times if im not missing anything |
22:15:38 | FromDiscord | <planetis> I think but I could be wrong that Thread[T] variable can only be global? |
22:16:03 | FromDiscord | <.tochka> In reply to @planetis "I think but I": dont think so |
22:16:03 | FromDiscord | <pouriya.jamshidi> who can help me with the Nim forum registration? I have been trying to register for a while now and after confirming my email address, I get an invalid identity hash error on the website.↵↵sorry if this is not the place but I am all outta luck :S |
22:20:03 | FromDiscord | <cow> In reply to @not logged in "whenever i have ever": do you allocate enough memory? |
22:21:12 | FromDiscord | <cow> or is this the same threads example |
22:22:39 | FromDiscord | <d4rckh> Is there any similar library to scapy (for python) for Nim? |
22:22:48 | FromDiscord | <planetis> well I have never seen any code doing it that way |
22:25:16 | * | PMunch quit (Quit: leaving) |
22:26:27 | FromDiscord | <ShalokShalom> @d4rckh You can use Scapy via https://github.com/yglukhov/nimpy |
22:26:53 | FromDiscord | <ShalokShalom> And idk if there is a package ported, but I consider it less likely |
22:27:05 | FromDiscord | <ShalokShalom> Considering that it appears to be quite niche. |
22:27:51 | FromDiscord | <planetis> tochka is right you can have a local thread variable just tested it. |
22:29:11 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4k8y |
22:30:50 | FromDiscord | <@thatrandomperson5-6310e3b26da03> what does the error mean? |
22:35:03 | FromDiscord | <d4rckh> In reply to @ShalokShalom "<@648552095531663361> You can use": Not looking for a port or a bridge |
22:38:05 | FromDiscord | <hotdog> In reply to @pouriya.jamshidi "who can help me": Ping <@&371760044473319454> |
22:45:01 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4k8D |
22:54:56 | FromDiscord | <federico3> whoa Genode is supporting Nim https://genode.org/documentation/release-notes/18.02 |
22:56:48 | FromDiscord | <Vindaar> In reply to @pouriya.jamshidi "who can help me": if you tell me your forum account name I can activate the account. The mail feature is busted |
22:59:20 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4k8G |
23:01:11 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4k8I |
23:28:05 | * | om3ga quit (Ping timeout: 246 seconds) |
23:31:04 | FromDiscord | <@thatrandomperson5-6310e3b26da03> did the messages above get through? |
23:32:19 | systemdsucks | yes |
23:32:50 | FromDiscord | <Elegantbeef> Is `ActiveWorker` a ref object? |
23:37:55 | * | om3ga joined #nim |
23:43:44 | FromDiscord | <@thatrandomperson5-6310e3b26da03> No |
23:44:32 | FromDiscord | <@thatrandomperson5-6310e3b26da03> I get a diffrent error for ref object |
23:45:16 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Actually, i think it is the same err, nvm |
23:56:14 | FromDiscord | <Yepoleb> what's the nicest way to get openArray[bytes] from a string? |
23:56:35 | FromDiscord | <Elegantbeef> `str.toOpenArrayByte(0, str.high)` |
23:59:32 | FromDiscord | <Yepoleb> i was hoping for to avoid the explicit slicing ☹️ |
23:59:41 | FromDiscord | <Yepoleb> thanks beef |