00:11:16 | FromDiscord | <fae> What’s the difference between `1.0f` and `1.0'f` ? It seems the latter is mentioned in the reference as type suffixes, but no mention of the first syntax even though it seems valid? |
00:12:07 | FromDiscord | <Elegantbeef> `'` 😛 |
00:12:41 | FromDiscord | <fae> Also it seems strange that by default `float` is 64 bit but `1.0f` is 32 bit |
00:12:42 | FromDiscord | <Elegantbeef> They're identical you can do `10u8` or `10'u8` though with the new(devel new) user defined literals you need to do `'yourLit` |
00:12:43 | FromDiscord | <konsumlamm> the first is legal as well, but the secpnd is recommended, because you can define custom literal suffixes with the `'` syntax |
00:13:06 | FromDiscord | <Elegantbeef> well fae do `1.0` and then you'll really be confused 😉 |
00:13:21 | FromDiscord | <konsumlamm> `1.0f` being a float32 probably comes from that being the behaviour in C etc |
00:13:31 | FromDiscord | <fae> It’s by default `float` which is 64 bit no? |
00:13:37 | FromDiscord | <Elegantbeef> yes |
00:13:52 | FromDiscord | <fae> Yea this threw me off for like 20 min trying to render a triangle lol |
00:13:54 | FromDiscord | <konsumlamm> in Nim, `float` is 64 bit, but in C it's 32 bit |
00:13:56 | FromDiscord | <fae> My stride was wrong |
00:14:30 | FromDiscord | <Elegantbeef> `sizeof(var)` goes brrr |
00:14:40 | FromDiscord | <fae> So anyway, to answer my original question, using the type suffix syntax is more idiomatic |
00:15:59 | FromDiscord | <konsumlamm> they're both "type suffix syntax", but only the version with `'` can be user-defined |
00:16:20 | FromDiscord | <fae> Okay, thank you |
00:17:10 | FromDiscord | <konsumlamm> possibly `1.0f` will be deprecated in the future, in favor of `1.0'f` (or `1.0'f32` or something) |
00:17:28 | FromDiscord | <Elegantbeef> I dont see why it would |
00:18:37 | FromDiscord | <fae> It feels weird to have two syntax to do the exact same thing |
00:18:47 | FromDiscord | <Elegantbeef> Welcome to Nim fae |
00:19:03 | FromDiscord | <Elegantbeef> Nim tons of flexibility in how you do stuff |
00:20:25 | FromDiscord | <fae> Yea but usually multiple syntaxes will at least offer some type of ergonomic benefit. I don’t see it here, except the `'` being more noisy |
00:20:47 | FromDiscord | <fae> Like snake case or camel case calling is a feature. This just seems weird |
00:21:20 | FromDiscord | <fae> But I’m new so I’m sure I have plenty to learn about the benefits |
00:21:35 | FromDiscord | <Elegantbeef> Well there arent any benefits it's just if you prefer `'` or not 😀 |
00:21:44 | FromDiscord | <Elegantbeef> Atleast when talking about built ins |
00:22:20 | FromDiscord | <Elegantbeef> And now that i'm thinking about it the `1.0f` could be removed in favour of a non compiler supported variant, which could be a benefit |
00:22:33 | FromDiscord | <konsumlamm> and if you prefer consistency or having to type one chsracter less |
00:22:57 | FromDiscord | <konsumlamm> and that's also part of the reason, it could be defined in the stdlib |
00:22:59 | FromDiscord | <fae> i think i prefer consistency, making builtins more consistent with user defined makes more sense to me 🤷♂️ |
00:26:04 | FromDiscord | <fae> Another question... is there some magic that automatically applies the type of the first element in an array/seq to the rest of the elements? |
00:26:38 | FromDiscord | <konsumlamm> yes, that magic is called type inference |
00:28:12 | FromDiscord | <fae> sent a code paste, see https://play.nim-lang.org/#ix=3xaN |
00:28:31 | FromDiscord | <fae> you would think i wouldnt need to annotate the first element since ive already defined it as float32 |
00:29:01 | FromDiscord | <konsumlamm> indeed |
00:29:03 | FromDiscord | <Elegantbeef> Nim lacks good left to right hand type inference, which can cause hidden errors |
00:29:13 | FromDiscord | <fae> ahh |
00:29:21 | FromDiscord | <konsumlamm> ye, it's annoying sometimes |
00:29:41 | FromDiscord | <fae> I will look out for that, ty |
00:32:06 | FromDiscord | <Elegantbeef> The most annoying point is with expressions since you know the type should be X but the compiler is complaining the second value doesnt match |
00:34:01 | FromDiscord | <Elegantbeef> It's pretty common with procedures that are supposed to be converted to a specific type |
01:04:16 | FromDiscord | <cabboose> https://play.nim-lang.org/#ix=3xaU |
01:04:34 | FromDiscord | <cabboose> So I'm trying to understand how the `[]` func for hashsets work |
01:04:48 | FromDiscord | <cabboose> I'm passing it the same hash |
01:04:55 | FromDiscord | <cabboose> and I've provided a custom `==` function |
01:05:11 | FromDiscord | <cabboose> but still attempting to get the element with the same hash provides a key error |
01:05:44 | FromDiscord | <cabboose> is there some underlying issue? is it to do with using inheritable objects? |
01:07:46 | FromDiscord | <gogolxdong (liuxiaodong)> Anyone saw error like this `/home/lingx/.nimble/pkgs/websock-0.1.0/websock/extensions/compression/deflate.nim(384, 8) Error: cannot bind another '=destroy' to: DeflateExt:ObjectType; previous declaration was constructed here implicitly: /home/lingx/.nimble/pkgs/chronos-3.0.6/chronos/asyncmacro2.nim(321, 33)` |
01:11:29 | FromDiscord | <cabboose> Yeah status modules aren't usually orc/arc compatible afaik atm |
01:12:01 | * | neurocyte0 joined #nim |
01:12:01 | * | neurocyte0 quit (Changing host) |
01:12:01 | * | neurocyte0 joined #nim |
01:13:37 | FromDiscord | <cabboose> the compiler automatically constructs `=destroy` funcs if one isn't provided before the use of the type, trying to pass another one to it will cause that error |
01:14:25 | * | neurocyte quit (Ping timeout: 250 seconds) |
01:14:25 | * | neurocyte0 is now known as neurocyte |
01:14:29 | FromDiscord | <cabboose> `var ext: DeflateExt; ext.new(destroyExt)` thats the code being raised by the compiler |
01:19:32 | arkanoid | what does it mean "Error: unhandled exception: over- or underflow [OverflowDefect]" ? |
01:20:43 | arkanoid | I get it when I add this piece of code generated by c2nim https://termbin.com/44s1 |
01:21:25 | FromDiscord | <cabboose> what are you trying to do with c2nim and soap |
01:21:54 | FromDiscord | <cabboose> are you trying to make a soap client? |
01:21:57 | arkanoid | yes |
01:22:21 | FromDiscord | <cabboose> is it for a specific API or you want a general one |
01:22:43 | FromDiscord | <cabboose> because I have made specific API soap clients I can share the code for |
01:23:05 | arkanoid | oh, the error was generated by too many whitespaces after each string |
01:24:14 | arkanoid | cabboose. I've created a poc of a specific soap client too, lot's of xml stuff (deeply nested schemes here). Now I'm trying to wrap gSOAP |
01:24:31 | arkanoid | problem is that API I'm dealing with ha hundreds of functions |
01:24:36 | arkanoid | and complex types |
01:25:11 | arkanoid | I've been trying to metaprogramming all that, but it's very difficult and requires some parsing knowledge that I lack |
01:26:14 | FromDiscord | <cabboose> hahaha yeah I see what you mean; luckily the schemas I was accessing weren't too over developed |
01:26:15 | arkanoid | cabboose, but if you like to share, I'd be happy to read it |
01:27:11 | arkanoid | cabboose, I've a total of 42 xml files, the maximum import/include level is 7 |
01:27:58 | arkanoid | I just gave up after seeing complexType into complexType and so on for 6 times |
01:28:14 | arkanoid | so now I'm trying the wrapping path |
01:29:36 | FromDiscord | <cabboose> Soap do be like that 😦 |
01:30:01 | arkanoid | I got rid of the previous error, but now nim compiler complains about nil in my UncheckedArray https://termbin.com/44s1 |
01:30:11 | arkanoid | Error: type mismatch: got <typeof(nil)> but expected 'string' |
01:31:15 | arkanoid | cabbose I've already have a macro that given a Soap action and a wsdl file creates a proc for that to send request and receive response. Problem is data binding |
01:31:47 | arkanoid | I need to create objects for all functions input and output, it would take ages without some automation |
01:33:01 | FromDiscord | <cabboose> I haven't though about it too far but wouldn't tuples work? |
01:34:16 | FromDiscord | <cabboose> but then they'd probably be ridiculously nested considering what you're saying about the objects |
01:35:19 | arkanoid | cabboose, I'd be happy with tuples too |
01:35:27 | arkanoid | problem is data binding |
01:36:12 | arkanoid | I mean, writing a program that maps xml schema hierarchy to nim data types and back is hard |
01:36:33 | arkanoid | microsoft has it for c#, apache foundation has it for java |
01:37:18 | FromDiscord | <cabboose> I was happy with an agnostic response format so converted the soap response into json and then pass that to treeforms jsony to make my types |
01:37:22 | arkanoid | how can I tell that a [nil,nil,nil,nil] is of type array[0..3, string] when --nilseqs:on ? |
01:37:40 | FromDiscord | <cabboose> I don’t have any solution for input though |
01:38:23 | arkanoid | cabboose, yeah I also have that sort of automatic binding for all proc with no input args and just output |
01:39:03 | arkanoid | but I have to deal with input too. I have helper template for that that gives me easy way to map input, problem is still the amount of it |
01:39:16 | FromDiscord | <cabboose> Then you are alone friend; but I would be happy to help |
01:40:43 | FromDiscord | <gogolxdong (liuxiaodong)> @\_discord\_364103562243866624\:t2bot.io how to fix this error |
01:41:47 | arkanoid | cabboose, well if you know how to build a parser, I'm probably not too far away to achieve at least the xml to nim types part |
01:42:16 | arkanoid | then we would need the types to xml part, and that would also be part of a good parser |
01:42:32 | arkanoid | that's why I stopped, I need to study first |
01:43:22 | * | auxym_ quit (Ping timeout: 252 seconds) |
01:43:38 | FromDiscord | <cabboose> See my issue was I don’t know enough about wsdl |
01:43:51 | FromDiscord | <cabboose> I think the parser is not that bad |
01:43:52 | FromDiscord | <cabboose> hahahaha |
01:44:50 | arkanoid | wsdl is not difficult, it's just overly verbose |
01:44:56 | arkanoid | problem is xml schema |
01:45:01 | FromDiscord | <cabboose> You can’t fix the error unless you fork websock and maybe even chronos to make them gc arc/orc compatible |
01:45:57 | FromDiscord | <cabboose> chronos to a certain extent afaik is, but some of their client/server funcs aren’t |
01:46:26 | FromDiscord | <cabboose> it’s not a priority for them atm (stability and completion of what they’re making atm is) so if you can do that then you’d be swimmin |
01:47:21 | FromDiscord | <cabboose> arkanoid I can work with the lower end of xmlparse; you know wsdl and I don’t |
01:47:25 | FromDiscord | <cabboose> maybe we can make a brain baby |
01:47:29 | FromDiscord | <cabboose> hahahahaha |
01:49:57 | arkanoid | hahaha |
01:50:12 | arkanoid | but I quite don't get what you find difficult of wsdl |
01:50:40 | FromDiscord | <cabboose> I have 0 knowledge of it and i really didn't need to know it |
01:50:41 | arkanoid | you just need a couple of functions to reach al the leafs of a directory of xml, starting from a wsdl |
01:51:43 | arkanoid | wsdl contains function signatures, and with them the input and output types. Stating from there you seek all the xsd and all the types and build the hierarchy via a parser |
01:51:51 | FromDiscord | <cabboose> I have a pharmacy application in development that accesses a dispensary API that uses soap; the data is pretty easy to get at and I didn't want to 'waste' time on wsdl |
01:51:56 | arkanoid | wsdl is really the asy part |
01:52:52 | arkanoid | you've already done the hard part. Wsdl is just a normal wsdl schema plus a list of function names |
01:53:02 | FromDiscord | <cabboose> Yeah I get the basics of it, the verbosity made it look like vomit to me and I have the issue of being a dopamine deprived zoomer that needed results quickly |
01:54:47 | FromDiscord | <cabboose> Can you make a repo I can work on with you? |
01:54:52 | FromDiscord | <cabboose> maybe I can give it another crack |
01:55:17 | FromDiscord | <cabboose> I am overly adverse to having to learn how the scheme of wsdl works, xml is fair enough but wsdl just looked like vomit |
01:55:40 | arkanoid | cabbose, here you can find some wsdl reading, and just a quick try to fetch all the required items for each function https://play.nim-lang.org/#ix=3xaZ |
01:56:22 | arkanoid | cabboose, I am really conviced that you're overstimating wsdl a lot |
01:57:27 | arkanoid | code in incomplete,was just a quick try to fetch the required elements over multiple schemas given a wsdl |
01:58:05 | FromDiscord | <cabboose> Maybe; I only touched it because of the software I'm working with using it for their API but it's all inhouse and they provided me the wsdl files and yada yada yada I lost interest in it |
02:01:04 | arkanoid | if you managed to build valid soap messages with namespace and types stuff in place you've already grokked what's needed. wsdl just contains the action name |
02:02:09 | arkanoid | it's 99.9% understanding how schema works and build/parse valid xml from it, the rest (wsdl/soap messages) is just a verbose way to put that xml into another xml envelope |
02:04:34 | FromDiscord | <cabboose> I do understand how to build the soap messages but getting that information from the wsdl was my vomit that's all i can say |
02:04:37 | FromDiscord | <cabboose> hahahaha |
02:05:49 | FromDiscord | <cabboose> let me have a look at the wsdl I have and see if I can understand now |
02:05:52 | FromDiscord | <cabboose> but I doubt it |
02:06:43 | FromDiscord | <cabboose> Ok it actually makes a bit more sense now that you've explained it |
02:07:00 | FromDiscord | <cabboose> its still annoying to look at |
02:09:05 | FromDiscord | <cabboose> https://play.nim-lang.org/#ix=3xb5 would this be considered a simple wsdl? |
02:10:28 | * | LyndsySimon quit (Ping timeout: 256 seconds) |
02:12:51 | * | LyndsySimon joined #nim |
02:26:04 | arkanoid | cabbose, the complexity is not the wsdl, it's the type hierachy it uses |
02:26:46 | FromDiscord | <cabboose> Here's what I think, you give me a wsdl or something and tell me "parse this into this" and I can do it |
02:27:46 | FromDiscord | <cabboose> tell me to parse a wsdl and I have no idea what I'm trying to do with it; I just can't wrap my head around the absurdity of how it's formatted and what it's supposed to represent |
02:27:46 | arkanoid | this is what I'm working on: https://www.onvif.org/profiles/specifications/ |
02:28:13 | arkanoid | you can start from device.wsdl, that one drags in quite all the types |
02:29:09 | FromDiscord | <cabboose> ok and then how would you want it to work; would you want it to generate a soap envelope if you give it a function name and a tuple of params? would that work? |
02:29:28 | arkanoid | now sure how you can say that wsdl is complicated when at the same time you say that you've walked over xml schema specification that an order of magnitude more complicated |
02:30:30 | FromDiscord | <cabboose> I don't think I've walked over xml schema specification 😢 |
02:30:39 | FromDiscord | <cabboose> I am mentally deficient give me a break |
02:30:52 | arkanoid | if you manage to generate a wrapper that exposes all the wsdl procedures with input arguments (and maybe just generic json output) would be good |
02:31:35 | arkanoid | I've already done it by hand for the ones that I needed the most |
02:31:49 | arkanoid | (you can see that there are many wsdl on that website) |
02:34:30 | arkanoid | by xml schema specification, I mean this hell of a thing https://www.w3.org/TR/xmlschema11-1/ |
02:35:14 | arkanoid | that's basically what makes devs NOPE when someone proposes xml |
02:35:59 | arkanoid | except for microsoft people, they have wsdl.exe that comes with visual studio that given a wsdl creates C# class files and vice-versa |
02:36:14 | arkanoid | and that's also how most of the wsdl are created |
02:36:37 | FromDiscord | <cabboose> yeah no I didn't know about this; but I like this document, it so clearly outlines how it works |
02:36:43 | FromDiscord | <cabboose> this is easier to read than the wsdl file |
02:36:43 | FromDiscord | <cabboose> lol |
02:37:06 | * | arkurious quit (Quit: Leaving) |
02:38:11 | FromDiscord | <cabboose> ok I can do this probably, but I do have an assignment to work on for monday with my field of study being completely unrelated to this (medicine); but I will try to have something working by wed |
02:38:43 | FromDiscord | <cabboose> you keep doing your wrap of gSOAP but I don't see the issue with making a parser |
02:41:29 | arkanoid | are you on linux/windows/other? |
02:44:47 | FromDiscord | <cabboose> windows |
02:45:39 | FromDiscord | <cabboose> pharmacies in australia will forever be on windows and I will forever have to develop on windows lol |
02:50:45 | arkanoid | so you have access to wsdl.exe |
02:51:09 | arkanoid | https://docs.microsoft.com/en-us/sql/reporting-services/report-server-web-service/net-framework/creating-the-web-service-proxy?view=sql-server-ver15 |
02:51:19 | arkanoid | not sure if something more recent is in use today |
02:51:49 | arkanoid | but you can have a look on how that tool generates classes to find out if your typing is going into a walkable path |
02:52:19 | arkanoid | it is also available in the mono framework on linux, but I think it is somehow less capable |
02:57:22 | * | flynn quit (Read error: Connection reset by peer) |
02:58:29 | * | flynn joined #nim |
02:59:47 | arkanoid | I'm dealing with a dynlib that fails with error "/usr/lib/x86_64-linux-gnu/libgsoap.so: undefined symbol: namespaces". That symbol is contained in a .h file that I'm importing with {.emit: """#include "../ffi/DeviceBinding.nsmap"""".}, but I keep getting that error |
03:14:20 | arkanoid | how is that nim complains about "undefined symbol: namespaces" even before that the includes in the emit section are processed? |
03:14:46 | arkanoid | I can put jibberish text into those .h and the result is the same undefined symbol |
03:26:48 | FromDiscord | <demotomohiro> Are you sure the error comes from nim, not from backend c compiler? |
03:28:35 | FromDiscord | <demotomohiro> Maybe you are compiling with `nim c foo.nim` command while the header file you are trying to include is C++ file? |
03:29:45 | FromDiscord | <demotomohiro> If you are using c++ library, you have to build like `nim cpp foo.nim`. |
03:33:27 | FromDiscord | <retkid> is sending packets from local servers done all in ram? |
03:34:21 | FromDiscord | <ajusa> Given a type, is it possible for me to get comment as a string next to the type field definition? I believe Nim docs do this so I think it should be possible. |
03:35:15 | FromDiscord | <Elegantbeef> doc comments are stored in the typedefinition s oyes with a macro |
03:36:26 | FromDiscord | <ajusa> sent a code paste, see https://paste.rs/eYN |
03:38:12 | FromDiscord | <Elegantbeef> Ah turns out nope comments are not accessible from the typed AST |
03:38:54 | FromDiscord | <ajusa> Got any smart alternatives for what I'm going for here 😄 |
03:38:58 | FromDiscord | <ajusa> (edit) "😄" => "😄?" |
03:40:13 | FromDiscord | <cabboose> macroooooo |
03:42:35 | FromDiscord | <cabboose> maybe a custom type defining macro would be possible? |
03:46:01 | FromDiscord | <cabboose> https://github.com/filcuc/nimqml/blob/master/src/nimqml/private/nimqmlmacros.nim deals with type definitions inside a macro |
03:46:16 | FromDiscord | <demotomohiro> Maybe use double hash comment and get it as nnkCommentStmt↵https://nim-lang.org/docs/macros.html#callsslashexpressions-documentation-comments |
03:46:50 | FromDiscord | <cabboose> just need to pick out the comments as demotomohiro mentions |
03:47:28 | FromDiscord | <cabboose> which is what ElegantBeef said originally which is what he meant by doc comments |
03:47:42 | FromDiscord | <cabboose> doc comments have two hashes unlike your example |
03:48:30 | FromDiscord | <ajusa> Got it, I'll check those out. Thanks! |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:30 | * | supakeen joined #nim |
04:09:13 | FromDiscord | <cabboose> anyone know where nim rawGet is defined? |
04:10:56 | FromDiscord | <cabboose> nvrm got it |
04:12:29 | FromDiscord | <linux user> nim is on tiobe list |
04:12:31 | FromDiscord | <linux user> !!!!! |
04:14:51 | FromDiscord | <hamidb80> hey |
04:15:06 | FromDiscord | <hamidb80> how can i escape `{}` in strformat ? |
04:15:21 | FromDiscord | <hamidb80> `fmt"\{}" ` doesn't work |
04:15:57 | FromDiscord | <hamidb80> ah i think it's a string literal |
04:16:00 | FromDiscord | <cabboose> yep |
04:16:11 | FromDiscord | <Varriount> Just ran into the VM loop limit. Turns out compiling an NPeg grammar translated from PostgreSQL's Yacc grammar causes the compiler to run more than 10000000 loops |
04:16:15 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/881029386642542652/unknown.png |
04:16:16 | FromDiscord | <retkid> WOO |
04:16:16 | FromDiscord | <cabboose> fmt syntax uses a generalised raw string literal |
04:16:19 | FromDiscord | <retkid> WE BEAT TYPESCRIPT |
04:16:31 | FromDiscord | <retkid> and bash... somehow? |
04:16:33 | FromDiscord | <retkid> wat |
04:16:42 | FromDiscord | <Varriount> URL pls |
04:16:53 | FromDiscord | <hamidb80> In reply to @retkid "": what's that? |
04:17:03 | FromDiscord | <retkid> https://www.tiobe.com/tiobe-index/ |
04:17:45 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/881029763706286110/unknown.png |
04:17:48 | FromDiscord | <retkid> so i guess fortran is cool again |
04:17:53 | FromDiscord | <retkid> assembly is booming for some reason\ |
04:18:01 | FromDiscord | <retkid> php is still being used why |
04:18:14 | FromDiscord | <Varriount> Well, the fact that Nim is only one hundreth of a percent less than D is nice. |
04:18:15 | FromDiscord | <retkid> Visual Basic is now a language? |
04:18:28 | FromDiscord | <cabboose> In reply to @hamidb80 "how can i escape": Use `&` operator instead? |
04:18:28 | FromDiscord | <retkid> SQL doesn't count |
04:18:44 | FromDiscord | <retkid> i don't like this top 15 |
04:19:07 | FromDiscord | <Varriount> _throws the shuriken stars of PL/SQL at @retkid_ |
04:19:27 | FromDiscord | <retkid> yea SQL sucks |
04:19:40 | FromDiscord | <Varriount> Eh, it's good for what it does. |
04:19:42 | FromDiscord | <retkid> they are just that, stars you have to dodge |
04:20:20 | FromDiscord | <retkid> ok my question is, how the fuck is bash #50 |
04:20:36 | FromDiscord | <cabboose> how does it determine ranking |
04:20:38 | FromDiscord | <Varriount> Perhaps it's a ranking of change. |
04:20:55 | FromDiscord | <Varriount> I don't mind SQL, but I feel like the language is a tad fossilized. It could use with a re-think |
04:20:59 | FromDiscord | <cabboose> if it determines it by language use on github or something that would make sense wouldnt it? |
04:21:16 | FromDiscord | <retkid> sent a long message, see http://ix.io/3xbp |
04:21:33 | FromDiscord | <retkid> i suppose its because bash isn't a language you choodse |
04:21:35 | FromDiscord | <retkid> (edit) "choodse" => "choose" |
04:21:41 | FromDiscord | <retkid> its a language you've been born with |
04:21:55 | FromDiscord | <retkid> you don't wake up and go "imma program in bash |
04:22:01 | FromDiscord | <cabboose> gross |
04:22:07 | FromDiscord | <retkid> you go "I need to make a compile script, i gotta use bash" |
04:22:29 | FromDiscord | <retkid> so bash should realistically be in the top 30 |
04:22:37 | FromDiscord | <retkid> (edit) "30" => "30, but isn't due to sampeling bias" |
04:22:40 | FromDiscord | <retkid> (edit) "sampeling" => "sampling" |
04:22:46 | FromDiscord | <cabboose> courses... we definitely lose |
04:24:59 | FromDiscord | <retkid> yea nim isn't really a lang to learn by someone new to programming |
04:25:06 | FromDiscord | <cabboose> why not |
04:25:17 | FromDiscord | <retkid> small lang, not many tutorials |
04:25:19 | FromDiscord | <retkid> (edit) "tutorials" => "tutorials, etc" |
04:25:22 | FromDiscord | <cabboose> Oh yeah |
04:25:27 | FromDiscord | <retkid> little jimmy 13 year old shouldn't learn nim |
04:25:29 | FromDiscord | <cabboose> but theres no reason why it cant be |
04:25:36 | FromDiscord | <cabboose> f jimmy |
04:25:53 | FromDiscord | <retkid> Jimmy's fine, hes just gonna learn either java or python |
04:25:54 | FromDiscord | <retkid> lol |
04:25:59 | FromDiscord | <cabboose> vomit |
04:26:22 | FromDiscord | <retkid> or Lua, like me |
04:26:26 | FromDiscord | <cabboose> i think i've forgotten everything about python |
04:26:42 | FromDiscord | <cabboose> i started with python; got very far, and then forgot it the second I found nim |
04:27:04 | FromDiscord | <retkid> I learned Lua when i was like 12 playing minecraft |
04:27:15 | FromDiscord | <retkid> got angry because i guess i didn't understand functions or something weird |
04:27:19 | FromDiscord | <retkid> stopped |
04:27:28 | FromDiscord | <retkid> learned bash when i was 15 |
04:27:33 | FromDiscord | <retkid> (edit) "15" => "15, rest was history" |
04:27:38 | FromDiscord | <cabboose> was minecraft and lua related somehow |
04:27:41 | FromDiscord | <retkid> yes |
04:27:45 | FromDiscord | <cabboose> i thought minecraft was java |
04:27:58 | FromDiscord | <retkid> it is, but computer craft as a java implementat ion of lua-jit\ |
04:28:02 | FromDiscord | <retkid> (edit) "implementat" => "implementation" |
04:28:08 | FromDiscord | <retkid> (edit) "as" => "was" |
04:28:10 | FromDiscord | <retkid> (edit) "lua-jit\" => "lua-jit" |
04:28:18 | FromDiscord | <retkid> so you did lua inside java |
04:28:23 | FromDiscord | <cabboose> erk |
04:28:33 | FromDiscord | <retkid> smells like a memory hole, right |
04:28:55 | FromDiscord | <cabboose> i was going to say depression hole |
04:29:10 | FromDiscord | <retkid> it was... ok |
04:29:21 | FromDiscord | <retkid> people programmed like, game of life and shit |
04:29:23 | FromDiscord | <retkid> and guis |
04:29:47 | FromDiscord | <cabboose> … w… why |
04:30:04 | FromDiscord | <retkid> well, the reason is |
04:30:09 | FromDiscord | <retkid> factorio didn't exist yet |
04:30:10 | FromDiscord | <retkid> lol |
04:30:33 | FromDiscord | <cabboose> and now satisfactory |
04:31:07 | FromDiscord | <retkid> little me, liked making factories and things |
04:31:23 | FromDiscord | <retkid> liked seeings numbers go up and efficiency |
04:31:34 | FromDiscord | <retkid> controlling stuff with lua is really useful in this case |
04:31:39 | FromDiscord | <cabboose> What about study; do you hate study |
04:32:33 | FromDiscord | <retkid> study? |
04:32:40 | FromDiscord | <cabboose> in general |
04:32:49 | FromDiscord | <cabboose> outside of something stimulating like programming |
04:32:58 | FromDiscord | <cabboose> can you read a book without getting bored |
04:33:09 | FromDiscord | <retkid> I can listen to a book |
04:33:14 | FromDiscord | <cabboose> lol |
04:33:16 | FromDiscord | <retkid> i cannot read a book because visual problems |
04:33:21 | FromDiscord | <cabboose> ah |
04:33:25 | FromDiscord | <retkid> very difficult for me to retain information tha way |
04:33:27 | FromDiscord | <retkid> (edit) "tha" => "that" |
04:33:40 | FromDiscord | <cabboose> You smell like ADD |
04:33:49 | FromDiscord | <cabboose> i love that brain type |
04:33:57 | FromDiscord | <retkid> nah |
04:34:00 | FromDiscord | <retkid> thats just Aspergers |
04:34:07 | FromDiscord | <retkid> a tad of add but not enough to get diagnosed |
04:34:15 | FromDiscord | <retkid> (edit) "add" => "adhd" |
04:34:16 | FromDiscord | <cabboose> aspergers is similar |
04:34:33 | FromDiscord | <cabboose> most get diagnosed or treated with ADD meds too |
04:34:46 | FromDiscord | <retkid> I guarantee you 35% of people here at least have ASD as well |
04:34:47 | FromDiscord | <retkid> at least |
04:35:03 | FromDiscord | <cabboose> i wouldnt go that far; id go as far as ADD |
04:35:20 | FromDiscord | <cabboose> Well I guess its an abstract definition |
04:35:23 | FromDiscord | <cabboose> even in Psychiatry |
04:35:48 | FromDiscord | <cabboose> You have social deficits? ok aspergers; no? mehbeh add |
04:36:05 | FromDiscord | <cabboose> infact if it wasnt for the stigmatisation of ASD probably yes |
04:36:14 | FromDiscord | <retkid> not anymore |
04:36:21 | FromDiscord | <retkid> i've gotten over almost all of my social flaws |
04:36:58 | FromDiscord | <cabboose> So you dont have diagnosable ASD anymore 🙂 |
04:37:16 | FromDiscord | <retkid> well, its a perverse psychological disorder |
04:37:26 | FromDiscord | <cabboose> well yeah; that and its diagnosed on childhood function |
04:37:32 | FromDiscord | <retkid> so you never loose it truely, your brain is just different |
04:37:43 | FromDiscord | <retkid> but, i did get tested for disability for ASD |
04:37:50 | FromDiscord | <retkid> and they said i no longer qualify |
04:38:35 | FromDiscord | <cabboose> I would just be interested to know whether the brain chemistry of ADD and ASD are all that different once the social centres have been compensated |
04:38:56 | FromDiscord | <cabboose> because dopamine deficiency is a common denominator there |
04:39:37 | FromDiscord | <retkid> a child behavioral psychologist told me that because i had poor vision growing up, i didn't learn facial features and cant identify faces as well |
04:39:43 | FromDiscord | <retkid> part of autism |
04:39:48 | FromDiscord | <retkid> so, food for thought |
04:42:28 | FromDiscord | <cabboose> Interesting; they’re such heterogenous disorders with wildly different connotations |
04:42:40 | FromDiscord | <cabboose> I don’t like that |
04:43:57 | NimEventer | New thread by Exelotl: Goodboy Galaxy - Kickstarter and demo now live!, see https://forum.nim-lang.org/t/8375 |
05:06:17 | FromDiscord | <cabboose> Okay I'm having an issue with hashsets, I've defined my own `==` func but its not using it?! |
05:07:26 | FromDiscord | <cabboose> ok i figured it out |
05:07:34 | FromDiscord | <Elegantbeef> did you define as a hash procedure? |
05:07:49 | FromDiscord | <cabboose> yeah; the issue was order of importation |
05:08:07 | FromDiscord | <cabboose> or having the function defined before importing sets or hashes |
05:08:31 | FromDiscord | <cabboose> something along those lines, I've got it working by changing my import and proc definition order |
05:09:00 | FromDiscord | <cabboose> I guess I have to have the `==` defined before I import sets? |
05:09:34 | FromDiscord | <cabboose> I guess it makes sense in hindsight -.- |
05:10:00 | FromDiscord | <cabboose> https://tenor.com/view/patrickpain-patricksomuchpain-patrickfleas-spongebobpain-spongebobsomuchpain-gif-18151897 |
05:10:42 | FromDiscord | <cabboose> no I'm wrong |
05:11:08 | FromDiscord | <cabboose> it's because I have to have it defined before I create my type that is derived from HashSet |
05:11:36 | FromDiscord | <cabboose> WRONG AGAIN. |
05:11:45 | FromDiscord | <cabboose> Ok final time; it's because I have to have it defined before the hash |
05:11:54 | FromDiscord | <cabboose> yep |
05:12:00 | FromDiscord | <cabboose> that was why |
05:12:50 | FromDiscord | <cabboose> `func hash(); func ==()` would fail but `func ==(); func hash()` works as intended |
05:12:53 | FromDiscord | <cabboose> god damnit |
05:13:00 | FromDiscord | <cabboose> so much time wasted |
05:14:11 | FromDiscord | <gogolxdong (liuxiaodong)> @\_discord\_364103562243866624\:t2bot.io but it compiles on windows while errors on linux. |
05:17:07 | FromDiscord | <cabboose> yeah it's failing again |
05:17:13 | FromDiscord | <cabboose> what the gypsy magic is going on |
05:17:42 | FromDiscord | <Elegantbeef> What's the code |
05:19:09 | FromDiscord | <cabboose> let me see if I can replicate it in one file rather than in my use case and ill upload on playground |
05:26:53 | FromDiscord | <cabboose> https://play.nim-lang.org/#ix=3xbD is an example of code that should work but isnt (afaik by my understanding) |
05:27:37 | FromDiscord | <cabboose> now I'm going to try figure out how I made it work in my use case; that only works with a very specific organisation structure |
05:27:43 | FromDiscord | <Elegantbeef> Why would this work you dont hash your ComplexObject |
05:28:17 | FromDiscord | <cabboose> because they inherit no? |
05:28:48 | FromDiscord | <cabboose> wait if they're methods it works |
05:29:20 | FromDiscord | <cabboose> wait i'm so lost |
05:29:30 | FromDiscord | <Elegantbeef> Procedures do not autoconvert for inherited types |
05:29:50 | FromDiscord | <Elegantbeef> Atleast afaik |
05:29:55 | FromDiscord | <cabboose> ok; would defining the `==` operator as a base method not be acceptable? |
05:30:21 | FromDiscord | <cabboose> like i would have expected this to work https://play.nim-lang.org/#ix=3xbE |
05:31:13 | FromDiscord | <Elegantbeef> Ok actually it does call the procedure |
05:31:55 | FromDiscord | <Elegantbeef> I think this is an issue i've seen before with hashsets + ref types |
05:34:09 | FromDiscord | <cabboose> sent a long message, see https://paste.rs/Dus |
05:34:14 | FromDiscord | <cabboose> sent a long message, see http://ix.io/3xbI |
05:34:27 | FromDiscord | <cabboose> (edit) "http://ix.io/3xbI" => "http://ix.io/3xbJ" |
05:34:58 | FromDiscord | <Varriount> @exelotl Congrats on the game! |
05:35:20 | FromDiscord | <hamidb80> that was hard |
05:35:25 | FromDiscord | <hamidb80> i lost in the map |
05:35:27 | FromDiscord | <hamidb80> 😄 |
05:37:07 | FromDiscord | <hamidb80> (edit) "i lost in the map ... " added "😄" |
05:43:20 | FromDiscord | <cabboose> In reply to @Elegantbeef "I think this is": ok so I have narrowed it down to the fact that the rawGet hashset implementation will use the inherited hash proc but it doesn't use the inherited cmp proc |
05:44:54 | FromDiscord | <cabboose> but it still doesn't really explain to me why my use case code errors/doesn't error with weird changes in organisation |
05:46:49 | FromDiscord | <gogolxdong (liuxiaodong)> How to set value for Option field? |
05:50:03 | FromDiscord | <retkid> almost done with my generator kotlin interface generator |
05:57:24 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/881054841915465758/unknown.png |
05:57:49 | FromDiscord | <retkid> the only limitation is i need to update it with java equivalents for return types |
05:58:37 | FromDiscord | <retkid> i dont think i can import a nim table to a java hashmpa |
05:58:39 | FromDiscord | <retkid> (edit) "hashmpa" => "hashmap" |
05:58:53 | FromDiscord | <retkid> even if they represent the same thing |
06:02:27 | FromDiscord | <Paulo> https://play.nim-lang.org/#ix=3xbN↵↵can someone help me with that? I'm trying to pass a Socket as parameter to a function in another thread, but i get a `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` error. I read the manual about threads I think i understand why that happen, i just have no idea how to properly do something like that |
06:04:16 | FromDiscord | <retkid> ? |
06:04:19 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3xbS |
06:04:50 | FromDiscord | <Paulo> sent a code paste, see https://paste.rs/Fxk |
06:04:53 | FromDiscord | <retkid> is that the line the error comes from? |
06:04:54 | FromDiscord | <Paulo> (edit) "https://play.nim-lang.org/#ix=3xbU" => "https://play.nim-lang.org/#ix=3xbT" |
06:05:08 | FromDiscord | <Paulo> its a runtime error, no lines informed |
06:05:14 | FromDiscord | <Paulo> the code compiles just fine |
06:05:36 | FromDiscord | <retkid> run a loop that echos out the socket and see what happens |
06:06:33 | FromDiscord | <retkid> if its always null then you're either defining it wrong or not suppose to pass it to functions |
06:06:39 | FromDiscord | <retkid> if its sometimes null then something weird is happening |
06:07:56 | FromDiscord | <Paulo> sent a code paste, see https://paste.rs/kQ9 |
06:08:10 | FromDiscord | <Paulo> sent a code paste, see https://play.nim-lang.org/#ix=3xbW |
06:15:02 | FromDiscord | <retkid> you aren't passing any vars to handleConnection? |
06:16:44 | FromDiscord | <Rika> its right there |
06:16:45 | FromDiscord | <Rika> client |
06:17:29 | FromDiscord | <Rika> i dont recall if sockets are safe to pass to another thread though... but it might be so |
06:18:25 | FromDiscord | <Paulo> In reply to @Rika "client": yeas |
06:18:26 | FromDiscord | <Paulo> (edit) "yeas" => "yes" |
06:18:59 | FromDiscord | <Paulo> In reply to @Rika "i dont recall if": i think they are not, at least not in the way in doing it lol |
06:19:41 | FromDiscord | <Paulo> but i have no idea how the "right way to it" is |
06:22:07 | FromDiscord | <Rika> what i would do is to have threads only work on data, and only one thread handles connections |
06:22:22 | FromDiscord | <Rika> dispatch the data to the other threads via channels |
06:28:28 | FromDiscord | <Paulo> In reply to @Rika "dispatch the data to": thank you |
07:08:37 | FromDiscord | <retkid> ok guys |
07:08:38 | FromDiscord | <retkid> pick one |
07:09:08 | FromDiscord | <retkid> i make a thread which launches a nim server, and ffi inter ops via socks |
07:09:13 | FromDiscord | <retkid> (edit) "inter ops" => "interops" |
07:09:36 | FromDiscord | <retkid> (edit) "socks" => "socks, and pingpong that way" |
07:09:54 | FromDiscord | <retkid> or i pingpong using functions and return codes |
07:10:02 | FromDiscord | <retkid> (edit) "functions and return codes" => "functions, calling them" |
07:10:20 | FromDiscord | <retkid> or i do a combination of both, have a separate thread where nim functions are called |
07:10:54 | FromDiscord | <retkid> im leaning to the socks but i feel like that creates needless overhead |
07:11:01 | FromDiscord | <retkid> (edit) "im leaning to the socks but i feel like that creates needless overhead ... " added "and faliure poiints" |
07:11:51 | * | jjido joined #nim |
07:27:14 | * | max22- joined #nim |
07:36:18 | madprops | how can I make this (the if else) more visually pleasing? https://play.nim-lang.org/#ix=d/ni |
07:38:46 | FromDiscord | <impbox [ftsf]> broken link |
07:38:49 | madprops | i mean this https://dpaste.org/Wn82 |
07:39:45 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3xcb |
07:39:57 | FromDiscord | <impbox [ftsf]> you could also use a case instead probably |
07:40:20 | madprops | can't singleline everytime though |
07:40:42 | madprops | it was a generic example |
07:40:54 | FromDiscord | <Rika> is that not visually pleasing to you? what do you think is visually pleasing |
07:41:06 | madprops | if and elif and else on the same margin |
07:41:11 | FromDiscord | <impbox [ftsf]> visually pleasing is subjective and context specific |
07:41:41 | FromDiscord | <Rika> after the `=` make a block |
07:41:48 | FromDiscord | <Rika> then put the if on the next line |
07:41:55 | FromDiscord | <Rika> then indent as expectetd |
07:41:59 | madprops | ah that might work |
07:46:24 | FromDiscord | <Rika> not might, im sure it will |
07:46:31 | FromDiscord | <Rika> unless you dont like the look |
07:47:55 | madprops | i like it |
07:48:02 | madprops | im now wondering about this https://dpaste.org/FFFr |
07:48:08 | madprops | that inside an elif |
07:48:20 | madprops | that's my way of dealing with multiple ifs |
07:48:25 | madprops | to return something in all cases |
07:49:17 | FromDiscord | <Rika> if you think its better you can have a mutable var |
07:49:26 | FromDiscord | <Rika> just return the contents of such at the end |
07:49:38 | madprops | that's what i had |
07:49:55 | madprops | oh you mean inside the elif |
07:49:59 | FromDiscord | <Rika> whichever you like more |
07:50:51 | madprops | https://dpaste.org/8coa |
07:50:55 | madprops | so something like that |
07:51:14 | madprops | yeah i think makes more sense |
07:52:04 | FromDiscord | <gogolxdong (liuxiaodong)> Anyone knows `{"code":-32602,"message":"invalid argument 0: json: cannot unmarshal non-string into Go struct field SendTxArgs.gasPrice of type hexutil.Big"}` |
07:52:19 | FromDiscord | <gogolxdong (liuxiaodong)> with nim-web3 |
07:55:54 | FromDiscord | <Yardanico> @madprops about the if - you can just do this - https://play.nim-lang.org/#ix=3xcd |
07:56:12 | madprops | weird I did try that Yardanico |
07:56:21 | madprops | but i think i had an empty line in between |
07:56:41 | madprops | ohh |
07:56:43 | madprops | i didn't indent it |
07:57:25 | madprops | so it's almost the same as using block |
07:57:28 | madprops | except it's not a block |
07:58:32 | FromDiscord | <Yardanico> It's just an if expression :) |
08:18:35 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:20:53 | NimEventer | New thread by Rforcen: Disk based btree, see https://forum.nim-lang.org/t/8376 |
08:39:39 | * | neurocyte quit (Quit: The Lounge - https://thelounge.chat) |
08:43:27 | * | Vladar joined #nim |
08:44:28 | * | neurocyte joined #nim |
08:44:28 | * | neurocyte quit (Changing host) |
08:44:28 | * | neurocyte joined #nim |
08:56:12 | FromDiscord | <cabboose> I forgot about this gem from June blog post |
08:56:41 | FromDiscord | <cabboose> https://media.discordapp.net/attachments/371759389889003532/881099959552868402/image0.png |
08:59:34 | FromDiscord | <Recruit_main707> lol |
09:14:26 | FromDiscord | <Rika> I don’t think it was intentional |
09:16:04 | FromDiscord | <cabboose> I mean if it wasn’t that’s hilarious |
09:16:11 | FromDiscord | <cabboose> If it was it’s legendary and hilarious |
09:31:49 | FromDiscord | <Saurav Niroula> is there else statement in for loop as python |
09:32:32 | FromDiscord | <Saurav Niroula> i am a begineer and i am learning from youtube python videos to calculate nth prime number |
09:32:59 | FromDiscord | <Saurav Niroula> i am not knowing how to do it 😔 |
09:35:06 | madprops | "Dik is a Dict." oh |
09:37:13 | FromDiscord | <j-james> Are there any downsides to declaring a large amount of types within the same type block? |
09:45:06 | FromDiscord | <j-james> Performance or otherwise |
09:48:00 | * | emery quit (Ping timeout: 272 seconds) |
09:50:36 | FromDiscord | <Rika> In reply to @Saurav Niroula "is there else statement": No |
09:51:05 | NimEventer | New thread by Kalbhairab: Code competition., see https://forum.nim-lang.org/t/8377 |
09:51:15 | FromDiscord | <Rika> In reply to @j-james "Are there any downsides": I do not think there is a naked-eye observable difference in performance |
09:51:48 | FromDiscord | <haxscramper> > ↵> Nim should organize code competition as other programming languages do.↵>↵(<@709044657232936960_=4eim=45venter=5b=49=52=43=5d>) |
09:51:51 | FromDiscord | <haxscramper> Just what is the point |
09:55:08 | FromDiscord | <haxscramper> In reply to @arkanoid "<@608382355454951435>, I'm trying to": This part of code is old, and `wrapWithConfig` is no longer used. For latest wrapper generator script, you can see https://github.com/haxscramper/cxxstd/blob/master/src/cxxstd/make_wrap.nim |
09:56:19 | FromDiscord | <haxscramper> In reply to @arkanoid "<@608382355454951435>, I've read what": > says to be even more compliant than Intel compiler proprocessor↵Honestly this seems like PR bs for the most part, since C++ preprocessor standard is defined using very ambiguous language, this has been pointed out multiple times in different tests I've read |
09:56:22 | FromDiscord | <Rika> In reply to @haxscramper "Just what is the": Fun? |
09:56:24 | FromDiscord | <Rika> Why not |
09:56:31 | arkanoid | Thanks! |
09:56:53 | * | emery joined #nim |
10:03:02 | FromDiscord | <haxscramper> I should probably write architecture.md for it |
10:08:53 | arkanoid | I have C function that initializes a large struct in the heap and returns its pointer, I've already wrapped that and it works. Now I need to edit just 2 cstring attributes of this struct, but I'm lazy and I don't want to define the whole type of for that. One option would be to emit a C function that does the job and wrap it, is there a better solution? |
10:13:07 | FromDiscord | <haxscramper> you can only wrap two attributes |
10:13:16 | FromDiscord | <haxscramper> you don't have to wrap all fields |
10:15:50 | arkanoid | Really? Do you have an example? How does this work? |
10:19:26 | FromDiscord | <haxscramper> What kind of example do you need? Just don't wrap all fields, that's all |
10:22:25 | arkanoid | Well this is surprising. Thanks |
10:23:00 | arkanoid | I've another unrelated question. What is the "header" pragma do? |
10:24:03 | FromDiscord | <haxscramper> It specifies header file to be included when proc or type is used |
10:24:26 | FromDiscord | <haxscramper> So if nim generates C code and uses your proc, which has `header: <string>`, it will add `#include <string>` to the generated header |
10:24:29 | FromDiscord | <haxscramper> generated C file\ |
10:24:40 | FromDiscord | <haxscramper> `header:` can be any text |
10:25:02 | FromDiscord | <haxscramper> If it is `<header>` or `"header"` it will be wrapped as `#include <XXX>`, anything else will be pased verbatim |
10:25:19 | FromDiscord | <haxscramper> So you can do `header: "#include <header1>\n#include <header2>` if you need |
10:26:04 | arkanoid | Ok! So it may be seen as a convenient way to avoid emit on top of nim file? |
10:26:36 | FromDiscord | <haxscramper> Yes, it is actually a recommended way of wrapping things |
10:26:57 | FromDiscord | <haxscramper> `{.emit:` will not work if you declare a proc and then use it in different module for example |
10:28:36 | arkanoid | Thanks! |
10:41:35 | * | auxym_ joined #nim |
10:47:31 | * | jjido joined #nim |
11:00:41 | arkanoid | how to wrap this C function type? "int(*)(struct soap *, struct soap_plugin *, void *)" |
11:01:19 | arkanoid | I've already wrapped the "struct soap *" and "struct soap_plugin *" types, but I don't know how to put all together into a function type |
11:02:57 | * | auxym_ quit (Ping timeout: 248 seconds) |
11:04:48 | arkanoid | what about " SoapPluginCreate {.header: soapH, importc: "int(*)(struct soap *, struct soap_plugin *, void *)".} = proc(soap: Soap, plugin: SoapPlugin, args: ptr object): int" |
11:05:43 | FromDiscord | <haxscramper> `int()(struct soap , struct soap_plugin , void )` is a `proc(sa: ptr soap, a2: ptr soap_plugin, a3: pointer) {.cdecl.}` |
11:06:29 | FromDiscord | <haxscramper> matrix edits are not propagaged to IRC? Anyway, I forgot to add `: cint` return type |
11:06:44 | arkanoid | thanks |
11:06:51 | FromDiscord | <haxscramper> `void` is a `pointer`, while `ptr object` is a nim generic |
11:07:03 | FromDiscord | <haxscramper> And you don't `importc` typedefs |
11:07:27 | arkanoid | ? |
11:07:35 | FromDiscord | <haxscramper> And don't `header` them as well, since they don't really exist in the C code as well, they are just like shortcuts for type |
11:07:54 | FromDiscord | <haxscramper> You have `typedef int()(struct soap , struct soap_plugin , void ) SoapPluginCreate `? |
11:08:30 | arkanoid | no, I have to wrap this function: https://www.genivia.com/doc/guide/html/group__group__plugin.html#gad645e5a58ed442fe4753dcc2338c8bdb |
11:09:07 | arkanoid | where the first argument is the ptr object I've been asking you before about reading single attribute, and it is working |
11:09:35 | arkanoid | the second argument is a proc declared in a .h file |
11:09:39 | FromDiscord | <exelotl> In reply to @Varriount "<@!90614688374624256> Congrats on the": Thank you! ^^ |
11:10:41 | FromDiscord | <haxscramper> `void soap_register_plugin(soap: ptr soap, fcreate: proc(sa: ptr soap, a2: ptr soap_plugin, a3: pointer): cint {.cdecl.})` |
11:12:23 | arkanoid | haxscramper, thanks. Do you think it is better to declare types as object and declare arguments as "ptr thatobject" or is better to just declare the type "ptr object" |
11:12:48 | arkanoid | I see you went the first path in your example |
11:17:09 | FromDiscord | <haxscramper> I prefer to defined simple `object` type and if it is often used as `ptr T` I just declare `type PT = ptr T` |
11:17:35 | FromDiscord | <haxscramper> `type WaveToken {.apiPtr.} = object` and `type PWaveToken = ptr WaveToken` |
11:19:15 | arkanoid | thanks! |
11:25:53 | * | auxym_ joined #nim |
11:32:43 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
11:33:07 | * | max22- quit (Ping timeout: 240 seconds) |
11:38:44 | FromDiscord | <dom96> In reply to @haxscramper "> > Nim": https://forum.nim-lang.org/t/8377#53999↵↵Sorry, couldn't help myself |
11:41:00 | arkanoid | not sure if I should add cdecl to all C wrapped function or not. It doesn't change anything if I put it or not |
11:41:07 | arkanoid | I mean, it compiles correctly |
11:42:45 | FromDiscord | <haxscramper> No, C procedures must be wrapped using `{.cdecl.}` |
11:42:59 | FromDiscord | <haxscramper> It might compile and maybe even run correctly |
11:43:28 | FromDiscord | <haxscramper> But regular nim `proc()` is implemented as closure with `struct { void impl; void env; };` roughly speaking |
11:43:51 | FromDiscord | <haxscramper> While `{.cdecl.}` proc is a pointer to proc, no additional data |
11:52:54 | arkanoid | ok, but what if I'm calling a C macro, do I need it? |
11:53:09 | FromDiscord | <whisperdev> What kind of error is this 😐 asyncdocker.nim(261, 23) Error: cannot open file: asynchttpclient |
11:53:32 | arkanoid | I'm doing "proc newSoap(): PSoap {.header: soapH, importc: "soap_new".}" but soap_new is a macro that calls a macro that calls a macro and so on |
11:53:39 | arkanoid | the real function name is weird |
11:54:03 | arkanoid | it is working now, without cdecl |
11:55:03 | FromDiscord | <Rika> In reply to @whisperdev "What kind of error": Async versions are already in the httpclient module |
11:55:21 | * | jjido joined #nim |
11:56:42 | FromDiscord | <whisperdev> crap... |
12:00:14 | FromDiscord | <haxscramper> arkanoid\: I was talking about callbacks etc. |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:32 | * | supakeen joined #nim |
12:06:51 | arkanoid | haxscramper, so cdecl is only required when C code needs to call nim proc, and not the other way around? |
12:08:01 | FromDiscord | <whisperdev> Can this easily be fixed? I dont really understand the expected type |
12:08:03 | FromDiscord | <whisperdev> Error: type mismatch: got <proc (chunk: string): Future[system.bool]{.closure, locks: <unknown>.}> but expected 'Callback = proc (fd: AsyncFD): bool{.closure, gcsafe.}' |
12:08:10 | arkanoid | sorry for the noob questions, but I'm not an experienced C programmer and I'm still learning the underlying basics |
12:09:05 | * | auxym_ quit (Ping timeout: 248 seconds) |
12:09:41 | FromDiscord | <haxscramper> `int()(...)` etc. |
12:09:59 | FromDiscord | <Rika> In reply to @whisperdev "Error: type mismatch: got": the callback you're registering has the wrong parameter and return types |
12:23:54 | * | max22- joined #nim |
12:30:17 | arkanoid | I need an hand to understand why I'm getting gibberish out of "soap->authrealm" while trying to reproduce this simple example in nim: https://www.genivia.com/doc/guide/html/index.html#httpdaplugin |
12:34:41 | arkanoid | this is the current nim code: https://play.nim-lang.org/#ix=3xdf |
12:44:11 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
12:47:37 | * | arkurious joined #nim |
13:02:56 | FromDiscord | <haxscramper> sent a long message, see https://paste.rs/X6A |
13:14:46 | arkanoid | this is great news! congrats! |
13:15:08 | arkanoid | I'm just puzzled why a combination of different parsers is required |
13:15:18 | arkanoid | aren't them overlapping? |
13:15:40 | FromDiscord | <haxscramper> I'm writing an updated readme, but |
13:15:46 | FromDiscord | <haxscramper> sent a long message, see http://ix.io/3xdp |
13:15:53 | FromDiscord | <haxscramper> Basically I'm doing two things |
13:15:59 | FromDiscord | <haxscramper> So I need two parsers |
13:16:42 | FromDiscord | <haxscramper> Or you mean why wave and tree-sitter? |
13:17:11 | arkanoid | yeah, why two |
13:17:28 | arkanoid | I mean, isn't wave building an AST of the C/C++ code too? |
13:17:42 | arkanoid | just curious, consider an ELI5 answer |
13:19:33 | * | jjido joined #nim |
13:21:00 | FromDiscord | <haxscramper> No, wave does not build AST of the C++ code, instead it provides an iterator over preprocessed tokens |
13:21:33 | arkanoid | quick question. I'm wrapping a C struct that has attributes that begins with capital letter. How can I wrap it to make nep1 happy? |
13:21:42 | FromDiscord | <haxscramper> C parsing also consists of two parts - preprocessing and actual parsing, so to get the best result without relying on libclang I need to match these two as close as possible |
13:22:14 | FromDiscord | <haxscramper> `> wrapping a C struct that has attributes that begins with capital letter` you can use `fieldName: {.importc: "ActualFieldName".}` |
13:22:39 | arkanoid | haxscramper, got it. So boost wave is like a preprocessor and you feed the result into tree-sitter |
13:22:47 | FromDiscord | <haxscramper> correct |
13:23:10 | FromDiscord | <haxscramper> Other alternative is to use libtooling's preprocessor callbacls, but this would require interfacing with C++ library |
13:23:16 | arkanoid | and libclang would do that all by itself but it's overlycomplicated |
13:23:45 | FromDiscord | <haxscramper> Yes, for average use case it requires too complicated setup |
13:25:10 | arkanoid | hooray! got my little wrapping experiment work! |
13:25:45 | arkanoid | so I got that adding header and importc pragmas on types is required to access their attributes |
13:26:59 | arkanoid | there are still thing not quite clear to me: when to use .pure., when to use .cdecl., what is .link., when .header. is really necessary |
13:28:08 | arkanoid | but it works! If you have any good hint on this wrapping code, I'd be happy to learn and improve https://play.nim-lang.org/#ix=3xdu |
13:36:08 | FromDiscord | <haxscramper> sent a long message, see http://ix.io/3xdw |
13:38:03 | FromDiscord | <haxscramper> I just put header all over the place, but arnetheduck for example says that in status they tend to avoid it, because you can just write a proc signature that matches base one, and it will be enoughg |
13:38:58 | FromDiscord | <haxscramper> But really there is almost always an exception to the rules like this, because well C |
13:39:05 | FromDiscord | <haxscramper> And so on |
13:39:45 | FromDiscord | <haxscramper> For example you didn't as about `bycopy`, and IIRC it is almost required for interop, otherwise nim's smart argument passing might get in the way |
13:47:17 | arkanoid | thanks! As you can see from my nim code I'm using .passL. to statically link everything. It works, but if understood what you are saying it would be more convenient to add it as a link pragma to everything |
13:47:20 | arkanoid | am I wrong? |
13:50:49 | FromDiscord | <haxscramper> yes, `.link.` is preferred to `.passl.` |
13:51:00 | FromDiscord | <haxscramper> Both work for linking, but `.link.` is specifically designed for that task |
14:04:05 | * | byanka__ joined #nim |
14:07:22 | * | byanka_ quit (Ping timeout: 250 seconds) |
14:08:19 | arkanoid | so, a "good" binding consists of pragmas: header, importc, link/dynlib. For types (if needed) pure, bycopy. For proc (if needed) cdecl. Avoiding PassL and emit is a good thing |
14:08:35 | arkanoid | I'm just trying to understand the general pattern |
14:15:13 | * | Guest24 joined #nim |
14:19:31 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
14:26:52 | FromDiscord | <haxscramper> Yes, that basically main pattern |
14:27:28 | FromDiscord | <haxscramper> nim-lang org on GitHub has some wrappers, you can look I to them as well, just to get an idea of what is being used |
14:30:57 | arkanoid | do you mean the source code of the website? |
14:32:10 | * | Guest24 quit (Quit: Client closed) |
14:35:14 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
14:36:18 | * | krux02 joined #nim |
14:38:21 | FromDiscord | <haxscramper> I mean GitHub organization |
14:39:09 | FromDiscord | <haxscramper> https://github.com/nim-lang/opengl https://github.com/nim-lang/x11 etc |
14:39:49 | FromDiscord | <Saurav Niroula> i found isPrime function and i am able to calculate prime number below certain number. But i cant figure out how to calculate nth prime number. I am new to programming and bit confused. i found python style code but it doesnt work for nim. can any one provide suggestion plz.😊 |
14:40:00 | FromDiscord | <haxscramper> tlc wrapper, lua wrapper |
14:46:36 | * | jjido joined #nim |
14:57:23 | * | auxym_ joined #nim |
15:00:44 | arkanoid | k! |
15:37:13 | * | flynn quit (Read error: Connection reset by peer) |
15:37:51 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
15:38:25 | * | flynn joined #nim |
15:45:41 | FromDiscord | <ericdp> In reply to @Saurav Niroula "i found isPrime function": have you figured out how the example code works ? If so, what is it doing you can't translate to nim ? |
16:01:40 | * | auxym_ quit (Ping timeout: 240 seconds) |
16:22:21 | * | jjido joined #nim |
16:23:47 | * | flynn quit (Read error: Connection reset by peer) |
16:24:55 | * | flynn joined #nim |
16:39:51 | NimEventer | New post on r/nim by thelolrus: [Livestream] Coding a template language in Nim | Jambone episode 3, see https://reddit.com/r/nim/comments/pdd50a/livestream_coding_a_template_language_in_nim/ |
16:52:56 | * | auxym_ joined #nim |
17:18:33 | FromDiscord | <reilly> Would it be a bad idea to make something both multithreaded and asynchronous at the same time? |
17:25:02 | FromDiscord | <fae> Like with everything, depends on what you’re trying to do lol. If you’re doing heavy IO you probably want async. If you are also doing heavy computations that can be run in another thread and the complexity of doing so actually gets you performance benefits, then sure why not. |
17:29:53 | * | beshr joined #nim |
18:19:53 | * | andinus quit (Remote host closed the connection) |
18:20:33 | * | andinus joined #nim |
18:21:25 | * | auxym_ quit (Ping timeout: 250 seconds) |
18:25:17 | FromDiscord | <treeform> In reply to @reilly "Would it be a": Sound like double the pain for a little gain... |
18:25:39 | FromDiscord | <Yardanico> xd |
18:27:19 | * | lain quit (Quit: kthxbai) |
18:28:03 | * | lain joined #nim |
18:44:32 | FromDiscord | <Yardanico> https://twitter.com/reduzio/status/1431257697622573056 |
19:13:42 | * | Vladar quit (Quit: Leaving) |
19:33:01 | FromDiscord | <5271> sent a code paste, see https://play.nim-lang.org/#ix=3xfm |
19:33:19 | * | stkrdknmibalz joined #nim |
19:37:21 | FromDiscord | <trenta3> sent a code paste, see https://play.nim-lang.org/#ix=3xfo |
19:39:26 | FromDiscord | <Yardanico> In reply to @5271 "how do i format": check out the strformat module |
19:40:36 | FromDiscord | <5271> okay |
19:44:31 | NimEventer | New thread by Niminem: Advice for handling circular dependencies (functions), see https://forum.nim-lang.org/t/8378 |
19:49:57 | * | beshr quit (Remote host closed the connection) |
19:53:01 | FromDiscord | <Yardanico> Does anyone know if there are any string command parsers? Something like cligen but just for strings. just want to make a telegram bot and don't want to do it myself if someone has something that's already available :) |
19:53:25 | FromDiscord | <Yardanico> or maybe I can do that with cligen itself? |
20:01:08 | * | perro quit (Remote host closed the connection) |
20:03:13 | FromDiscord | <Ruggila> You can parse strings with npeg, for example. I'm just not sure what you really want, and so I don't know what I should suggest... |
20:03:35 | FromDiscord | <Ruggila> https://github.com/zevv/npeg |
20:03:37 | nrds | <R2D299> itHub: 7"PEGs for Nim, another take" |
20:07:15 | FromDiscord | <Yardanico> well, I know npeg and used it quite a lot in some other projects, but it'll still be pretty similar to doing all the parsing myself |
20:07:24 | FromDiscord | <Yardanico> I found something similar to what I need - https://github.com/iffy/nim-argparse |
20:07:25 | nrds | <R2D299> itHub: 7"Argument parsing for Nim" |
20:07:26 | FromDiscord | <Yardanico> gonna try it now |
20:14:47 | FromDiscord | <Yardanico> yeah, seems like it's exactly what I need |
20:14:56 | FromDiscord | <Yardanico> I just want CLI-like commands for my Telegram bot and argparse fits exactly |
20:26:53 | FromDiscord | <Ayy Lmao> Are asserts mainly meant for unit tests or are they meant to be used in normal code as well? |
20:35:28 | FromDiscord | <konsumlamm> they're also meant to be used in normal code |
20:35:56 | FromDiscord | <konsumlamm> for checking if invariants you have really hold etc. |
20:36:30 | FromDiscord | <Yardanico> just don't forget that `assert` is disabled with release/danger |
20:36:39 | FromDiscord | <Yardanico> there's doAssert that's always enabled though |
20:37:32 | FromDiscord | <Ayy Lmao> Sweet, thanks for the info! |
20:41:41 | * | supakeen quit (Remote host closed the connection) |
20:42:05 | * | supakeen joined #nim |
20:45:46 | FromDiscord | <timotheecour> > just don't forget that assert is disabled with release/danger↵not true, only danger |
20:50:44 | arkanoid | in c2nim, #mangle are applied before or after --nep1 ? |
21:06:01 | arkanoid | I need to solve this problem via c2nim (or other solution if you know one): I have C structs with names like https://play.nim-lang.org/#ix=3xfS, if I run c2nim with --nep2 both types are converted to same string |
21:06:17 | arkanoid | s/--nep2/--nep1/ |
21:26:56 | arkanoid | it would be really useful if mangle op in c2num could uppercase letter |
22:02:55 | FromDiscord | <dan> In reply to @haxscramper "Yes, that basically main": would you happen to know why the header needs to be added with the "header" keyword? i have done it without and my code correctly produces the function definition which should also link fine |
22:06:10 | * | max22- quit (Quit: Leaving) |
22:06:20 | arkanoid | is it possible to have a function with same name of struct type in C?! Mangle madness |
22:25:28 | FromDiscord | <treeform> In reply to @dan "would you happen to": you only need to import the header once, some one else might import it for you |
22:25:53 | FromDiscord | <dan> but why do i need to import it? 🤔 |
22:26:23 | FromDiscord | <dan> im wrapping all of the stuff by hand anyways and it outputs the correct definitions |
22:26:58 | FromDiscord | <dan> what is this feature actually intended for? |
22:28:56 | FromDiscord | <dan> maybe for header only libraries? |
23:00:54 | FromDiscord | <treeform> you right you might not need the header at all |
23:03:16 | arkanoid | why does c2nim writes importc pragmas wrong? It writes {.importc: "_c_type_foo".} but I have to manually correct to {.importc: "struct _c_type_foo".} to make it work. Why? |
23:17:28 | arkanoid | it's a regression bug https://github.com/nim-lang/c2nim/issues/131 |
23:19:18 | arkanoid | this issue should be reopened |
23:35:23 | * | flynn quit (Remote host closed the connection) |
23:36:29 | * | flynn joined #nim |