00:11:11 | FromDiscord | <Richard> sent a long message, see http://ix.io/3zcT |
00:11:47 | FromDiscord | <Richard> I'm trying to convert a python dataframe object back into a nim table, is there any way to do this? |
00:15:03 | FromDiscord | <Elegantbeef> Is this just a test? Cause there are CSV libraries for nim? |
00:16:25 | FromDiscord | <Richard> Yes I know I just want to see if it works |
00:16:26 | FromDiscord | <Elegantbeef> I imagine you need to iterate over the df to extract the data but idk what's inside df |
00:17:07 | FromDiscord | <Richard> Just some sample data on the internet https://media.discordapp.net/attachments/371759389889003532/888579355184345118/data.csv |
00:21:18 | FromDiscord | <Elegantbeef> I more mean i dont know what the df data type is |
00:22:36 | FromDiscord | <gogolxdong (liuxiaodong)> How to construct constructor of contract with nim-web3? |
00:26:13 | FromDiscord | <Richard> I think it says PyObject in my linter |
00:29:52 | FromDiscord | <Elegantbeef> Idk |
00:29:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3zcX |
00:30:08 | FromDiscord | <Elegantbeef> Not being a python programmer and never using nimpy i'm completely blind on what's going on |
01:27:15 | * | neurocyte01 joined #nim |
01:27:15 | * | neurocyte01 quit (Changing host) |
01:27:15 | * | neurocyte01 joined #nim |
01:29:47 | * | neurocyte0 quit (Ping timeout: 268 seconds) |
01:29:47 | * | neurocyte01 is now known as neurocyte0 |
02:15:21 | FromDiscord | <gogolxdong (liuxiaodong)> I found out nim-web3 handles only function and event but constructor. |
02:33:50 | * | arkurious quit (Quit: Leaving) |
04:05:41 | FromDiscord | <jakefromstatefarm> Is there a way for me to program my vimrc in nim? |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2.1) |
04:06:08 | FromDiscord | <jakefromstatefarm> With nVim you can program your vimrc in other languages, and vim-hs (haskell) caught my eye, but I think nim's a better fit for this kind of job |
04:06:27 | FromDiscord | <jakefromstatefarm> I searched for `vimrc in nim`, and `vim-nim`, but didn't get any relevant results. |
04:06:31 | * | supakeen joined #nim |
04:06:32 | FromDiscord | <jakefromstatefarm> Does anyone know of something like this? |
04:08:36 | nrds | <Prestige99> Didn't know that was possible, I just use viml |
04:08:43 | nrds | <Prestige99> Would be nice though |
04:09:59 | FromDiscord | <jakefromstatefarm> So far I've been using vimscript/viml, but oh dear, it has bad performance and is getting really hard to maintain. Plus it's quirky AF for doing logic in. |
04:10:15 | FromDiscord | <jakefromstatefarm> My vimrc is gigantic though, so... |
04:10:40 | FromDiscord | <jakefromstatefarm> However, I wish to change that, by using a proper language for handling the added logic. |
04:11:05 | FromDiscord | <leorize> you can do it in nim to a certain extent |
04:11:18 | FromDiscord | <leorize> either you use the node.js integration and use `nim js` |
04:11:40 | FromDiscord | <leorize> or you write a msgpack interface for nim -\> nvim and use it instead |
04:12:43 | nrds | <Prestige99> Hmm there's no way for a table's values to be of different types, is there |
04:13:03 | FromDiscord | <leorize> you can use union if you're brave enough \:p |
04:13:27 | FromDiscord | <leorize> shameless plug\: https://github.com/alaviss/union |
04:13:31 | nrds | <Prestige99> Might need to make a custom implementation or something |
04:14:03 | FromDiscord | <jakefromstatefarm> Yeah, found that on DDG just as you sent that |
04:14:14 | FromDiscord | <jakefromstatefarm> Your pfp gave you away, lol \:) |
04:14:20 | FromDiscord | <leorize> \:p |
04:14:39 | FromDiscord | <jakefromstatefarm> I'm new to nim, what does that actually do? |
04:15:09 | arfy | huh, is that like a union in C? |
04:15:31 | FromDiscord | <Elegantbeef> No it's like a union in TS |
04:15:49 | FromDiscord | <Elegantbeef> It's practically a anonymous tagged union |
04:15:51 | FromDiscord | <jakefromstatefarm> After further reading, it looks like union, the programming concept, nothing unique to nim, though it is in nim |
04:16:08 | FromDiscord | <jakefromstatefarm> no longer too confused |
04:16:18 | FromDiscord | <Elegantbeef> Leorize's response was to prestige |
04:17:04 | FromDiscord | <jakefromstatefarm> Ohh, I see |
04:17:15 | FromDiscord | <jakefromstatefarm> 🤦♂️ |
04:18:54 | nrds | <Prestige99> Maybe I can do something weird like generate a new type at compile time.. hard to explain what I'm trying to achieve over text :P |
04:19:18 | FromDiscord | <Elegantbeef> That's what union does |
04:19:22 | FromDiscord | <Elegantbeef> Or sumtypes |
04:19:35 | FromDiscord | <jakefromstatefarm> [leorize](https://matrix.to/#/@leorize:envs.net)\: your comment about msgpack lead me to find exactly what I was after\: https://github.com/jangko/nvim_client , thanks! |
04:19:43 | nrds | <Prestige99> I mean something else |
04:20:06 | FromDiscord | <Elegantbeef> Well examples paint a thousand words |
04:21:15 | nrds | <Prestige99> Trying to emulate godot's AnimationPlayer basically. Want to add a "track" which is the change of a property at certain time intervals. So I'd provide the name of the property to change and an array of values with times to change |
04:21:25 | nrds | <Prestige99> problem is each property could be a different type |
04:23:19 | FromDiscord | <leorize> I'm still not sure why does union not solve your problem |
04:24:10 | nrds | <Prestige99> I'm not sure how it would, but I'm working on an example |
04:32:05 | nrds | <Prestige99> https://play.nim-lang.org/#ix=3zdx crude example, still trying to figure out how I'd want to do this |
04:32:33 | nrds | <Prestige99> But I'd prefer doing this more dynamically than creating union types of all properties of type Foo |
04:38:40 | FromDiscord | <leorize> just forget that types exist for a second then write your example I guess |
04:38:56 | FromDiscord | <Varriount> ^ |
04:40:46 | nrds | <Prestige99> Alright |
04:41:42 | FromDiscord | <Varriount> Prestige: If you mean you want to dynamically add fields to a type, as they are accessed by code, it's not possible. |
04:42:23 | FromDiscord | <leorize> it is possible if you're creative enough \:p |
04:42:24 | nrds | <Prestige99> Trying to find a way to achieve my end goal basically |
04:42:33 | nrds | <Prestige99> been racking my brain for a way to do this in nim |
04:42:44 | nrds | <Prestige99> updating my example atm |
04:43:01 | FromDiscord | <leorize> so can you show the way its done in not nim then? \:p |
04:43:18 | FromDiscord | <Varriount> You can analyze a bunch of accesses in a given block of code, generate the type, and then give that code to the compiler to actually process. |
04:43:25 | nrds | <Prestige99> Writing an example without types basically, give me a min |
04:43:27 | FromDiscord | <Elegantbeef> You want to attach arbitrary data to an object to be updated by a single call afaict |
04:43:38 | nrds | <Prestige99> or if you're familiar with godot you might know what I mean |
04:43:59 | FromDiscord | <leorize> I think the gamedev people are sleeping atm |
04:44:14 | FromDiscord | <Elegantbeef> Fuck you leorize! |
04:44:53 | nrds | <Prestige99> or maybe this might even help: https://i.imgur.com/fzCAQNd.png |
04:45:15 | nrds | <Prestige99> picture of an anmation in godot - can add "tracks" per property, assign values at certain times |
04:45:21 | FromDiscord | <Elegantbeef> Could you not just use Nim's oop logic like that'd do probably underneath? |
04:45:25 | nrds | <Prestige99> trying to replicate this system |
04:46:18 | FromDiscord | <Elegantbeef> Does it support more than just primitives? |
04:46:28 | FromDiscord | <leorize> I thought you're a compiler dev beef xd |
04:46:34 | FromDiscord | <Elegantbeef> Havent used godot's animator, have used unity's dont recall it supporting anything but primitives |
04:46:43 | FromDiscord | <Varriount> Prestige: By "track", you mean the property changes over time? |
04:47:10 | FromDiscord | <Elegantbeef> It's a keyframe system which can reference fields of objects |
04:47:11 | FromDiscord | <leorize> this looks like an issue to be described via a schema or something |
04:47:12 | FromDiscord | <Elegantbeef> So yes |
04:47:31 | nrds | <Prestige99> Yes |
04:47:38 | FromDiscord | <Elegantbeef> You make an animation it changes a referenced value over time |
04:47:45 | nrds | <Prestige99> ^ |
04:48:05 | nrds | <Prestige99> https://play.nim-lang.org/#ix=3zdz without types, another crude example.. but yeah that's the main idea |
04:48:11 | FromDiscord | <Elegantbeef> I'd say just use a Union for primitives |
04:48:14 | FromDiscord | <Varriount> Sounds like, rather than generating fields, you need to generate logic instead, |
04:48:35 | nrds | <Prestige99> My main problem (I think) is, I don't know how I'd be storing this data |
04:48:45 | FromDiscord | <Elegantbeef> Alternatively copy your data to a `seq[byte]` then pass them to a function to use |
04:48:45 | nrds | <Prestige99> the array of values and property names |
04:48:46 | * | pro joined #nim |
04:49:10 | FromDiscord | <leorize> a vtable impl probably work if you insist on having them statically typed |
04:49:20 | FromDiscord | <Elegantbeef> Well you need to store a loadable reference to the object and the field names you want to capture |
04:49:30 | FromDiscord | <leorize> otherwise `Table[string, union(<primitives here>)]` |
04:50:07 | FromDiscord | <Elegantbeef> Despite all outward appearances i'm indeed a gamedev 😛 |
04:50:14 | nrds | <Prestige99> probably would want it to work with tuples as well |
04:50:19 | nrds | <Prestige99> but yeah a vtable would work I guess |
04:51:09 | FromDiscord | <Elegantbeef> Cant you read C++ prestige? go look how they do it 😛 |
04:51:15 | nrds | <Prestige99> Was hoping that, since these would be known at compile time, I could just create these on the type |
04:52:13 | FromDiscord | <leorize> your main issue would be to know "where" the fields are |
04:52:33 | FromDiscord | <Rika> Damn beef moving up in the hierarchy now a compiler dev |
04:52:48 | FromDiscord | <Elegantbeef> Apparently so |
04:52:56 | FromDiscord | <Elegantbeef> Soon i'll be running this taco stand |
04:52:56 | FromDiscord | <leorize> now this depends a lot on how your system is designed |
04:53:02 | nrds | <Prestige99> wouldn't it just be like, this.`propertyName` = foo |
04:53:08 | nrds | <Prestige99> via a macro |
04:53:19 | FromDiscord | <leorize> if whatever the handler for the keyframe you create can be generic, then you can create a type with introspection |
04:53:42 | FromDiscord | <leorize> then use it on the keyframe type to produce the handler at compile-time |
04:53:45 | FromDiscord | <leorize> something like that |
04:54:24 | FromDiscord | <Varriount> Prestige: Are all the fields for the type known at definition time? |
04:54:37 | nrds | <Prestige99> Yea |
04:54:44 | FromDiscord | <leorize> for example uniontraits have this thing called `contains()` which can query at compile-time whether a type exist |
04:55:06 | FromDiscord | <leorize> https://github.com/alaviss/union/blob/main/union.nim#L480-L488 \<- then you can do stuff like this\: https://github.com/alaviss/union/blob/main/union.nim#L480-L488 |
04:55:18 | FromDiscord | <leorize> I imagine you can create a similar system for your keyframe types |
04:55:46 | FromDiscord | <Varriount> Prestige: Is there a reason the `rotation` fields has to be an `int`, rather than, say, a `Keyframe[int]`? |
04:56:59 | nrds | <Prestige99> well these are properties of like, any object, that someone would want to use |
04:56:59 | FromDiscord | <Varriount> And will the tracks for a single type be the same across all instances of that type, or could the tracks vary from instance to instance? |
04:57:32 | nrds | <Prestige99> It'd be the same for every instance |
04:57:52 | nrds | <Prestige99> e.g. we create a Player, and a player has a set of animation tracks for a walk animation |
04:58:06 | FromDiscord | <Varriount> So the track data is constant? It could theoretically be stored in a `const`? |
04:58:10 | nrds | <Prestige99> We'd want to change properties like sprite frames and rotation over a period of time |
04:58:20 | nrds | <Prestige99> Yeah I believe so |
04:59:15 | nrds | <Prestige99> We should be able to generate a function that updates the animation tracks, at compile time |
04:59:18 | nrds | <Prestige99> afaict |
05:00:08 | FromDiscord | <Elegantbeef> then what update should be is a `proc updateRot(foo: var Foo, time: float) = foo.rot = sampleData(time)` basically 😀 |
05:00:32 | nrds | <Prestige99> yeah |
05:01:09 | FromDiscord | <Varriount> A macro can generate constants. A macro could take a type, and generate a `const fieldName: Keyframe[fieldType] = ...`. |
05:01:19 | FromDiscord | <Varriount> for every field in the type. |
05:02:08 | FromDiscord | <Varriount> Or even copy the type definition, give it a new name, and replace each field with a keyframe type. |
05:03:40 | FromDiscord | <Elegantbeef> Given what he showed i think a macro that was used like `animate(foo.rot): [(10, 20), (40, 50)]` and emitted a proc + const seems sensible |
05:04:10 | nrds | <Prestige99> yeah |
05:04:15 | FromDiscord | <Varriount> That would work too, although the procedure would need to be called somewhere. |
05:04:49 | FromDiscord | <Elegantbeef> You'd subscribe it to the macro seq and then have a `animate(Foo, time)` |
05:05:04 | FromDiscord | <Varriount> Prestige: You might be able to take advantage of the `{.global.}` pragma for procedure variables. |
05:05:06 | FromDiscord | <Elegantbeef> `animate` unpacks the macro cache calling all the gensym'd animations |
05:05:32 | FromDiscord | <Varriount> ^ |
05:06:01 | FromDiscord | <Elegantbeef> This way it's totally safe and not flooding your code base with visible proc defs |
05:06:11 | FromDiscord | <Elegantbeef> I can whip together an example if you need it 😉 |
05:06:23 | nrds | <Prestige99> please lol |
05:06:34 | FromDiscord | <Varriount> Elegantbeef: I'd be interested in your example too. |
05:06:37 | FromDiscord | <Elegantbeef> Ok! |
05:06:55 | FromDiscord | <Elegantbeef> cracks neck |
05:15:27 | FromDiscord | <Gumber> Can Nim not handle C++ 20 / latest? |
05:16:06 | FromDiscord | <Gumber> in terms of codegen |
05:16:27 | FromDiscord | <leorize> probably, C++ codegen is pretty neglected afaict |
05:16:48 | FromDiscord | <Gumber> okay - I'll just build the lib and statically bind to it rather than trying to compile it with Nim |
05:16:51 | FromDiscord | <Gumber> thanks leorize |
05:17:04 | FromDiscord | <Gumber> link to it not bind |
05:17:10 | FromDiscord | <Gumber> whatever blaming COVID brain fog |
05:17:41 | FromDiscord | <Gumber> I don't even know if that will work |
05:17:53 | FromDiscord | <Gumber> it probably wont... |
05:18:11 | FromDiscord | <leorize> I believe the -std flag is hardcoded in the compiler though |
05:18:20 | FromDiscord | <leorize> so you might have to patch it out first |
05:18:33 | FromDiscord | <Gumber> I mean I'm using vcc so I am passing /std:c++latest |
05:18:34 | FromDiscord | <Gumber> or 20 |
05:18:41 | FromDiscord | <Gumber> then I get a bunch of stdlib errors |
05:18:55 | FromDiscord | <Gumber> like : `C:\Users\carte\nimcache\frag_r\stdlib_winlean.nim.cpp(98): error C2664: 'void symAddrALH9bdNwXEzg7MPq4PA9csvw(void ,NCSTRING)': cannot convert argument 2 from 'const char [10]' to 'NCSTRING'` |
05:19:08 | FromDiscord | <leorize> nim + vcc is never tested afaik |
05:19:15 | FromDiscord | <Gumber> I use it fairly frequently |
05:19:19 | FromDiscord | <Gumber> and haven't had too many problems |
05:19:23 | FromDiscord | <Gumber> but I never try modern C++ really |
05:19:38 | FromDiscord | <Gumber> I just have this one library that apparently has something that needs C++20 or latest |
05:20:05 | FromDiscord | <Gumber> and I was writing bindings for it - wanted to just compile all the C++ files using pragmas and do all the linking and stuff in the bindings themselves |
05:20:44 | FromDiscord | <Gumber> I'm not sure if I can compile with an older standard and then link a library compiled with a newer one |
05:20:53 | FromDiscord | <Gumber> but I'm going to try my damndest |
05:21:23 | FromDiscord | <Gumber> of course this library has like six other dependencies I already had to build |
05:21:44 | FromDiscord | <leorize> linking should not be an issue |
05:21:47 | FromDiscord | <Gumber> and then link and include header paths to etc... but it's fine haha, if it works I wont' complain |
05:21:54 | FromDiscord | <Gumber> okay, let's see what happens 😄 |
05:22:00 | FromDiscord | <leorize> the issue is whether the header will compile under older standard |
05:22:18 | FromDiscord | <Gumber> yeah I see what you're getting at |
05:22:25 | FromDiscord | <Gumber> let's hope it's all in implementation files |
05:33:06 | FromDiscord | <Elegantbeef> Time! https://play.nim-lang.org/#ix=3zdG |
05:33:53 | FromDiscord | <Elegantbeef> Of course you can always skip the proc call since it's rather simple and can just be a statement |
05:34:05 | FromDiscord | <Elegantbeef> But it reduces the duplicate constants all over the file |
05:35:47 | FromDiscord | <Elegantbeef> @Varriount\: that's for you and prestige i guess 😛 |
05:41:24 | FromDiscord | <Elegantbeef> Dont know if the way of selecting is ideal but you can always do `proc lerp(a, b: SomeOrdinal, c: float): SomeOrdinal = if c == 1.0: b else: a` |
05:42:34 | FromDiscord | <Elegantbeef> Atleast that's good for enums 😛 |
05:42:54 | FromDiscord | <Elegantbeef> If you're changing an enum state at given animation frames that'd be rather useful |
05:48:02 | FromDiscord | <Gumber> yup I'm boned |
05:48:13 | FromDiscord | <Gumber> fawkkkkkkkkkkkkkkkkkkkkkk |
05:48:25 | FromDiscord | <Gumber> this happens like every time I touch the cpp backend lol |
05:48:32 | FromDiscord | <Elegantbeef> Most people are happy when that happens \:D |
05:48:37 | FromDiscord | <Gumber> eh |
05:48:49 | FromDiscord | <Elegantbeef> Getting boned 😛 |
05:48:53 | FromDiscord | <Gumber> oh I got the joke lol |
05:49:16 | FromDiscord | <Gumber> I'm just not really laughing at this point, like three or four days invested into this idea |
05:49:33 | FromDiscord | <Gumber> and now I need to reevalute the whole rendering situation |
05:49:41 | FromDiscord | <Gumber> and what I'm going to do |
05:49:47 | FromDiscord | <Gumber> or I need to port this library |
05:49:58 | FromDiscord | <Gumber> and learn C++20 |
05:50:00 | FromDiscord | <Gumber> apparently |
05:50:16 | FromDiscord | <Rika> In reply to @Gumber "and learn C++20": H a v e f u n |
05:51:26 | FromDiscord | <Gumber> maybe I can just write a C interface for it? |
05:51:43 | FromDiscord | <Gumber> and bind to that? |
05:56:04 | FromDiscord | <Rika> You could |
05:56:37 | nrds | <Prestige99> Thanks beef I'll look this over when I'm more awake later |
05:58:53 | FromDiscord | <Gumber> way less work than a full port, so I'll try that I guess |
06:12:05 | nrds | <Prestige99> how did you learn all this craziness @Elegantbeef |
06:14:15 | FromDiscord | <Elegantbeef> I've written many macros |
06:14:16 | FromDiscord | <Elegantbeef> So do that 😛 |
06:14:35 | nrds | <Prestige99> Hah, alright |
06:14:35 | FromDiscord | <Elegantbeef> I've also worked on the compiler as you know mostly in semantic analysis which is like one step lower |
06:41:08 | nrds | <Prestige99> I'll probably implement this into my engine tomorrow and show you how I've used it, should be fun |
06:43:48 | FromDiscord | <Elegantbeef> The only restriction is that the type has a `lerp` function implemented obviously |
06:43:58 | FromDiscord | <Elegantbeef> Which is basically your entire interface system |
06:45:10 | nrds | <Prestige99> Yeah I was thinking of providing an easing function for each track so we could use whatever |
06:47:27 | FromDiscord | <Elegantbeef> Yea in that case you can replace the `sample` with your own sample or just override `lerp` |
06:48:17 | nrds | <Prestige99> Hmm I also will need to track these animations (collections of "tracks") so I can swap between them |
06:48:38 | nrds | <Prestige99> Walk vs jump animation for example |
06:48:58 | nrds | <Prestige99> Should probably worry about this when I'm not dead tired lol |
06:50:09 | FromDiscord | <Elegantbeef> Well feel free to ping me if/when you need help |
06:50:17 | nrds | <Prestige99> Thanks |
06:55:50 | * | max22- joined #nim |
06:58:35 | FromDiscord | <Gumber> heyyyy that works |
06:58:39 | FromDiscord | <Gumber> back in business |
06:58:52 | FromDiscord | <Gumber> just another layer of bindings to create 😢 |
07:14:02 | * | max22- quit (Quit: Leaving) |
08:06:47 | FromDiscord | <Rika> bindings on bindings |
08:21:21 | * | max22- joined #nim |
08:41:26 | arfy | is there something like this in nim? I have a list, and want to return the next item of the list with a function call. so something like an iterator but just in the regular flow of code. |
08:42:35 | FromDiscord | <Rika> closure iterators |
08:43:27 | arfy | aha |
08:43:30 | arfy | thanks |
08:51:53 | FromDiscord | <Gumber> finally |
08:52:16 | FromDiscord | <Gumber> have things compiling again with all the spirv-cross and shaderc libs linking correctly |
08:52:18 | FromDiscord | <Elegantbeef> Or CPS if you want to play with that 😛 |
08:52:21 | FromDiscord | <Gumber> yay - can write my renderer now |
08:52:30 | FromDiscord | <Gumber> but it's time for sleepz, cya all tomorrow |
08:54:32 | FromDiscord | <cabboose> CPS always |
10:07:32 | NimEventer | New thread by Neodim: Direct I2C device access with pure Nim, see https://forum.nim-lang.org/t/8437 |
10:47:34 | * | pro quit (Quit: WeeChat 3.2) |
11:21:13 | * | pch quit (Remote host closed the connection) |
11:57:35 | * | max22- quit (Ping timeout: 260 seconds) |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2.1) |
12:06:31 | * | supakeen joined #nim |
12:06:50 | * | pch joined #nim |
12:48:38 | * | max22- joined #nim |
12:50:29 | * | arkurious joined #nim |
13:37:47 | * | emery is now known as ehmry |
14:07:47 | FromDiscord | <Smarc> How would I be able to play just a small portion of a .ogg file using the BASS library? I am able to play a whole file already |
14:08:20 | FromDiscord | <Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3zfl |
14:17:27 | FromDiscord | <Rika> that should be in the bass documentation |
14:19:33 | FromDiscord | <Smarc> Tried to look it up there, but could not find anything. I was hoping I'd find someone with expertise :) |
14:26:54 | FromDiscord | <Rika> Not a lot of people here know bass |
14:29:33 | FromDiscord | <Smarc> I mean.. Is there another, more used audio library that is capable of playing (parts of) .ogg files? |
14:33:40 | FromDiscord | <fae> treeform wrote a nice sound lib https://github.com/treeform/slappy |
14:34:02 | FromDiscord | <fae> if you're okay with openal |
14:34:52 | Amun-Ra | how about libogg? |
14:36:52 | FromDiscord | <fae> <https://github.com/treeform/slappy#proc-playback> |
14:37:01 | FromDiscord | <fae> set time offset in sec |
14:47:45 | FromDiscord | <dain> if I call a `func` (no side effects) and I discard the result, will the compiler just delete it? |
14:47:50 | FromDiscord | <dain> since it won't affect anything |
14:47:57 | FromDiscord | <dain> (edit) "discard" => "`discard`" |
14:48:49 | FromDiscord | <Rika> no |
14:48:58 | FromDiscord | <Rika> i dont think that kind of optimisation is in the compiler |
14:49:07 | FromDiscord | <Rika> also its not a guarantee either |
14:49:11 | FromDiscord | <Rika> you can fool effects tracking |
14:49:30 | FromDiscord | <Rika> of course its not recommended to do so |
15:00:13 | FromDiscord | <Smarc> I can't get slappy to run the README example .. |
15:03:15 | FromDiscord | <Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3zfP |
15:10:20 | FromDiscord | <Smarc> Wouldn't that mean that the actual package is incorrect? |
15:10:59 | FromDiscord | <Rika> well whats the full error? |
15:11:59 | FromDiscord | <Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3zfX |
15:12:06 | FromDiscord | <Smarc> missing a 's' at the beginning |
15:17:16 | FromDiscord | <frankzig> how can i create a Seq ensuring that it has atleast space for N items and not need realloacation? |
15:22:23 | FromDiscord | <pietroppeter> https://nim-lang.org/docs/system.html#newSeqOfCap,Natural |
15:35:33 | FromDiscord | <frankzig> thank you |
17:04:36 | * | al1ranger joined #nim |
17:17:44 | * | al1ranger quit (Quit: Leaving) |
17:24:07 | * | neurocyte0 quit (Ping timeout: 252 seconds) |
17:53:24 | FromDiscord | <dain> In reply to @Rika "i dont think that": what if it's just `discard foo` |
17:53:28 | FromDiscord | <dain> where `foo` is an ident |
17:53:32 | FromDiscord | <dain> is that just a noop |
17:54:20 | * | federico3[m] joined #nim |
18:04:07 | FromDiscord | <Smarc> I just can't get it working playing just a small sample of a .ogg file, whether using BASS or slappy.. Is anyone inclined to help a newbie learning some library stuff? |
18:06:13 | FromDiscord | <enthus1ast> @Smarc\: i've used "sound" for this\: https://github.com/yglukhov/sound.git |
18:06:52 | FromDiscord | <enthus1ast> https://github.com/enthus1ast/trainingThing/blob/3d8872b4ba4876a4cb5eb1b35cfc639eb40c14f7/src/training.nim#L64↵↵https://github.com/enthus1ast/trainingThing/blob/3d8872b4ba4876a4cb5eb1b35cfc639eb40c14f7/src/training.nim#L128 |
18:09:03 | FromDiscord | <enthus1ast> but if you want to just play a part of an audio file, i think you need another module |
18:09:27 | FromDiscord | <enthus1ast> maybe have a look how the various nim game engines does it |
18:12:18 | * | xet7 quit (Remote host closed the connection) |
18:13:15 | * | xet7 joined #nim |
18:19:17 | FromDiscord | <Gumber> Anyone know how to represent a `std::vector` in `C`? |
18:19:24 | FromDiscord | <Gumber> I'm writing a C interface for a C++ API |
18:19:42 | FromDiscord | <Gumber> I know I need the pointer and the number of elements to call `std::vector.assign()` |
18:19:51 | FromDiscord | <Gumber> but I'm not sure what type I should use on the C size to store the number of elements |
18:20:30 | * | max22- quit (Ping timeout: 268 seconds) |
18:20:52 | FromDiscord | <Gumber> actually I guess it doesn't matter |
18:21:00 | FromDiscord | <Gumber> thinking about it more I don't need them to be laid out the same in memory - nevermind |
18:27:09 | * | luis_ joined #nim |
18:30:09 | FromDiscord | <deech> sent a code paste, see https://play.nim-lang.org/#ix=3zgU |
18:31:32 | FromDiscord | <j-james> Why do `toHex(string)` and `toHex(int)` return different values? |
18:32:01 | FromDiscord | <Yardanico> In reply to @j-james "Why do `toHex(string)` and": because toHex called on a string returns the hex representation of the bytes in the string |
18:32:10 | FromDiscord | <Yardanico> and toHex int returns the hex representation of the integer itself |
18:32:18 | FromDiscord | <Yardanico> string representation is different from binary representation obviously |
18:32:26 | FromDiscord | <deech> In reply to @deech "Any thoughts on allowing": Oh wait you can already do that with custom annotations, sorry. |
18:32:52 | FromDiscord | <Yardanico> In reply to @j-james "Why do `toHex(string)` and": you can read the corresponding docs:↵https://nim-lang.org/docs/strutils.html#toHex%2Cstring↵https://nim-lang.org/docs/strutils.html#toHex%2CT |
18:33:57 | FromDiscord | <j-james> Ah, makes sense |
18:34:26 | FromDiscord | <Gumber> hmm |
18:35:03 | FromDiscord | <Gumber> okay so constructing the instance of the C++ class to pass to the C++ code from my C layer is no sweat |
18:35:13 | FromDiscord | <Lefl> sent a code paste, see https://play.nim-lang.org/#ix=3zgV |
18:35:22 | FromDiscord | <Gumber> but now I have a C++ class instance |
18:35:27 | FromDiscord | <Lefl> Is there any way I can tell nim to just use the property of the object instead of trying to use the proc? |
18:35:28 | FromDiscord | <Gumber> and I need to map it to this C struct |
18:35:35 | FromDiscord | <Gumber> but return a pointer |
18:35:40 | FromDiscord | <Gumber> and the C++ object is already allocated.... |
18:35:57 | FromDiscord | <Yardanico> In reply to @Lefl "Is there any way": can you show the definition of `Sensor` object? |
18:36:06 | * | def- quit (Quit: -) |
18:36:11 | FromDiscord | <Gumber> `object.name()`? |
18:36:16 | * | def- joined #nim |
18:36:16 | FromDiscord | <Lefl> Oh god I'm dumb |
18:37:03 | FromDiscord | <Lefl> In reply to @Gumber "`object.name()`?": no, I'm trying to use a property.↵But the issue is that I just now realized that I'm using the wrong object |
18:37:09 | FromDiscord | <Gumber> oh |
18:37:12 | FromDiscord | <Lefl> haha |
18:37:29 | FromDiscord | <j-james> In reply to @Yardanico "you can read the": How would you represent a very large integer? |
18:37:34 | FromDiscord | <Yardanico> In reply to @j-james "How would you represent": wdym? |
18:38:01 | FromDiscord | <Yardanico> if you want arbitrary-length integer, then you should get the bytes of it with whatever bignum library you're using I guess |
18:38:12 | FromDiscord | <j-james> Something larger than the `int64` type |
18:38:16 | FromDiscord | <j-james> I see, thanks |
18:41:40 | FromDiscord | <Gumber> scratch my question I'm dumb |
18:47:28 | * | max22- joined #nim |
18:52:38 | * | neurocyte01 joined #nim |
18:52:38 | * | neurocyte01 quit (Changing host) |
18:52:38 | * | neurocyte01 joined #nim |
18:53:14 | FromDiscord | <Goel> `var colors: seq[Rgba]` and `var colors: newSeq[Rgba]()` is exactly the same? |
18:55:43 | FromDiscord | <Yardanico> In reply to @Goel "`var colors: seq[Rgba]` and": no, the latter won't compile |
18:56:01 | FromDiscord | <Yardanico> but if you meant `var colors = newSeq[Rgba]()` in the second example, then yes, they're basically the same nowadays |
18:56:10 | FromDiscord | <Yardanico> as sequences in Nim are initialized by default nowadays |
18:57:47 | FromDiscord | <Goel> Yes that was a typo, i meant with `=` since i was reading that in an old post on the Nim forum. Good to know |
18:57:52 | FromDiscord | <Yardanico> although if you know how much elements you will need to add to your sequence you can preallocate the sequence by `newSeqOfCap[Rgba](size)` |
18:58:24 | FromDiscord | <Goel> No i don't |
18:59:41 | FromDiscord | <Yardanico> hmm? aren't you working with already parsed PNG files AFAIK? |
18:59:49 | FromDiscord | <Yardanico> so I thought you'd have the total number of pixels already |
19:03:34 | FromDiscord | <Goel> I am checking all pixels one by one for their color, and add each unique color to a seq. I was think to use one proc to automatically check if for example "value" is one of the item of the seq, but i can't do that because i already subdivided each of the raw bytes of the Image into a `rgba` format that is a tuple. I don't think i can check if a tuple is inside a seq of tuples? Or maybe yes, i haven't tried |
19:12:53 | * | ozzz quit (Read error: Connection reset by peer) |
19:15:47 | * | ozzz joined #nim |
19:17:55 | * | ozzz quit (Read error: Connection reset by peer) |
19:21:14 | * | ozzz joined #nim |
19:27:30 | FromDiscord | <auxym> anyone have an idea exactly what is the difference between `--os:any` and `--os:standalone`? |
19:28:06 | * | ozzz quit (Read error: Connection reset by peer) |
19:28:27 | FromDiscord | <Yardanico> In reply to @auxym "anyone have an idea": the original PR adding os:any is https://github.com/nim-lang/Nim/pull/13088 |
19:28:42 | FromDiscord | <Yardanico> nowadays in most cases you should use os:any instead of os:standalone |
19:29:47 | FromDiscord | <auxym> thanks |
19:29:59 | FromDiscord | <Yardanico> there was more info about it, I think on the forum, lemme try to find it |
19:30:32 | * | ozzz joined #nim |
19:30:47 | FromDiscord | <Yardanico> ah yeah https://nim-lang.org/docs/nimc.html#nim-for-embedded-systems also has some info about it |
19:32:47 | FromDiscord | <auxym> yeah I had seen that. By any chance, are you aware of a example getting nim to build for ARM MCUs with arm-none-eabi-gcc? It seems to be emitting `_exit` syscall which fails to link (`exit.c:(.text.exit+0x18): undefined reference to _exit`) |
19:33:26 | FromDiscord | <Yardanico> maybe https://stackoverflow.com/questions/19419782/exit-c-text0x18-undefined-reference-to-exit-when-using-arm-none-eabi-gcc can help you? |
19:33:31 | FromDiscord | <Yardanico> the second answer |
19:33:36 | FromDiscord | <Yardanico> or the third |
19:36:54 | * | neurocyte01 quit (Quit: The Lounge - https://thelounge.chat) |
19:38:59 | * | neurocyte01 joined #nim |
19:38:59 | * | neurocyte01 quit (Changing host) |
19:38:59 | * | neurocyte01 joined #nim |
19:43:38 | FromDiscord | <auxym> yeah `--passC:--specs=nosys.specs` seems to work. I don't understand though because I thought arm-none-eabi-gcc linked against Newlib by default, which defines _exit |
20:10:41 | FromDiscord | <auxym> after doing some more reading, it seems that nosys actually is used to enable linking against Newlib's syscalls. duh. |
20:48:26 | * | mst quit (Changing host) |
20:48:26 | * | mst joined #nim |
20:59:33 | FromDiscord | <Varriount> Is there a way to ensure a case statement explicitly covers a subset of an enumeration? |
21:01:11 | FromDiscord | <Elegantbeef> Short of `else: assert x in yourSubSet` dont think so |
21:01:22 | FromDiscord | <Elegantbeef> `notin` of course |
21:02:10 | FromDiscord | <Elegantbeef> Is it a range of values or a set of them? |
21:03:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/MZ6 |
21:12:41 | FromDiscord | <Varriount> @ElegantBeef I assume `range[0u8..3u8](2u8)` would throw a conversion error if `2u8` were substituted with a variable containing an `int8` value not between `0u8..3u8`? |
21:14:04 | FromDiscord | <Elegantbeef> I mean it's a range defect if you convert a value outside the range into the range |
21:14:10 | FromDiscord | <Elegantbeef> It's like `256.uint8` |
21:14:41 | FromDiscord | <Elegantbeef> You of course should check the range before hand to prevent a raised defect |
21:16:28 | FromDiscord | <leorize> https://github.com/nim-lang/Nim/pull/15212 |
21:16:35 | FromDiscord | <leorize> another plug for my pr \:p |
21:16:43 | FromDiscord | <Elegantbeef> Indeed |
21:17:15 | FromDiscord | <Elegantbeef> Such a addition delayed for not very good reason \:D |
21:19:38 | * | luis_ quit (Quit: luis_) |
21:20:07 | * | luis_ joined #nim |
21:20:24 | FromDiscord | <Elegantbeef> Maybe we need to make a `subrangeutils` package leorize 😛 |
21:20:51 | FromDiscord | <leorize> we need `realtypetraits` |
21:26:06 | FromDiscord | <auxym> it seems that `-d:release` (or danger) automatically implies `--opt:speed`, overriding any `--opt` that is passed by the user. Is this expected behavior? |
21:28:18 | * | luis_ quit (Ping timeout: 260 seconds) |
21:28:34 | FromDiscord | <Yardanico> In reply to @auxym "it seems that `-d:release`": yes, it is |
21:28:42 | FromDiscord | <Yardanico> you can always just do -d:release --opt:size to set opt to something else |
21:28:53 | FromDiscord | <Yardanico> just make sure it's placed after -d:release in the cmdline |
21:29:10 | * | max22- quit (Quit: Leaving) |
21:29:33 | FromDiscord | <auxym> oh yeah, that works. doesn't work in nim.cfg though |
21:29:41 | FromDiscord | <Yardanico> wdym? |
21:29:56 | FromDiscord | <leorize> yea, -d\:release is special |
21:30:03 | FromDiscord | <Yardanico> -d:release didn't work in nim configs until nim 1.4.8 |
21:31:43 | FromDiscord | <auxym> hm wait. it seems something else might be triggering it |
21:32:32 | FromDiscord | <Yardanico> oh wow, I didn't know new {.all.} pragma for importing all symbols actually worked with [] import syntax |
21:32:36 | FromDiscord | <Yardanico> `import std/[db_sqlite {.all.}, sqlite3 {.all.}]` this works just fine |
21:33:38 | FromDiscord | <Yardanico> (talking in the context of https://forum.nim-lang.org/t/8433 ) |
21:34:17 | FromDiscord | <auxym> actually I think it's good. couldn't reproduce. putting `define="release"` before `--opt:size` does seem to work as expected |
21:38:35 | FromDiscord | <Yardanico> @auxym what did you mean in https://forum.nim-lang.org/t/6844#54452 bwt? |
21:38:36 | FromDiscord | <Yardanico> (edit) "bwt?" => "btw?" |
21:38:52 | FromDiscord | <Yardanico> You can define some options conditionally, e.g. depending on a custom symbol |
21:39:06 | FromDiscord | <Yardanico> e.g. see https://github.com/Yardanico/adbscan/blob/master/src/adbscan.nims |
21:42:28 | FromDiscord | <auxym> Thanks for the example. Is there a way then to get the value of `--cpu` and `--os` in order to set `gcc.exe` conditionally? |
21:42:29 | FromDiscord | <Varriount> leorize: Commented on your PR. Personally, I would rather it be in `system`, since it seems like something that should be "built-in", as it were. |
21:42:56 | FromDiscord | <Varriount> @auxym In nim.conf? |
21:42:58 | FromDiscord | <Yardanico> In reply to @auxym "Thanks for the example.": yep |
21:43:06 | FromDiscord | <Yardanico> you can access buildOS and buildCPU from nimscript files |
21:43:07 | FromDiscord | <Elegantbeef> I'd argue it should just be `slice` but that's bikeshedding 😀 |
21:43:19 | FromDiscord | <auxym> much thanls |
21:43:25 | FromDiscord | <Yardanico> https://nim-lang.org/docs/nimscript.html#buildOS https://nim-lang.org/docs/nimscript.html#buildCPU |
21:44:22 | FromDiscord | <Varriount> In reply to @Elegantbeef "I'd argue it should": Meh, IMO, `slice` is just a run-time representation of `range`. |
21:45:06 | * | luis_ joined #nim |
21:45:36 | FromDiscord | <Elegantbeef> Oh i agree but given some dont like the `x in T` |
21:47:20 | * | max22- joined #nim |
21:48:35 | FromDiscord | <leorize> I can make it `of` \:p |
21:49:04 | FromDiscord | <Elegantbeef> lol i like the `in` |
21:49:30 | * | max22- quit (Client Quit) |
21:50:49 | FromDiscord | <leorize> worst case I would just make an `inspector` package for nim types |
21:51:09 | FromDiscord | <Elegantbeef> Indeed then you have contributions from a numpty 😛 |
21:52:19 | FromDiscord | <leorize> or you can make it \:p I have more than enough packages to tend to atm |
21:52:25 | FromDiscord | <Elegantbeef> Like i dont 😛 |
21:52:55 | FromDiscord | <Elegantbeef> Hey one of you lurkers get on it, i know you're reading this message |
21:54:07 | FromDiscord | <Elegantbeef> Fucking lurkers, pretending they dont read messages, shame! |
21:56:41 | FromDiscord | <Yardanico> Hey, be more polite to them! |
21:56:54 | FromDiscord | <Elegantbeef> Ah sorry, sodding lurkers\ |
21:57:16 | FromDiscord | <Yardanico> Otherwise they might start silently hating you ლ(ಠ益ಠლ) |
21:57:27 | FromDiscord | <Yardanico> sorry I meant (╬ ಠ益ಠ) |
21:57:27 | FromDiscord | <leorize> I think it might be a bad idea to promote doing this for modules you don't own↵(@Yardanico) |
21:57:31 | FromDiscord | <Elegantbeef> Eh rika vocally hates me what's new |
21:57:40 | FromDiscord | <Yardanico> @leorize well, but it's better than having to edit stdlib modules |
21:58:09 | FromDiscord | <Yardanico> of course you might argue that patchFile is better since then you control the whole file, but {.all.} is simpler |
21:58:15 | FromDiscord | <leorize> then the next update shuffles the names around and their software stops compiling |
21:58:43 | FromDiscord | <Yardanico> sure, you can post that warning on the forum post :) |
21:58:53 | FromDiscord | <Yardanico> i kind of forgot about that, but generally stdlib modules like db_sqlite are pretty stable :P |
21:59:15 | FromDiscord | <leorize> you mean no one works on them \:p |
21:59:22 | FromDiscord | <Yardanico> shhh |
22:38:17 | NimEventer | New Nimble package! surfing - Surfing is a highly functional CLI for Base64., see https://github.com/momeemt/surfing |
22:43:31 | * | luis_ quit (Ping timeout: 252 seconds) |
22:46:04 | FromDiscord | <dom96> what is this {.all.} thing? |
22:47:43 | FromDiscord | <Elegantbeef> It overrides export markers and pulls all main symbols |
22:48:05 | FromDiscord | <Elegantbeef> Useful for texting APIs |
22:48:29 | FromDiscord | <Yardanico> In reply to @dom96 "what is this {.all.}": imports all modules from a module |
22:48:33 | FromDiscord | <Yardanico> (edit) "modules" => "symbols" |
22:48:41 | FromDiscord | <Yardanico> both private and public ones |
22:49:02 | FromDiscord | <Yardanico> there's also a new stdlib module for accessing private fields of an object without importing the whole module with {.all.} |
22:49:16 | FromDiscord | <Yardanico> https://nim-lang.github.io/Nim/importutils.html |
22:51:33 | FromDiscord | <Varriount> This might sound like a stupid question, but do boolean expressions run in the compiler VM perform short-circuiting? And if so, is it only in `if` statements, or is it in `var` statements too? |
23:33:29 | * | Gustavo6046_ joined #nim |
23:33:40 | * | Gustavo6046 quit (Ping timeout: 240 seconds) |
23:36:11 | * | Gustavo6046_ is now known as Gustavo6046 |