<< 18-09-2021 >>

00:11:11FromDiscord<Richard> sent a long message, see http://ix.io/3zcT
00:11:47FromDiscord<Richard> I'm trying to convert a python dataframe object back into a nim table, is there any way to do this?
00:15:03FromDiscord<Elegantbeef> Is this just a test? Cause there are CSV libraries for nim?
00:16:25FromDiscord<Richard> Yes I know I just want to see if it works
00:16:26FromDiscord<Elegantbeef> I imagine you need to iterate over the df to extract the data but idk what's inside df
00:17:07FromDiscord<Richard> Just some sample data on the internet https://media.discordapp.net/attachments/371759389889003532/888579355184345118/data.csv
00:21:18FromDiscord<Elegantbeef> I more mean i dont know what the df data type is
00:22:36FromDiscord<gogolxdong (liuxiaodong)> How to construct constructor of contract with nim-web3?
00:26:13FromDiscord<Richard> I think it says PyObject in my linter
00:29:52FromDiscord<Elegantbeef> Idk
00:29:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3zcX
00:30:08FromDiscord<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:21FromDiscord<gogolxdong (liuxiaodong)> I found out nim-web3 handles only function and event but constructor.
02:33:50*arkurious quit (Quit: Leaving)
04:05:41FromDiscord<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:08FromDiscord<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:27FromDiscord<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:32FromDiscord<jakefromstatefarm> Does anyone know of something like this?
04:08:36nrds<Prestige99> Didn't know that was possible, I just use viml
04:08:43nrds<Prestige99> Would be nice though
04:09:59FromDiscord<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:15FromDiscord<jakefromstatefarm> My vimrc is gigantic though, so...
04:10:40FromDiscord<jakefromstatefarm> However, I wish to change that, by using a proper language for handling the added logic.
04:11:05FromDiscord<leorize> you can do it in nim to a certain extent
04:11:18FromDiscord<leorize> either you use the node.js integration and use `nim js`
04:11:40FromDiscord<leorize> or you write a msgpack interface for nim -\> nvim and use it instead
04:12:43nrds<Prestige99> Hmm there's no way for a table's values to be of different types, is there
04:13:03FromDiscord<leorize> you can use union if you're brave enough \:p
04:13:27FromDiscord<leorize> shameless plug\: https://github.com/alaviss/union
04:13:31nrds<Prestige99> Might need to make a custom implementation or something
04:14:03FromDiscord<jakefromstatefarm> Yeah, found that on DDG just as you sent that
04:14:14FromDiscord<jakefromstatefarm> Your pfp gave you away, lol \:)
04:14:20FromDiscord<leorize> \:p
04:14:39FromDiscord<jakefromstatefarm> I'm new to nim, what does that actually do?
04:15:09arfyhuh, is that like a union in C?
04:15:31FromDiscord<Elegantbeef> No it's like a union in TS
04:15:49FromDiscord<Elegantbeef> It's practically a anonymous tagged union
04:15:51FromDiscord<jakefromstatefarm> After further reading, it looks like union, the programming concept, nothing unique to nim, though it is in nim
04:16:08FromDiscord<jakefromstatefarm> no longer too confused
04:16:18FromDiscord<Elegantbeef> Leorize's response was to prestige
04:17:04FromDiscord<jakefromstatefarm> Ohh, I see
04:17:15FromDiscord<jakefromstatefarm> 🤦‍♂️
04:18:54nrds<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:18FromDiscord<Elegantbeef> That's what union does
04:19:22FromDiscord<Elegantbeef> Or sumtypes
04:19:35FromDiscord<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:43nrds<Prestige99> I mean something else
04:20:06FromDiscord<Elegantbeef> Well examples paint a thousand words
04:21:15nrds<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:25nrds<Prestige99> problem is each property could be a different type
04:23:19FromDiscord<leorize> I'm still not sure why does union not solve your problem
04:24:10nrds<Prestige99> I'm not sure how it would, but I'm working on an example
04:32:05nrds<Prestige99> https://play.nim-lang.org/#ix=3zdx crude example, still trying to figure out how I'd want to do this
04:32:33nrds<Prestige99> But I'd prefer doing this more dynamically than creating union types of all properties of type Foo
04:38:40FromDiscord<leorize> just forget that types exist for a second then write your example I guess
04:38:56FromDiscord<Varriount> ^
04:40:46nrds<Prestige99> Alright
04:41:42FromDiscord<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:23FromDiscord<leorize> it is possible if you're creative enough \:p
04:42:24nrds<Prestige99> Trying to find a way to achieve my end goal basically
04:42:33nrds<Prestige99> been racking my brain for a way to do this in nim
04:42:44nrds<Prestige99> updating my example atm
04:43:01FromDiscord<leorize> so can you show the way its done in not nim then? \:p
04:43:18FromDiscord<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:25nrds<Prestige99> Writing an example without types basically, give me a min
04:43:27FromDiscord<Elegantbeef> You want to attach arbitrary data to an object to be updated by a single call afaict
04:43:38nrds<Prestige99> or if you're familiar with godot you might know what I mean
04:43:59FromDiscord<leorize> I think the gamedev people are sleeping atm
04:44:14FromDiscord<Elegantbeef> Fuck you leorize!
04:44:53nrds<Prestige99> or maybe this might even help: https://i.imgur.com/fzCAQNd.png
04:45:15nrds<Prestige99> picture of an anmation in godot - can add "tracks" per property, assign values at certain times
04:45:21FromDiscord<Elegantbeef> Could you not just use Nim's oop logic like that'd do probably underneath?
04:45:25nrds<Prestige99> trying to replicate this system
04:46:18FromDiscord<Elegantbeef> Does it support more than just primitives?
04:46:28FromDiscord<leorize> I thought you're a compiler dev beef xd
04:46:34FromDiscord<Elegantbeef> Havent used godot's animator, have used unity's dont recall it supporting anything but primitives
04:46:43FromDiscord<Varriount> Prestige: By "track", you mean the property changes over time?
04:47:10FromDiscord<Elegantbeef> It's a keyframe system which can reference fields of objects
04:47:11FromDiscord<leorize> this looks like an issue to be described via a schema or something
04:47:12FromDiscord<Elegantbeef> So yes
04:47:31nrds<Prestige99> Yes
04:47:38FromDiscord<Elegantbeef> You make an animation it changes a referenced value over time
04:47:45nrds<Prestige99> ^
04:48:05nrds<Prestige99> https://play.nim-lang.org/#ix=3zdz without types, another crude example.. but yeah that's the main idea
04:48:11FromDiscord<Elegantbeef> I'd say just use a Union for primitives
04:48:14FromDiscord<Varriount> Sounds like, rather than generating fields, you need to generate logic instead,
04:48:35nrds<Prestige99> My main problem (I think) is, I don't know how I'd be storing this data
04:48:45FromDiscord<Elegantbeef> Alternatively copy your data to a `seq[byte]` then pass them to a function to use
04:48:45nrds<Prestige99> the array of values and property names
04:48:46*pro joined #nim
04:49:10FromDiscord<leorize> a vtable impl probably work if you insist on having them statically typed
04:49:20FromDiscord<Elegantbeef> Well you need to store a loadable reference to the object and the field names you want to capture
04:49:30FromDiscord<leorize> otherwise `Table[string, union(<primitives here>)]`
04:50:07FromDiscord<Elegantbeef> Despite all outward appearances i'm indeed a gamedev 😛
04:50:14nrds<Prestige99> probably would want it to work with tuples as well
04:50:19nrds<Prestige99> but yeah a vtable would work I guess
04:51:09FromDiscord<Elegantbeef> Cant you read C++ prestige? go look how they do it 😛
04:51:15nrds<Prestige99> Was hoping that, since these would be known at compile time, I could just create these on the type
04:52:13FromDiscord<leorize> your main issue would be to know "where" the fields are
04:52:33FromDiscord<Rika> Damn beef moving up in the hierarchy now a compiler dev
04:52:48FromDiscord<Elegantbeef> Apparently so
04:52:56FromDiscord<Elegantbeef> Soon i'll be running this taco stand
04:52:56FromDiscord<leorize> now this depends a lot on how your system is designed
04:53:02nrds<Prestige99> wouldn't it just be like, this.`propertyName` = foo
04:53:08nrds<Prestige99> via a macro
04:53:19FromDiscord<leorize> if whatever the handler for the keyframe you create can be generic, then you can create a type with introspection
04:53:42FromDiscord<leorize> then use it on the keyframe type to produce the handler at compile-time
04:53:45FromDiscord<leorize> something like that
04:54:24FromDiscord<Varriount> Prestige: Are all the fields for the type known at definition time?
04:54:37nrds<Prestige99> Yea
04:54:44FromDiscord<leorize> for example uniontraits have this thing called `contains()` which can query at compile-time whether a type exist
04:55:06FromDiscord<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:18FromDiscord<leorize> I imagine you can create a similar system for your keyframe types
04:55:46FromDiscord<Varriount> Prestige: Is there a reason the `rotation` fields has to be an `int`, rather than, say, a `Keyframe[int]`?
04:56:59nrds<Prestige99> well these are properties of like, any object, that someone would want to use
04:56:59FromDiscord<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:32nrds<Prestige99> It'd be the same for every instance
04:57:52nrds<Prestige99> e.g. we create a Player, and a player has a set of animation tracks for a walk animation
04:58:06FromDiscord<Varriount> So the track data is constant? It could theoretically be stored in a `const`?
04:58:10nrds<Prestige99> We'd want to change properties like sprite frames and rotation over a period of time
04:58:20nrds<Prestige99> Yeah I believe so
04:59:15nrds<Prestige99> We should be able to generate a function that updates the animation tracks, at compile time
04:59:18nrds<Prestige99> afaict
05:00:08FromDiscord<Elegantbeef> then what update should be is a `proc updateRot(foo: var Foo, time: float) = foo.rot = sampleData(time)` basically 😀
05:00:32nrds<Prestige99> yeah
05:01:09FromDiscord<Varriount> A macro can generate constants. A macro could take a type, and generate a `const fieldName: Keyframe[fieldType] = ...`.
05:01:19FromDiscord<Varriount> for every field in the type.
05:02:08FromDiscord<Varriount> Or even copy the type definition, give it a new name, and replace each field with a keyframe type.
05:03:40FromDiscord<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:10nrds<Prestige99> yeah
05:04:15FromDiscord<Varriount> That would work too, although the procedure would need to be called somewhere.
05:04:49FromDiscord<Elegantbeef> You'd subscribe it to the macro seq and then have a `animate(Foo, time)`
05:05:04FromDiscord<Varriount> Prestige: You might be able to take advantage of the `{.global.}` pragma for procedure variables.
05:05:06FromDiscord<Elegantbeef> `animate` unpacks the macro cache calling all the gensym'd animations
05:05:32FromDiscord<Varriount> ^
05:06:01FromDiscord<Elegantbeef> This way it's totally safe and not flooding your code base with visible proc defs
05:06:11FromDiscord<Elegantbeef> I can whip together an example if you need it 😉
05:06:23nrds<Prestige99> please lol
05:06:34FromDiscord<Varriount> Elegantbeef: I'd be interested in your example too.
05:06:37FromDiscord<Elegantbeef> Ok!
05:06:55FromDiscord<Elegantbeef> cracks neck
05:15:27FromDiscord<Gumber> Can Nim not handle C++ 20 / latest?
05:16:06FromDiscord<Gumber> in terms of codegen
05:16:27FromDiscord<leorize> probably, C++ codegen is pretty neglected afaict
05:16:48FromDiscord<Gumber> okay - I'll just build the lib and statically bind to it rather than trying to compile it with Nim
05:16:51FromDiscord<Gumber> thanks leorize
05:17:04FromDiscord<Gumber> link to it not bind
05:17:10FromDiscord<Gumber> whatever blaming COVID brain fog
05:17:41FromDiscord<Gumber> I don't even know if that will work
05:17:53FromDiscord<Gumber> it probably wont...
05:18:11FromDiscord<leorize> I believe the -std flag is hardcoded in the compiler though
05:18:20FromDiscord<leorize> so you might have to patch it out first
05:18:33FromDiscord<Gumber> I mean I'm using vcc so I am passing /std:c++latest
05:18:34FromDiscord<Gumber> or 20
05:18:41FromDiscord<Gumber> then I get a bunch of stdlib errors
05:18:55FromDiscord<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:08FromDiscord<leorize> nim + vcc is never tested afaik
05:19:15FromDiscord<Gumber> I use it fairly frequently
05:19:19FromDiscord<Gumber> and haven't had too many problems
05:19:23FromDiscord<Gumber> but I never try modern C++ really
05:19:38FromDiscord<Gumber> I just have this one library that apparently has something that needs C++20 or latest
05:20:05FromDiscord<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:44FromDiscord<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:53FromDiscord<Gumber> but I'm going to try my damndest
05:21:23FromDiscord<Gumber> of course this library has like six other dependencies I already had to build
05:21:44FromDiscord<leorize> linking should not be an issue
05:21:47FromDiscord<Gumber> and then link and include header paths to etc... but it's fine haha, if it works I wont' complain
05:21:54FromDiscord<Gumber> okay, let's see what happens 😄
05:22:00FromDiscord<leorize> the issue is whether the header will compile under older standard
05:22:18FromDiscord<Gumber> yeah I see what you're getting at
05:22:25FromDiscord<Gumber> let's hope it's all in implementation files
05:33:06FromDiscord<Elegantbeef> Time! https://play.nim-lang.org/#ix=3zdG
05:33:53FromDiscord<Elegantbeef> Of course you can always skip the proc call since it's rather simple and can just be a statement
05:34:05FromDiscord<Elegantbeef> But it reduces the duplicate constants all over the file
05:35:47FromDiscord<Elegantbeef> @Varriount\: that's for you and prestige i guess 😛
05:41:24FromDiscord<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:34FromDiscord<Elegantbeef> Atleast that's good for enums 😛
05:42:54FromDiscord<Elegantbeef> If you're changing an enum state at given animation frames that'd be rather useful
05:48:02FromDiscord<Gumber> yup I'm boned
05:48:13FromDiscord<Gumber> fawkkkkkkkkkkkkkkkkkkkkkk
05:48:25FromDiscord<Gumber> this happens like every time I touch the cpp backend lol
05:48:32FromDiscord<Elegantbeef> Most people are happy when that happens \:D
05:48:37FromDiscord<Gumber> eh
05:48:49FromDiscord<Elegantbeef> Getting boned 😛
05:48:53FromDiscord<Gumber> oh I got the joke lol
05:49:16FromDiscord<Gumber> I'm just not really laughing at this point, like three or four days invested into this idea
05:49:33FromDiscord<Gumber> and now I need to reevalute the whole rendering situation
05:49:41FromDiscord<Gumber> and what I'm going to do
05:49:47FromDiscord<Gumber> or I need to port this library
05:49:58FromDiscord<Gumber> and learn C++20
05:50:00FromDiscord<Gumber> apparently
05:50:16FromDiscord<Rika> In reply to @Gumber "and learn C++20": H a v e f u n
05:51:26FromDiscord<Gumber> maybe I can just write a C interface for it?
05:51:43FromDiscord<Gumber> and bind to that?
05:56:04FromDiscord<Rika> You could
05:56:37nrds<Prestige99> Thanks beef I'll look this over when I'm more awake later
05:58:53FromDiscord<Gumber> way less work than a full port, so I'll try that I guess
06:12:05nrds<Prestige99> how did you learn all this craziness @Elegantbeef
06:14:15FromDiscord<Elegantbeef> I've written many macros
06:14:16FromDiscord<Elegantbeef> So do that 😛
06:14:35nrds<Prestige99> Hah, alright
06:14:35FromDiscord<Elegantbeef> I've also worked on the compiler as you know mostly in semantic analysis which is like one step lower
06:41:08nrds<Prestige99> I'll probably implement this into my engine tomorrow and show you how I've used it, should be fun
06:43:48FromDiscord<Elegantbeef> The only restriction is that the type has a `lerp` function implemented obviously
06:43:58FromDiscord<Elegantbeef> Which is basically your entire interface system
06:45:10nrds<Prestige99> Yeah I was thinking of providing an easing function for each track so we could use whatever
06:47:27FromDiscord<Elegantbeef> Yea in that case you can replace the `sample` with your own sample or just override `lerp`
06:48:17nrds<Prestige99> Hmm I also will need to track these animations (collections of "tracks") so I can swap between them
06:48:38nrds<Prestige99> Walk vs jump animation for example
06:48:58nrds<Prestige99> Should probably worry about this when I'm not dead tired lol
06:50:09FromDiscord<Elegantbeef> Well feel free to ping me if/when you need help
06:50:17nrds<Prestige99> Thanks
06:55:50*max22- joined #nim
06:58:35FromDiscord<Gumber> heyyyy that works
06:58:39FromDiscord<Gumber> back in business
06:58:52FromDiscord<Gumber> just another layer of bindings to create 😢
07:14:02*max22- quit (Quit: Leaving)
08:06:47FromDiscord<Rika> bindings on bindings
08:21:21*max22- joined #nim
08:41:26arfyis 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:35FromDiscord<Rika> closure iterators
08:43:27arfyaha
08:43:30arfythanks
08:51:53FromDiscord<Gumber> finally
08:52:16FromDiscord<Gumber> have things compiling again with all the spirv-cross and shaderc libs linking correctly
08:52:18FromDiscord<Elegantbeef> Or CPS if you want to play with that 😛
08:52:21FromDiscord<Gumber> yay - can write my renderer now
08:52:30FromDiscord<Gumber> but it's time for sleepz, cya all tomorrow
08:54:32FromDiscord<cabboose> CPS always
10:07:32NimEventerNew 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:47FromDiscord<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:20FromDiscord<Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3zfl
14:17:27FromDiscord<Rika> that should be in the bass documentation
14:19:33FromDiscord<Smarc> Tried to look it up there, but could not find anything. I was hoping I'd find someone with expertise :)
14:26:54FromDiscord<Rika> Not a lot of people here know bass
14:29:33FromDiscord<Smarc> I mean.. Is there another, more used audio library that is capable of playing (parts of) .ogg files?
14:33:40FromDiscord<fae> treeform wrote a nice sound lib https://github.com/treeform/slappy
14:34:02FromDiscord<fae> if you're okay with openal
14:34:52Amun-Rahow about libogg?
14:36:52FromDiscord<fae> <https://github.com/treeform/slappy#proc-playback>
14:37:01FromDiscord<fae> set time offset in sec
14:47:45FromDiscord<dain> if I call a `func` (no side effects) and I discard the result, will the compiler just delete it?
14:47:50FromDiscord<dain> since it won't affect anything
14:47:57FromDiscord<dain> (edit) "discard" => "`discard`"
14:48:49FromDiscord<Rika> no
14:48:58FromDiscord<Rika> i dont think that kind of optimisation is in the compiler
14:49:07FromDiscord<Rika> also its not a guarantee either
14:49:11FromDiscord<Rika> you can fool effects tracking
14:49:30FromDiscord<Rika> of course its not recommended to do so
15:00:13FromDiscord<Smarc> I can't get slappy to run the README example ..
15:03:15FromDiscord<Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3zfP
15:10:20FromDiscord<Smarc> Wouldn't that mean that the actual package is incorrect?
15:10:59FromDiscord<Rika> well whats the full error?
15:11:59FromDiscord<Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3zfX
15:12:06FromDiscord<Smarc> missing a 's' at the beginning
15:17:16FromDiscord<frankzig> how can i create a Seq ensuring that it has atleast space for N items and not need realloacation?
15:22:23FromDiscord<pietroppeter> https://nim-lang.org/docs/system.html#newSeqOfCap,Natural
15:35:33FromDiscord<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:24FromDiscord<dain> In reply to @Rika "i dont think that": what if it's just `discard foo`
17:53:28FromDiscord<dain> where `foo` is an ident
17:53:32FromDiscord<dain> is that just a noop
17:54:20*federico3[m] joined #nim
18:04:07FromDiscord<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:13FromDiscord<enthus1ast> @Smarc\: i've used "sound" for this\: https://github.com/yglukhov/sound.git
18:06:52FromDiscord<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:03FromDiscord<enthus1ast> but if you want to just play a part of an audio file, i think you need another module
18:09:27FromDiscord<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:17FromDiscord<Gumber> Anyone know how to represent a `std::vector` in `C`?
18:19:24FromDiscord<Gumber> I'm writing a C interface for a C++ API
18:19:42FromDiscord<Gumber> I know I need the pointer and the number of elements to call `std::vector.assign()`
18:19:51FromDiscord<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:52FromDiscord<Gumber> actually I guess it doesn't matter
18:21:00FromDiscord<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:09FromDiscord<deech> sent a code paste, see https://play.nim-lang.org/#ix=3zgU
18:31:32FromDiscord<j-james> Why do `toHex(string)` and `toHex(int)` return different values?
18:32:01FromDiscord<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:10FromDiscord<Yardanico> and toHex int returns the hex representation of the integer itself
18:32:18FromDiscord<Yardanico> string representation is different from binary representation obviously
18:32:26FromDiscord<deech> In reply to @deech "Any thoughts on allowing": Oh wait you can already do that with custom annotations, sorry.
18:32:52FromDiscord<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:57FromDiscord<j-james> Ah, makes sense
18:34:26FromDiscord<Gumber> hmm
18:35:03FromDiscord<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:13FromDiscord<Lefl> sent a code paste, see https://play.nim-lang.org/#ix=3zgV
18:35:22FromDiscord<Gumber> but now I have a C++ class instance
18:35:27FromDiscord<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:28FromDiscord<Gumber> and I need to map it to this C struct
18:35:35FromDiscord<Gumber> but return a pointer
18:35:40FromDiscord<Gumber> and the C++ object is already allocated....
18:35:57FromDiscord<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:11FromDiscord<Gumber> `object.name()`?
18:36:16*def- joined #nim
18:36:16FromDiscord<Lefl> Oh god I'm dumb
18:37:03FromDiscord<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:09FromDiscord<Gumber> oh
18:37:12FromDiscord<Lefl> haha
18:37:29FromDiscord<j-james> In reply to @Yardanico "you can read the": How would you represent a very large integer?
18:37:34FromDiscord<Yardanico> In reply to @j-james "How would you represent": wdym?
18:38:01FromDiscord<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:12FromDiscord<j-james> Something larger than the `int64` type
18:38:16FromDiscord<j-james> I see, thanks
18:41:40FromDiscord<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:14FromDiscord<Goel> `var colors: seq[Rgba]` and `var colors: newSeq[Rgba]()` is exactly the same?
18:55:43FromDiscord<Yardanico> In reply to @Goel "`var colors: seq[Rgba]` and": no, the latter won't compile
18:56:01FromDiscord<Yardanico> but if you meant `var colors = newSeq[Rgba]()` in the second example, then yes, they're basically the same nowadays
18:56:10FromDiscord<Yardanico> as sequences in Nim are initialized by default nowadays
18:57:47FromDiscord<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:52FromDiscord<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:24FromDiscord<Goel> No i don't
18:59:41FromDiscord<Yardanico> hmm? aren't you working with already parsed PNG files AFAIK?
18:59:49FromDiscord<Yardanico> so I thought you'd have the total number of pixels already
19:03:34FromDiscord<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:30FromDiscord<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:27FromDiscord<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:42FromDiscord<Yardanico> nowadays in most cases you should use os:any instead of os:standalone
19:29:47FromDiscord<auxym> thanks
19:29:59FromDiscord<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:47FromDiscord<Yardanico> ah yeah https://nim-lang.org/docs/nimc.html#nim-for-embedded-systems also has some info about it
19:32:47FromDiscord<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:26FromDiscord<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:31FromDiscord<Yardanico> the second answer
19:33:36FromDiscord<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:38FromDiscord<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:41FromDiscord<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:33FromDiscord<Varriount> Is there a way to ensure a case statement explicitly covers a subset of an enumeration?
21:01:11FromDiscord<Elegantbeef> Short of `else: assert x in yourSubSet` dont think so
21:01:22FromDiscord<Elegantbeef> `notin` of course
21:02:10FromDiscord<Elegantbeef> Is it a range of values or a set of them?
21:03:23FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/MZ6
21:12:41FromDiscord<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:04FromDiscord<Elegantbeef> I mean it's a range defect if you convert a value outside the range into the range
21:14:10FromDiscord<Elegantbeef> It's like `256.uint8`
21:14:41FromDiscord<Elegantbeef> You of course should check the range before hand to prevent a raised defect
21:16:28FromDiscord<leorize> https://github.com/nim-lang/Nim/pull/15212
21:16:35FromDiscord<leorize> another plug for my pr \:p
21:16:43FromDiscord<Elegantbeef> Indeed
21:17:15FromDiscord<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:24FromDiscord<Elegantbeef> Maybe we need to make a `subrangeutils` package leorize 😛
21:20:51FromDiscord<leorize> we need `realtypetraits`
21:26:06FromDiscord<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:34FromDiscord<Yardanico> In reply to @auxym "it seems that `-d:release`": yes, it is
21:28:42FromDiscord<Yardanico> you can always just do -d:release --opt:size to set opt to something else
21:28:53FromDiscord<Yardanico> just make sure it's placed after -d:release in the cmdline
21:29:10*max22- quit (Quit: Leaving)
21:29:33FromDiscord<auxym> oh yeah, that works. doesn't work in nim.cfg though
21:29:41FromDiscord<Yardanico> wdym?
21:29:56FromDiscord<leorize> yea, -d\:release is special
21:30:03FromDiscord<Yardanico> -d:release didn't work in nim configs until nim 1.4.8
21:31:43FromDiscord<auxym> hm wait. it seems something else might be triggering it
21:32:32FromDiscord<Yardanico> oh wow, I didn't know new {.all.} pragma for importing all symbols actually worked with [] import syntax
21:32:36FromDiscord<Yardanico> `import std/[db_sqlite {.all.}, sqlite3 {.all.}]` this works just fine
21:33:38FromDiscord<Yardanico> (talking in the context of https://forum.nim-lang.org/t/8433 )
21:34:17FromDiscord<auxym> actually I think it's good. couldn't reproduce. putting `define="release"` before `--opt:size` does seem to work as expected
21:38:35FromDiscord<Yardanico> @auxym what did you mean in https://forum.nim-lang.org/t/6844#54452 bwt?
21:38:36FromDiscord<Yardanico> (edit) "bwt?" => "btw?"
21:38:52FromDiscord<Yardanico> You can define some options conditionally, e.g. depending on a custom symbol
21:39:06FromDiscord<Yardanico> e.g. see https://github.com/Yardanico/adbscan/blob/master/src/adbscan.nims
21:42:28FromDiscord<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:29FromDiscord<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:56FromDiscord<Varriount> @auxym In nim.conf?
21:42:58FromDiscord<Yardanico> In reply to @auxym "Thanks for the example.": yep
21:43:06FromDiscord<Yardanico> you can access buildOS and buildCPU from nimscript files
21:43:07FromDiscord<Elegantbeef> I'd argue it should just be `slice` but that's bikeshedding 😀
21:43:19FromDiscord<auxym> much thanls
21:43:25FromDiscord<Yardanico> https://nim-lang.org/docs/nimscript.html#buildOS https://nim-lang.org/docs/nimscript.html#buildCPU
21:44:22FromDiscord<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:36FromDiscord<Elegantbeef> Oh i agree but given some dont like the `x in T`
21:47:20*max22- joined #nim
21:48:35FromDiscord<leorize> I can make it `of` \:p
21:49:04FromDiscord<Elegantbeef> lol i like the `in`
21:49:30*max22- quit (Client Quit)
21:50:49FromDiscord<leorize> worst case I would just make an `inspector` package for nim types
21:51:09FromDiscord<Elegantbeef> Indeed then you have contributions from a numpty 😛
21:52:19FromDiscord<leorize> or you can make it \:p I have more than enough packages to tend to atm
21:52:25FromDiscord<Elegantbeef> Like i dont 😛
21:52:55FromDiscord<Elegantbeef> Hey one of you lurkers get on it, i know you're reading this message
21:54:07FromDiscord<Elegantbeef> Fucking lurkers, pretending they dont read messages, shame!
21:56:41FromDiscord<Yardanico> Hey, be more polite to them!
21:56:54FromDiscord<Elegantbeef> Ah sorry, sodding lurkers\
21:57:16FromDiscord<Yardanico> Otherwise they might start silently hating you ლ(ಠ益ಠლ)
21:57:27FromDiscord<Yardanico> sorry I meant (╬ ಠ益ಠ)
21:57:27FromDiscord<leorize> I think it might be a bad idea to promote doing this for modules you don't own↵(@Yardanico)
21:57:31FromDiscord<Elegantbeef> Eh rika vocally hates me what's new
21:57:40FromDiscord<Yardanico> @leorize well, but it's better than having to edit stdlib modules
21:58:09FromDiscord<Yardanico> of course you might argue that patchFile is better since then you control the whole file, but {.all.} is simpler
21:58:15FromDiscord<leorize> then the next update shuffles the names around and their software stops compiling
21:58:43FromDiscord<Yardanico> sure, you can post that warning on the forum post :)
21:58:53FromDiscord<Yardanico> i kind of forgot about that, but generally stdlib modules like db_sqlite are pretty stable :P
21:59:15FromDiscord<leorize> you mean no one works on them \:p
21:59:22FromDiscord<Yardanico> shhh
22:38:17NimEventerNew 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:04FromDiscord<dom96> what is this {.all.} thing?
22:47:43FromDiscord<Elegantbeef> It overrides export markers and pulls all main symbols
22:48:05FromDiscord<Elegantbeef> Useful for texting APIs
22:48:29FromDiscord<Yardanico> In reply to @dom96 "what is this {.all.}": imports all modules from a module
22:48:33FromDiscord<Yardanico> (edit) "modules" => "symbols"
22:48:41FromDiscord<Yardanico> both private and public ones
22:49:02FromDiscord<Yardanico> there's also a new stdlib module for accessing private fields of an object without importing the whole module with {.all.}
22:49:16FromDiscord<Yardanico> https://nim-lang.github.io/Nim/importutils.html
22:51:33FromDiscord<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