01:01:19 | FromDiscord | <majortrips1763> @eightbit_dboy you can try to do something like `CC=sh4-elf-gcc nim c --cc:env` and see if that targets SuperH4 correctly |
01:01:45 | FromDiscord | <majortrips1763> Well, set `CC` to whatever your sh4 CC is named |
01:02:43 | FromDiscord | <majortrips1763> > To use the CC environment variable, use nim c --cc:env myfile.nim. To use the CXX environment variable, use nim cpp --cc:env myfile.nim. --cc:env is available since Nim version 1.4. |
01:50:13 | * | xet7 joined #nim |
02:02:57 | FromDiscord | <nervecenter> sent a code paste, see https://play.nim-lang.org/#pasty=rKUxvzpB |
02:38:02 | * | rockcavera quit (Remote host closed the connection) |
03:05:49 | * | redj joined #nim |
03:33:02 | FromDiscord | <eightbit_dboy> In reply to @majortrips1763 "<@327881349924913152> you can try": Well, this is my config.nims https://media.discordapp.net/attachments/371759389889003532/1294140680473542736/config.nims?ex=6709edee&is=67089c6e&hm=077f21ef17b1ed0ae26f4377f56d641f8c09f33b5cff10cd8caf9527ad64af0d& |
03:34:04 | FromDiscord | <eightbit_dboy> Not sure how, exactly, that translates to nimscript |
03:38:43 | * | PMunch_ joined #nim |
03:38:56 | * | pbsds3 quit (Quit: Ping timeout (120 seconds)) |
03:39:23 | * | pbsds3 joined #nim |
03:39:57 | * | Artea quit (Quit: ZNC 1.8.2 - https://znc.in) |
03:41:06 | * | ttkap quit (Ping timeout: 252 seconds) |
03:41:50 | * | PMunch quit (Ping timeout: 252 seconds) |
03:46:06 | * | ttkap joined #nim |
03:51:36 | * | Artea joined #nim |
05:08:22 | FromDiscord | <pmunch> In reply to @strogon14_ "<@392962235737047041>: something like https://www.n": Ooh, good idea |
05:26:55 | * | ntat joined #nim |
06:24:33 | * | ntat quit (Quit: Leaving) |
06:51:49 | FromDiscord | <mrgaturus> i found `{.emit.}` quoting won't capture symbols inside a template or it's arguments |
06:51:56 | FromDiscord | <mrgaturus> also may crash compiler into sigsegv |
06:52:36 | FromDiscord | <mrgaturus> (edit) "i found `{.emit.}` quoting won't capture symbols ... inside" added "or arguments" | removed "or it's arguments" |
06:52:56 | FromDiscord | <mrgaturus> (edit) "also may crash compiler into ... sigsegv" added "a" |
06:58:14 | FromDiscord | <classid> In reply to @classid "Could y'all give me": Hey guys |
06:58:26 | FromDiscord | <classid> Can I get some |
07:05:37 | FromDiscord | <nnsee> In reply to @classid "Can I get some": i mean we have no idea what your skill level or interests are, it's very hard to just "give you a project idea". what's something you wished existed but doesn't, at least not in the way you'd like? is there a tool or program or something you could use to improve your workflow? etc |
07:05:41 | FromDiscord | <nnsee> start there |
07:54:01 | FromDiscord | <eightbit_dboy> sent a code paste, see https://play.nim-lang.org/#pasty=lZPPdEfE |
07:54:17 | FromDiscord | <eightbit_dboy> This is a demo of a wrapper I'm trying to generate using futhark. |
07:59:06 | FromDiscord | <eightbit_dboy> Here's the repo: https://github.com/8bitprodigy/naylib64 |
08:00:39 | FromDiscord | <eightbit_dboy> Thing is, it has a `config.nims` and `panicoverride.nim`. |
08:08:48 | * | PMunch_ is now known as PMunch |
08:10:38 | Amun-Ra | https://chrismorgan.info/blog/unlicense/ |
08:26:30 | FromDiscord | <eightbit_dboy> BSD0 it is, then. |
08:26:47 | FromDiscord | <eightbit_dboy> At any rate, the license is the least of my worries right now. |
08:36:02 | PMunch | You still need the `os` module for certain things |
08:36:21 | PMunch | And Nim is quite dumb when deciding whether you have it or not |
08:36:41 | PMunch | You can't use the os module on compile-time if your target doesn't have the os module |
08:37:30 | FromDiscord | <Elegantbeef> It's a hard limitation to overcome |
08:37:33 | PMunch | When working with FreeRTOS on a microcontroller for example I have to perform the wrap first and then import the modules because Futhark can't be run directly as it depends on the OS module |
08:38:04 | PMunch | Even though it does all its work during compile-time and the host machine has it |
09:07:37 | FromDiscord | <eightbit_dboy> Well, I'm doing the wrap first and then installing it with `nimble`. |
09:44:43 | * | beholders_eye joined #nim |
10:01:53 | * | beholders_eye quit (Ping timeout: 248 seconds) |
10:03:18 | * | mahlon quit (Ping timeout: 246 seconds) |
10:07:04 | * | beholders_eye joined #nim |
10:14:35 | * | mahlon joined #nim |
10:32:38 | * | Artea quit (Quit: ZNC 1.8.2 - https://znc.in) |
10:34:20 | * | beholders_eye quit (Ping timeout: 252 seconds) |
10:55:36 | * | Artea joined #nim |
11:01:32 | * | coldfeet joined #nim |
11:47:47 | * | beholders_eye joined #nim |
11:54:28 | FromDiscord | <demotomohiro> I wrote this library for path handling at compile time: https://github.com/demotomohiro/pathX |
11:57:00 | FromDiscord | <PATRYK SENS> alias chipset install |
12:50:58 | * | nisstyre quit (Quit: WeeChat 4.2.1) |
12:58:47 | FromDiscord | <kiloneie> Repost:↵What happened to Araq's object variants proposal from a while back ? |
12:59:18 | FromDiscord | <kiloneie> One of other people's proposals to his was, being able to reuse fields for each object variant |
13:02:08 | * | ntat joined #nim |
14:00:16 | FromDiscord | <majortrips1763> In reply to @eightbit_dboy "Well, this is my": @Nerve's examples can be translated to this file pretty easily. |
14:13:55 | * | PMunch quit (Quit: Leaving) |
14:29:12 | FromDiscord | <majortrips1763> sent a long message, see https://pasty.ee/JIAlmubU |
14:29:23 | FromDiscord | <majortrips1763> (edit) "https://pasty.ee/cmnYCZKz" => "https://pasty.ee/VjMEIyHe" |
14:42:49 | FromDiscord | <majortrips1763> Also, if I recall correctly, sh4 doesn't have normal atomic instructions (does it actually have an atomic xchg?) and it may need some special work there to setup the appropriate primitives. |
14:45:17 | FromDiscord | <majortrips1763> I thought gcc had a stack of compiler options for selecting the various atomic implementations. |
14:56:01 | * | Batzy joined #nim |
14:58:21 | * | Batzy_ quit (Ping timeout: 246 seconds) |
15:02:45 | Amun-Ra | sh4 is quite special with its branch slots |
15:44:53 | FromDiscord | <majortrips1763> Is there a addr32, or pointer, type or some such for memory addresses that are not on the heap or the stack? 😛 |
15:45:57 | Amun-Ra | constants :) |
15:46:15 | FromDiscord | <majortrips1763> Yah, no .. memory structure created by the bootloader |
15:46:34 | FromDiscord | <majortrips1763> Up there with writing to devices that are attached via direct memory addressing |
15:47:56 | FromDiscord | <majortrips1763> Right now I am just using uint32 types and casting objects to the address, but I feel like there is likely a better way. |
15:48:27 | Amun-Ra | just like in C |
16:08:55 | FromDiscord | <majortrips1763> In reply to @Amun-Ra "just like in C": Yup, just thinking that there could be some syntax that better informs Nim's of the expected constraints. W/ C it is pretty easy to just do random things to memory and cast it anyway you want, which is fine, but it also makes it pretty easy to shoot yourself; and others; in the foot. |
16:38:32 | FromDiscord | <demotomohiro> How about to use `distinct int` or `SomePtr[T] = distinct ptr T`? |
16:43:34 | * | Jhonny2x4 quit (Quit: Jhonny2x4) |
16:43:43 | * | Jhonny2x4 joined #nim |
16:44:21 | * | Jhonny2x4 quit (Client Quit) |
16:44:29 | * | Jhonny2x4 joined #nim |
16:45:39 | * | Jhonny2x4 quit (Client Quit) |
16:45:47 | * | Jhonny2x4 joined #nim |
17:06:35 | FromDiscord | <drunkenalcoholic> sent a code paste, see https://play.nim-lang.org/#pasty=lRVYIcSR |
17:22:38 | FromDiscord | <spotlightkid> @drunkenalcoholic\: you want file open mode `fmReadWriteExisting` instead of `fmReadWrite`.↵https://nim-lang.org/docs/syncio.html#FileMode |
17:25:53 | FromDiscord | <kryp7on> In reply to @majortrips1763 "I am honestly not": what I meant is: I have first part of software where I work with some files using GC, then it comes part to manually map memory bcs Im using WinAPI and some low level stuff, so I just switch while writing in source, to manually map memory in stuff instead of using GC. Then when I finish working with that low lvl stuff, I proceed to use GC again |
17:26:00 | FromDiscord | <kryp7on> is something like this possible? |
17:26:48 | FromDiscord | <kryp7on> ALSO: how low-level is Nim? Im pentester and I need to write some security tooling. Comparing to Zig/Rust/C, is it capable of manipulating with kernel and stuff? |
17:36:07 | FromDiscord | <drunkenalcoholic> In reply to @spotlightkid "<@325338333314154509>\: you want file": Thanks mate, that was the problem, now its working, very much appreciated, thank you |
17:40:19 | FromDiscord | <majortrips1763> In reply to @kryp7on "ALSO: how low-level is": Well .. Nim seems to be curiously popular for malware and the like .. there are entire repos and articles out there regarding weaponizing it... |
17:42:08 | FromDiscord | <majortrips1763> Well .. snap ...↵> set i too large; use `std/sets` for orginal types with more than 2^16 elements↵↵Bleh, the damn AOUT_KLUDGE flag in MB1 🤮 |
17:42:15 | FromDiscord | <majortrips1763> (edit) "i" => "is" |
17:42:19 | FromDiscord | <majortrips1763> (edit) "orginal" => "ordinal" |
17:43:54 | FromDiscord | <majortrips1763> sent a code paste, see https://play.nim-lang.org/#pasty=MbbUUMQb |
17:52:02 | FromDiscord | <majortrips1763> oh .. that was my bad on that thing |
17:53:36 | FromDiscord | <majortrips1763> `AoutKludge = 20` |
17:55:52 | FromDiscord | <demotomohiro> sent a long message, see https://pasty.ee/HCyebPdV |
17:57:02 | FromDiscord | <majortrips1763> In reply to @demotomohiro "It is not kernel": The stack pointer situation is something I am dealing with as well. |
17:58:56 | FromDiscord | <demotomohiro> In reply to @majortrips1763 "The stack pointer situation": https://github.com/demotomohiro/MinimumNimPico/blob/main/src/startup.nim#L138↵I just used inline assembler to set the stack pointer. |
18:06:45 | * | beholders_eye quit (Ping timeout: 248 seconds) |
18:12:36 | FromDiscord | <majortrips1763> In reply to @demotomohiro "https://github.com/demotomohiro/MinimumNimPico/blob": Yah, same.. the problem for me is that I am setting up a temporary stack pointer so that I do the work of parsing the multiboot information data, since total memory and valid memory information is in the MBI .. then I get to init all of memory and figure out my "final" stack pointer.. hehe. |
18:13:13 | FromDiscord | <majortrips1763> And then I get to throw the old stack away. |
18:36:59 | * | PMunch joined #nim |
19:58:22 | FromDiscord | <kryp7on> In reply to @demotomohiro "It is not kernel": what about thing I asked? can I switch in source code from GC to manually mapping then again to GC? |
20:07:05 | * | coldfeet quit (Remote host closed the connection) |
20:22:01 | * | ntat quit (Quit: Leaving) |
20:47:02 | FromDiscord | <eightbit_dboy> In reply to @majortrips1763 "I went through and": That example is from naylib64, which is for n64, though. |
20:47:39 | FromDiscord | <eightbit_dboy> (edit) "In reply to @majortrips1763 "I went through and": That example is from naylib64, which is for n64, though. ... " added "That, I can already compile for." |
20:48:24 | FromDiscord | <eightbit_dboy> That said, this info may be helpful, if I decide to create an sh4 target. |
20:50:25 | FromDiscord | <demotomohiro> I think, Nim manages only memory allocated for ref, seq or string types. If C library or API allocates heaps, Nim's memory memory management do nothing to them. C functions should work correctly as long as you use them correctly. |
20:56:52 | FromDiscord | <demotomohiro> In reply to @kryp7on "what about thing I": I don't know what you are trying to do, but I don't think you need to stop Nim's GC to use memory provided by C APIs as long as they don't overlap memory that Nim's memory managent uses. |
21:22:19 | * | PMunch quit (Quit: leaving) |
21:25:03 | FromDiscord | <kryp7on> sent a code paste, see https://play.nim-lang.org/#pasty=TNBMoymf |
21:25:18 | FromDiscord | <kryp7on> (edit) "https://play.nim-lang.org/#pasty=JXAPujQF" => "https://play.nim-lang.org/#pasty=nMVjXndX" |
21:25:39 | FromDiscord | <Elegantbeef> If you use Arc there is no real GC it's just RAII |
21:25:56 | FromDiscord | <Elegantbeef> So... it's just an abstraction over manual management |
21:26:31 | FromDiscord | <kryp7on> huh, sry I didnt understand what you said. Idk whats Arc not RAII |
21:26:53 | FromDiscord | <Elegantbeef> Well then you shouldn't be worried about GC |
21:34:22 | FromDiscord | <kryp7on> In reply to @Elegantbeef "Well then you shouldn't": so its actually possible switching from GC to manual manipulating memory? |
21:34:32 | FromDiscord | <Elegantbeef> No cause that makes no sense |
21:34:51 | FromDiscord | <Elegantbeef> You use automatic managed memory where you want it, and manually manage where you want it |
21:37:36 | FromDiscord | <kryp7on> In reply to @Elegantbeef "You use automatic managed": isnt GC there by default? |
21:38:00 | FromDiscord | <majortrips1763> Hmm, are there any docs/tutorials/examples of casting objects to memory addresses? |
21:38:24 | FromDiscord | <Elegantbeef> `.addr` gets the address |
21:39:11 | FromDiscord | <Elegantbeef> `cast[ptr T](myData)` is how you cast to a pointer |
21:40:54 | Amun-Ra | kryp7on: yes, but GC manages only certain types mentioned above |
21:41:41 | FromDiscord | <majortrips1763> Well, I have a uint32 that holds an address, and I am trying to cast an object to point at it |
21:42:20 | FromDiscord | <Elegantbeef> So then `cast[ptr MyObjecy](myuint32)` |
21:42:30 | FromDiscord | <Elegantbeef> Assuming 32bit CPU |
21:42:56 | FromDiscord | <kryp7on> In reply to @Amun-Ra "<@1124352185916981328>: yes, but GC": ah, and for the rest, you need to do it yourself? |
21:43:00 | FromDiscord | <Elegantbeef> If it's 64bit you likely should raise to 64bit then cast |
21:47:45 | FromDiscord | <majortrips1763> Well, it might be a 64bit CPU .. but the address is guaranteed to be 32bit. |
21:48:14 | Amun-Ra | kryp7on: yes |
21:53:52 | FromDiscord | <majortrips1763> sent a code paste, see https://play.nim-lang.org/#pasty=CagDZUXW |
21:55:08 | FromDiscord | <majortrips1763> > type mismatch |
21:57:00 | FromDiscord | <majortrips1763> Oh .. I thihk I figured that out |
21:57:05 | * | krux02 joined #nim |
22:13:35 | FromDiscord | <majortrips1763> I needed to cast the addres of the object to an int before doing maths ... https://forum.nim-lang.org/t/2569↵↵Fun |
22:14:25 | FromDiscord | <Elegantbeef> Or you can `cast[ptr UncheckedArray[...]](...)[1]` |
22:14:46 | FromDiscord | <majortrips1763> Oh, I saw a reference to that, but I wasn't really grok'ing it |
22:15:15 | FromDiscord | <Elegantbeef> If you are just offsetting by `sizeof(T)` it's the same as an array of `T` |
22:15:28 | FromDiscord | <Elegantbeef> As such if you treat it as a pointer to an array of T you can offset it |
22:15:29 | FromDiscord | <majortrips1763> oh, each element is of a different size 😦 |
22:16:00 | FromDiscord | <Elegantbeef> Oh I see `Multiboot2HeaderTag` and `MultiBootHeader` |
22:16:09 | FromDiscord | <Elegantbeef> So yea time to cast to an int |
22:16:12 | FromDiscord | <Elegantbeef> Or use `ptr_math` |
22:16:37 | FromDiscord | <majortrips1763> Yah, initially it starts w/ the header+sizeOfHeader to find the 1st Tag, and then tag.next is basically tag.addr+tag.size |
22:17:25 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "Or use `ptr_math`": What is this strange thing of which you speak? |
22:17:37 | FromDiscord | <Elegantbeef> It's a nimble package |
22:17:39 | FromDiscord | <majortrips1763> Oh, a module! |
22:17:41 | FromDiscord | <majortrips1763> Nice |
22:17:41 | FromDiscord | <Elegantbeef> It implements operators on `ptr T` |
22:18:04 | FromDiscord | <Elegantbeef> It's a single file so you can always just steal it and drop it in your project with the license added |
22:18:34 | FromDiscord | <majortrips1763> I might do that later as I refactor stuff .. right now I am really enjoying doing everything directly and basically drinking from the firehose. |
22:18:47 | FromDiscord | <majortrips1763> Been a great learning experience |
22:18:49 | FromDiscord | <Elegantbeef> I believe that's how you deface yourself |
22:19:03 | FromDiscord | <majortrips1763> Yah, especially on the 10" line... |
22:25:16 | FromDiscord | <majortrips1763> So .. are there are common set of patterns for `.gitignore` when working with Nim? |
22:26:14 | FromDiscord | <Elegantbeef> On linux I just git ignore `.exe` `.dll` `.so` and extensionless f iles |
22:27:02 | FromDiscord | <majortrips1763> Kk, I was about to add .out and was curious if there were others I should add. |
22:30:44 | Amun-Ra | majortrips1763: I have also these: https://dpaste.com/ADLR4J66Y |
22:40:42 | FromDiscord | <.bobbbob> In reply to @Elegantbeef "If you use Arc": seems like a lot of new players hear gc and think java in the 90s gc and think it will take a lot of resources (I did that too a bit) |
22:48:38 | FromDiscord | <Elegantbeef> Right, if you do not know what RAII is you likely should go learn about deterministic deallocations before questioning about GCs 😄 |
22:52:13 | FromDiscord | <.bobbbob> basically it's arc is deterministic and zero overhead and orc is just arc with reference counting for recursive types right? |
22:52:37 | FromDiscord | <Elegantbeef> Well Orc has a mark and sweep pass for cycles |
22:52:45 | FromDiscord | <Elegantbeef> `ref` has a reference count on Arc |
22:52:56 | FromDiscord | <.bobbbob> ah |
22:53:49 | * | krux02 quit (Remote host closed the connection) |
22:59:15 | FromDiscord | <Nlits (Ping on reply)> I'm trying to make a sort-of ui engine in nim but am stuck on how to do sizing and positioning. I know you have to do multiple passes, with new restrictions each time but still can't wrap my head around how to do this properly. A link to an article or some code written for another library would be nice. I appreciate any help. (Not quite sure this is the right place to ask but it is at least a start) |
23:00:47 | FromDiscord | <Elegantbeef> For my UI stuff I just have procedure to calculate the used size for an element then use that to position/size the parent element |
23:01:20 | FromDiscord | <Elegantbeef> So like a vertical layout group iterates its children and calculates the size of each incrementing the start of the next by the size of the former |
23:01:49 | FromDiscord | <Elegantbeef> It's not very digestable due to using a lot of silliness https://github.com/beef331/gooey/blob/master/src/gooey/layouts.nim |
23:02:19 | FromDiscord | <Elegantbeef> This is for game stuff so It's all anchor based and not meant for real programs |
23:02:38 | FromDiscord | <Elegantbeef> So like I anchor a UI element to one of 9 positions on a screen, then the position is an offset from that point |
23:22:04 | FromDiscord | <__nycto__> Quick question: Are [PFrame](https://nim-lang.org/docs/system.html#PFrame) pointers stable? That is to say: if I want to store a stack trace, do I need to copy the content of a `PFrame` to my own object, or can I just store the `PFrame` itself and refer back to it later? |
23:23:09 | FromDiscord | <Elegantbeef> Should be fine as long as the object does not outlive the stack frame |
23:24:46 | FromDiscord | <__nycto__> It does. I'm working on a memory leak analyzer for a custom device. So I'm trying to record the stack frame anytime memory is allocated, then print a stack trace for anything that isn't released. Or for memory that gets double released |
23:32:22 | FromDiscord | <Nlits (Ping on reply)> In reply to @Elegantbeef "So like a vertical": The issue is things like text-wrap require you to give a specified width, and depend on that. That is what the second iteration is for. I also dk how to make flexbox and such, but i will look at your code |
23:33:03 | FromDiscord | <Elegantbeef> My method of text wrap is just scale the text down 😄 |
23:34:10 | FromDiscord | <Elegantbeef> I believe my Layout groups are technically flexboxes |
23:34:39 | FromDiscord | <Nlits (Ping on reply)> In reply to @Elegantbeef "My method of text": That isn't possible in my particular situation, but i can probably just expand upon what i see in your code with the code i already wrote |
23:35:04 | FromDiscord | <Elegantbeef> Well you do newline insertion if you do not scale down |