<< 27-08-2021 >>

00:15:49FromDiscord<timotheecour> look at treeRepr and it should become clear
00:17:12FromDiscord<timotheecour> (edit) "look at treeRepr and it should become clear" => "sent a code paste, see https://paste.rs/L0Q"
00:30:13*auxym_ joined #nim
00:31:09FromDiscord<rb3.nim> Thanks @timotheecour. I did take a look at the treeRepr, but couldn't see an indicator in the AST to check if a variable was declared with `let` or `var`. That macro you posted seems to work with types, not variables, unless Im missing something
00:32:40FromDiscord<timotheecour> yes, i see.
00:35:29FromDiscord<timotheecour> sent a code paste, see https://paste.rs/HVn
00:40:13*def- quit (Quit: -)
00:41:05*def- joined #nim
00:42:21FromDiscord<rb3.nim> Seems like what I need, but I can't seem to get it to work in a macro: https://play.nim-lang.org/#ix=3x4q. Doesn't seem like the overload resolution thing works inside the `test2` macro
00:42:34FromDiscord<rb3.nim> (edit) removed "seem to"
00:43:57FromDiscord<Rika> Does it have to be in a macro
00:45:07FromDiscord<rb3.nim> Ya, I intend to use it as a utility to write a bunch of macros
00:45:54FromDiscord<rb3.nim> This seems to work, but in my real code it's not working: https://play.nim-lang.org/#ix=3x4r. Gonna try to repo...
00:46:09FromDiscord<rb3.nim> (edit) "repo..." => "repro..."
00:48:49FromDiscord<gogolxdong (liuxiaodong)> Is there any uint128 library?
00:51:02FromDiscord<timotheecour> https://github.com/nim-lang/RFCs/issues/399
01:13:14*neurocyte8 joined #nim
01:13:14*neurocyte8 quit (Changing host)
01:13:14*neurocyte8 joined #nim
01:15:19*neurocyte quit (Ping timeout: 250 seconds)
01:15:19*neurocyte8 is now known as neurocyte
01:23:35FromDiscord<gogolxdong (liuxiaodong)> Nice, is there any way to get pow(2, 67)?
01:30:53FromDiscord<gogolxdong (liuxiaodong)> I mean the precise integer result rather than scientific notation which loses tailing digits.
01:32:26FromDiscord<gogolxdong (liuxiaodong)> handy like 2\\67 in python.
01:36:19mstthat would require bigints, a quick poke around suggests the 'stint' nimble package has an implementation
01:37:00mstthere's also one called just 'bigints'
01:38:44FromDiscord<Rika> well he asked before that about uint128
01:38:53FromDiscord<Rika> (gives more perf)
01:39:06FromDiscord<Rika> i assume you can import compiler for the int128 lib there?
02:25:16*auxym_ quit (Ping timeout: 252 seconds)
02:58:29FromDiscord<HAT> Hey folks! I'm playing around with Win32 in Nim, if a function returns a type that is not yet defined in winim could I get a rough point in the direction of going about implementing it?
02:59:08FromDiscord<HAT> (edit) "type" => "structure" | "it?" => "it?↵↵Specifically I'm interested in implementing a PROCESS32ENTRY"
02:59:32FromDiscord<HAT> (edit) "returns" => "takes" | "takesa structure ... that" added "to populate it"
03:00:28FromDiscord<HAT> (edit) "Hey folks! I'm playing around with Win32 in Nim, if" => "sent" | "function takes a structure to populate it that is not yet defined in winim could I get a rough point in the direction of going about implementing it?↵↵Specifically I'm interested in implementing a PROCESS32ENTRY" => "code paste, see https://play.nim-lang.org/#ix=3x4N"
03:03:04FromDiscord<HAT> The Process32First() function that I'm using doesn't exist either, I guess I'm going to have to learn the FFI? I'm finding it quite confusing, I guess I'll just keep researching.
03:07:59*rockcavera quit (Remote host closed the connection)
03:08:04*arkurious quit (Quit: Leaving)
03:12:59FromDiscord<ajusa> Anyone here used Nimx? I'm trying to center align the text in a Label but haven't been able to figure it out
03:26:05FromDiscord<ajusa> Well I got that working, but I can't get it to work within the Nimx DSL
03:36:06FromDiscord<Varriount> In reply to @HAT "The Process32First() function that": Pretty much. You redefine the structure in Nim, ensuring that the order of the fields are the same, and that each Nim field's type is the same size as its corresponding C field.
03:37:03FromDiscord<Varriount> Just keep in mind that a C integer is not the same size as a Nim integer
03:37:50FromDiscord<Varriount> Nim has `cint`, `cfloat`, etc. for that.
03:38:27FromDiscord<Rika> winim probably has the proper types for dword etc
03:41:00FromDiscord<HAT> @Varriount Thank you!
04:03:29FromDiscord<Varriount> In reply to @HAT "<@!169336940846514176> Thank you!": Don't be afraid to look at Winim, or the C bindings for various things in the standard library.
04:03:41*flynn quit (Read error: Connection reset by peer)
04:04:48*flynn joined #nim
04:06:01*supakeen quit (Quit: WeeChat 3.2)
04:06:30*supakeen joined #nim
04:06:31FromDiscord<HAT> I find the prospect of taking a peak under the hood a bit intimidating, but I'll give it a crack.
05:33:30NimEventerNew thread by Treeform: Is there no way to pass a specific overload to a macro?, see https://forum.nim-lang.org/t/8369
06:13:22*PMunch joined #nim
06:24:21madpropshow to I filter out empty chars from a seq? https://play.nim-lang.org/#ix=3x5h
06:25:46PMunchA char can't be empty
06:26:55madpropsoh wait it's filling it with ' '
06:26:59madprops(a space0
06:27:12PMunchYup
06:27:26PMunchThere are a couple ways you can do it, depending on what you need
06:27:52PMuncha myStr.splitWhitespace.join might do the trick
06:47:33FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3x5m
06:47:40FromDiscord<retkid> i needed a quick stresstest to see if my code was running native or in jvm
06:47:47FromDiscord<retkid> rate my prime number checker
06:48:08FromDiscord<retkid> i thought it was cleaver
06:48:10FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3x5n
06:51:48FromDiscord<impbox [ftsf]> `wholeNumber = floor(check)` ?
06:52:35FromDiscord<impbox [ftsf]> why doubly linked list?
06:52:37FromDiscord<Elegantbeef> Or just `int.float` if you're truncating \:D
06:53:03FromDiscord<impbox [ftsf]> foo.int.float i wonder if the two type conversions is faster than floor?
06:53:59FromDiscord<impbox [ftsf]> aww nim doesn't have `frac`
06:54:10FromDiscord<Elegantbeef> It does indirectly
06:54:22FromDiscord<Elegantbeef> https://nim-lang.org/docs/math.html#splitDecimal%2CT
06:54:59FromDiscord<impbox [ftsf]> yeah, but less useful if you only want the fractional part
07:00:07madpropsdo you think specifying let vs var, helps in the long run?
07:00:20FromDiscord<Rika> Yes
07:00:33FromDiscord<Rika> Well, define “helps” first actually
07:00:37FromDiscord<impbox [ftsf]> when it helps it helps, sometimes it helps
07:00:42madpropsavoids lots of accidents
07:00:45FromDiscord<Rika> Yes
07:00:47FromDiscord<impbox [ftsf]> by catching you doing things you don't want to do
07:00:57FromDiscord<Elegantbeef> It reduces the amount of mutable code reducing side effects
07:01:06FromDiscord<impbox [ftsf]> but sometimes you realise you actually wanted a var
07:01:09*max22- joined #nim
07:06:46madpropsyeah I often have to turn lets into vars
07:07:22madpropsbut I guess it's worth it
07:07:26madpropsplus it has the added information to it
07:08:12madpropslike you also know, like the compiler, if it changes or not
07:09:13FromDiscord<retkid> In reply to @impbox "why doubly linked list?": had problems with arrays, got that to work
07:09:20FromDiscord<retkid> i couldn't find the floor function
07:09:28FromDiscord<retkid> (edit) "i couldn't find the floor function ... " added "either, so i made up for that with brains"
07:09:31FromDiscord<retkid> but now i know
07:10:37FromDiscord<retkid> i was afraid of using let and not var because these vars get wiped every loop so what if the memory space cant be overwritten or worse, what if it makes a new entry for every int
07:10:53FromDiscord<retkid> so i kinda just thought "eh, i'll figure out var vs let later"
07:11:59FromDiscord<Rika> In reply to @retkid "i was afraid of": What?
07:12:25FromDiscord<Elegantbeef> var/let is purely a compile time thing
07:12:36FromDiscord<Rika> If you aren’t that well versed in how memory works then don’t worry about it until it actually happens
07:12:41FromDiscord<impbox [ftsf]> you should use a seq[int]
07:12:52FromDiscord<Rika> Don’t preemptively work around a problem that you think exists
07:12:52FromDiscord<impbox [ftsf]> var primenumbers: seq[int]
07:13:18FromDiscord<impbox [ftsf]> also returning a which is never touched?
07:13:37FromDiscord<impbox [ftsf]> how does someone get the output?
07:16:49FromDiscord<Rika> I also just noticed that you’re using three periods for the for loop?
07:17:02FromDiscord<impbox [ftsf]> makes it go faster
07:17:09FromDiscord<Rika> Lol
07:22:27*jjido joined #nim
07:58:36PMunchIs there any convention for renaming C functions starting with underscores/double underscores?
07:58:53FromDiscord<impbox [ftsf]> `function_name` ?
07:58:57PMunchJust removing them is the obvious choice, but then they might suddenly collide with something
07:59:05FromDiscord<impbox [ftsf]> (edit) "`function_name` ?" => "sent a code paste, see https://play.nim-lang.org/#ix="
07:59:18PMunchHmm, I think something is going on with formatting..
07:59:22FromDiscord<impbox [ftsf]> yeah
07:59:26FromDiscord<impbox [ftsf]> add backticks
07:59:36FromDiscord<impbox [ftsf]> and preserve the original name with underscores
07:59:52PMunchAh, yeah that works
08:16:51FromDiscord<haxscramper> sent a code paste, see https://paste.rs/LvS
08:17:33FromDiscord<impbox [ftsf]> oh, i guess not?
08:18:20*byanka_ joined #nim
08:18:54FromDiscord<impbox [ftsf]> strangely it works with spaces but not underscores
08:20:47*byanka quit (Ping timeout: 240 seconds)
08:21:44FromDiscord<Rika> I believe there is no case where you can preserve underscore at the start or end of an identifier
08:22:46FromDiscord<impbox [ftsf]> maybe just add a prefix in that case
08:23:44PMunchAh, bummer. Yeah I guess a prefix would be possible
08:24:06PMunchSo there is no consensus on how to do this?
08:24:23FromDiscord<impbox [ftsf]> what's the function for? why is it ?
08:24:27FromDiscord<impbox [ftsf]> should it even be exposed?
08:24:35FromDiscord<impbox [ftsf]> if it's a function it means "magic" right?
08:25:10FromDiscord<impbox [ftsf]> or reserved for compiler stuff
08:27:47PMunchEh, it means more something like "private"
08:28:25PMunchEssentially I'm wrapping C code, and I need to match type definitions exactly
08:43:10FromDiscord<haxscramper> I think consensus is to use `importc: "thing"`
08:43:16FromDiscord<haxscramper> Or you can use unicode underscore
08:43:25FromDiscord<haxscramper> I bet there are a few dozens to pick from
08:44:04FromDiscord<haxscramper> !eval let _____test = "123"; echo _____test
08:44:07NimBot123
08:44:16FromDiscord<haxscramper> here you go
08:44:28PMunchBut how would you even type those..
08:44:36FromDiscord<haxscramper> \:)
08:45:42FromDiscord<haxscramper> Well, on a more serious note - I think stroppping should support this, but I heavily change proc names anyway, and don't like rely on the implicit `importc` without specifying `"procname"` so
08:46:05FromDiscord<haxscramper> And everyone seems to be doing the same, to some extent
08:47:02*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:50:56PMunchWell my goal is to write something similar to Zigs automatic C header file importer. To be able to just specify a C header file in my code and have it automatically be available to me
08:51:13PMunchAnd for that I need some robust scheme for renaming illegal variables
08:54:00FromDiscord<Elegantbeef> `strutils.nimIdentNormalize`?
08:56:02FromDiscord<haxscramper> for hcparse I just went with hard renaming everything to nep1
08:56:02FromDiscord<haxscramper> that does not work with `cName` and `cName_`
08:56:09FromDiscord<haxscramper> Those two have identical normalized values, but different inC
08:56:19FromDiscord<Elegantbeef> Ah right forgot stupidity existed
08:56:21FromDiscord<haxscramper> I keep cache of all renames across whole project I'm wrapping
08:56:53FromDiscord<haxscramper> PMunch\: do you want to make it semi-automatic like nimterop?
08:57:29FromDiscord<haxscramper> Automatic file importer must first parse whole project at once to deal with forward declaration graph cycles
08:57:37FromDiscord<haxscramper> Etc.
08:57:57FromDiscord<haxscramper> I mean it would only wrap what's imported in `<header>`?
08:58:22*Vladar joined #nim
09:01:16*ozzz quit (Ping timeout: 252 seconds)
09:01:51*idf quit (Quit: ZNC 1.8.2 - https://znc.in)
09:02:00*idf joined #nim
09:02:34*ozzz joined #nim
09:03:03PMunch@ElegantBeef, the goal is to be fully automatic
09:06:39FromDiscord<haxscramper> You can keep cache of all identifiers, do per-character diff and replace things like `cName` and `cname` with `cName` and `c[Lower]Name`, where `[Lower]` is determined to be necessary because diff between `cName` and `cname` is `c[N-n]ame`
09:07:06FromDiscord<haxscramper> I do this ... somewhere, I think it was for XML parsing that defined 240 similarlty named enum values
09:07:38PMunchHmm, not sure if I totally understand how this works
09:09:47*pro joined #nim
09:12:11FromDiscord<haxscramper> You just store list of all known identifiers, and when new one comes in you check whether it (normalized) form is already known
09:12:30FromDiscord<haxscramper> Then you repeatedly "fix" it, untils there is no known rename like this
09:12:43FromDiscord<haxscramper> Simplest one would be to just add number increments
09:13:06FromDiscord<haxscramper> `cName` is `cName`, `cname` is `cname1`, `cname_` is `cname2` etc.
09:13:46PMunchHmm, given an array of cstring, how can I get a cstringArray type? It's ptr UncheckedArray[cstring], but I can't seem to cast ptr array[0..0, cstring] to a cstringArray..
09:13:48FromDiscord<haxscramper> https://github.com/haxscramper/hmisc/blob/master/src/hmisc/algo/namegen.nim
09:14:45PMunchAha, just a cast :P
09:15:00FromDiscord<haxscramper> you can probably cast it via `cast[ptr UncheckedArray[cstring](addr ptrToNimArray[][0])`
09:15:03PMunchAh I see
09:15:09PMunchYeah I guess that works
10:07:34*jjido joined #nim
10:10:03*jjido quit (Client Quit)
10:33:00*flynn quit (Read error: Connection reset by peer)
10:34:08*flynn joined #nim
10:51:10FromDiscord<gogolxdong (liuxiaodong)> Is there any way to parse integer from sha256 result?
10:52:40FromDiscord<rb3.nim> what's the correct equivalent of `sym is converter` (check if a symbol is a converter)?
10:53:41PMunchHmm, this error message should be a bit more specific about what type it is expecting: http://ix.io/3x6R
10:53:55PMunchgogolxdong, what do you mean?
10:55:41*auxym_ joined #nim
11:02:29PMunch@rb3.nim you can use getImpl.kind to check if it is a nnkConverterDef
11:04:27FromDiscord<gogolxdong (liuxiaodong)> like `int.from_bytes(sp_quality_string, "big", signed=False)` in python
11:05:24FromDiscord<gogolxdong (liuxiaodong)> which sp\_quality\_string is the result of sha256
11:06:25FromDiscord<rb3.nim> Thanks @PMunch. What I want to do is take an `untyped` symbol and check if it's callable, without resorting to `compiles`. The first step I thought of is to check `declared(sym)`, and then try `sym is proc`. Ill try `getImpl` to check for converter
11:08:45PMunchAh, untyped doesn't have type information
11:08:47*auxym_ quit (Ping timeout: 240 seconds)
11:08:52PMunchWhich is the entire point of it
11:09:14PMunchIt's before the type checking pass, so Nim doesn't know anything about what type it might be
11:10:11PMunchWhat I typically do is output a statement that accepts a `typed` argument and handles it accordingly
11:11:03PMunchgogolxdong, seems like you might want parseHex
11:11:04FromDiscord<rb3.nim> Ya, so I'll have to convert it to an `nnkSym` right? so will try passing it to a macro with `typed` arg like you say
11:11:16PMunchCorrect
11:19:08*auxym_ joined #nim
11:22:05*auxym_ quit (Client Quit)
11:22:33*auxym_ joined #nim
11:31:58*auxym_ quit (Ping timeout: 252 seconds)
11:49:19*jjido joined #nim
11:57:51*xet7 quit (Read error: Connection reset by peer)
11:59:18*xet7 joined #nim
12:05:03PMunchHmm, is there a way to check if two types are binary compatible?
12:05:45PMunchIe. if I want to add overrides so that a C int might become an enum or a void * might be a specific type in Nim land?
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:16PMunchBut ensure that the enum is actually the same underlying int type and that the specific type is actually a pointer of some kind
12:06:30*supakeen joined #nim
12:07:00FromDiscord<haxscramper> That has to be solved on case-by-case basis I think. I mean, `void` is a `pointer`, but for enums this is different
12:07:11FromDiscord<haxscramper> What are your exact use cases?
12:07:44FromDiscord<haxscramper> int-as-bitset, int-as-enum and `void`-as-actually-pretty-concrete-pointer?
12:09:18PMunchWell I have already wrapped this library by hand, but now I want to transition to using my libclang based binding generator. But I have added some more type information to make it a bit safer, combined a bunch of constants into an enum for example. I want to add the possibility to create manual overrides of type signatures, but these would be checked to make sure they are actually compatible
12:11:43FromDiscord<haxscramper> I create a "Raw" wrappers for a procedure using original C signature and then allow to automatically declare wrapper one that does type conversion using nim code. This also allows me to introduce semi-automatic checks for exit codes, wrap things into return-via-pointer-to-argument and other things
12:11:45FromDiscord<haxscramper> Also
12:12:03FromDiscord<TimApple> Can someone point me to a tutorial for Nim that would be at complete newb level? Thanks
12:12:06FromDiscord<haxscramper> Because wrapper logic is implemented in nim I don't have to worry about potential unsafety on the wrapper edge
12:12:18PMunchHmm, that is a good point
12:12:53FromDiscord<haxscramper> Any sort of let's wrap `int` as nim `enum` might lead to silent bugs due to reliance on implementaiton details and such
12:12:57PMunch@TimApple: https://narimiran.github.io/nim-basics/
12:13:04FromDiscord<TimApple> Thanks
12:14:34FromDiscord<haxscramper> I simply allow wrapper generator users to provide their own callback that can invoke arbitrary logic like https://github.com/haxscramper/hcparse/blob/master/src/hcparse/hc_impls.nim#L78
12:14:49FromDiscord<haxscramper> But in the end it is impossible to do without some sort of manual work
12:15:08FromDiscord<haxscramper> You can write `yaml/S-expression` file with signature patterns
12:15:26FromDiscord<haxscramper> For example you can do something like nim `lispRepr()` ast, but
12:16:30FromDiscord<haxscramper> Well, we have S-expression parser in the stdlib, and this is the best way to specify AST patterns. If C procedure declarations unifies with any of the matchers you invoke custom logic and provide two-level wrappers for it
12:18:07FromDiscord<haxscramper> Something like that
12:18:12FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3x7h
12:29:51FromDiscord<TimApple> I'm installing nim for the first time. Windows 11 thinks nimble is a trojan.
12:33:32PMunchYeah, it's a false positive
12:34:47PMunchBasically Nim has been used to write some malware, this meant that these malware samples where fingerprinted and added to various malware databases. Only problem is that they didn't add enough counter-examples in their fingerprinting so now legitimate Nim programs are sometimes fingerprinted as malware
12:35:47PMunchThere is an ongoing effort to report false positives to the malware vendors, hopefully this will help, but in the meantime we get false positives for Nim and Nimble..
12:36:03FromDiscord<TimApple> Thanks for the info
12:38:14PMunchPlease report the files here as false positives: https://www.microsoft.com/en-us/wdsi/filesubmission/. The more people who report them the greater the chance is that Microsoft will improve the fingerprinting
12:41:49*pro quit (Quit: WeeChat 3.2)
12:47:45FromDiscord<dom96> Yeah, this really shows how ridiculous av software is
13:03:07FromDiscord<smartlyweird> Hey everyone. Im trying to find any solution to embed lua scripts into nim just the way how its done with c# or any other language.
13:03:54FromDiscord<smartlyweird> I saw examples where there's a lib to call lua in nim flavour. But i dont think it'd be compatible with my project
13:04:48FromDiscord<smartlyweird> I want to make a independent dll which i can load in my program and it could load lua scripts arbitrarily
13:06:23FromDiscord<haxscramper> The library also provides direct wrappers for the LUA API, so you can use these directly https://github.com/jangko/nimLUA/blob/master/nimLUA/lua.nim#L149
13:06:35arkanoidPmu
13:06:38arkanoidUps
13:06:44FromDiscord<haxscramper> And take any C tutorial for it
13:08:22arkanoidPMunch: I read that you were trying to use libclang to parse C headers. I'm dealing with a header file that requires double or triple preprocessor passes and both c2nim and nimterop are failing to parse without a lot of manual edits. Do you know if libclang does that?
13:08:57PMunchThat is kinda the problem I'm trying to solve here
13:09:23PMunchUse an actual C compiler to do all the heavy lifting, and just extract the information it reads
13:09:33PMunchSeems to work fairly well so far
13:10:18*arkurious joined #nim
13:11:27arkanoidIf you want a testcase, I'm dealing with data binding wsdl files. In particular, I've been trying to generate nim wrapper of the C interface generated by gSOAP given a wsdl
13:12:21arkanoidIn general, this would enable the automatic generation of API from a wsdl, just like Microsoft or Oracle does
13:15:52PMunchMy current test-case is Unbound
13:15:54arkanoidI gave up that path due to the fact that I'm not a C/C++ programmer and I had some difficulties in handling all the things required to make c2nim happy. I'm writing a pure nim converted based on xmltree but it's a very difficult job there too
13:17:04arkanoidIf you have a prototype to test, I'd be happy to run it on the headers I'm talking about
13:17:11PMunchI'm writing dynamic libraries for it and need to know about all its data-structures and such, so I'm trying to have automatic generation of those
13:17:26PMunchCurrently it's super hacky and just outputs text :P
13:17:54arkanoidYeah, my XML converted is at that stage too
13:18:11arkanoidBut please don't give up! You've a fanbase here
13:19:05FromDiscord<haxscramper> btw, PMunch, if you are interested in examples on using libclang (and getting data from it) you can see anything in https://github.com/haxscramper/hcparse/tree/master/src/hcparse or ask me
13:19:46FromDiscord<haxscramper> I added `[]`/`.kind`-based API on top of clang visitors
13:20:00FromDiscord<haxscramper> But otherwise it is pretty close to the wrappers you are using
13:20:03PMuncharkanoid, if you want to give it a go you can copy this: http://ix.io/3x7N/nim
13:21:29PMunchThen write a test.h file that #includes the stuff you would need from C and potentially add some -I things in line 95
13:21:48FromDiscord<smartlyweird> In reply to @haxscramper "The library also provides": Nice! Btw came across this link https://www.mail-archive.com/[email protected]/msg00742.html
13:21:52PMunchBut keep in mind that this is pre-PoC code :P
13:22:26FromDiscord<smartlyweird> But not sure if i can call any lua script arbitrarily instead of one which is embedded
13:23:41PMunchWait, have you already written something like this haxscramper?
13:25:50FromDiscord<haxscramper> I've been on this for the last year
13:26:07FromDiscord<haxscramper> But it is not ready yet
13:26:08FromDiscord<haxscramper> And I don't have any concrete timeline
13:26:34FromDiscord<haxscramper> Because I had some redesign considerations etc.
13:27:02FromDiscord<haxscramper> After arkanoid's struggles with c2nim and another discussion in the telegram
13:27:30PMunchHmm, and here I was hoping that I'd have something I could use for real-life production code over the weekend :P
13:27:53FromDiscord<haxscramper> I also wrap c++
13:28:06FromDiscord<haxscramper> Which is an absolutely astonishing levels of grossness
13:28:21PMunchHaha, yeah I'm focusing on C for now :P
13:28:37FromDiscord<haxscramper> std\:\:string is just
13:28:58arkanoidPMunch: where I can get the clang module?
13:29:27PMunchnimble install clang
13:29:33arkanoidoh!
13:29:56PMunchI think it's that one, but it might be the one called libclang :P
13:30:03PMunchIt's the most recent one
13:31:31arkanoidthis is the most recent one https://github.com/samdmarshall/libclang-nim
13:35:07arkanoiddo you know why c2nim didn't follow a similar path since the beginning?
13:35:21arkanoidparsing C from scratch, isn't this reinventing the wheel?
13:36:09FromDiscord<haxscramper> libclang cant'
13:36:10FromDiscord<haxscramper> well
13:36:50FromDiscord<haxscramper> there must be three ways of wrapping total - manually (or using helper macro) via `importcpp`, using dumb tool like c2nim or nimterop that barely understands C/C++
13:36:59FromDiscord<haxscramper> And using libclang or libtooling
13:37:13FromDiscord<haxscramper> libtooling is an ultimate solution, but it has severe chicked-egg problem
13:37:28arkanoidnimterop uses tree-sitter, that's not at "barely" level afaik
13:37:38FromDiscord<haxscramper> That is barely
13:37:46FromDiscord<haxscramper> trust me, if you can parse C syntax it means
13:37:49FromDiscord<haxscramper> it means nothing
13:38:36FromDiscord<haxscramper> oh, btw, nimterop does not understand preprocessor, instead just degates things to `gcc -CPE`, which means no processing of the platform-specific things
13:38:49FromDiscord<haxscramper> anyway
13:38:54arkanoidI trust you
13:39:05arkanoidyeah I know that nimterop skips the preprocessing
13:39:16arkanoidproblem is that it makes code explode, in my context
13:39:25arkanoidas I'm dealing with generated .h
13:39:27FromDiscord<haxscramper> this is a viable solution because it a dumb solution
13:39:57FromDiscord<haxscramper> if you try to get smart with C and especially C++ wrapping you get into almost infinite sinkhole of "fixing" things
13:40:13FromDiscord<haxscramper> But ideal pipeline for c2nim is
13:40:17FromDiscord<haxscramper> "ideal" my ass
13:40:26FromDiscord<haxscramper> use boost wave to deal with preprocessor
13:40:37FromDiscord<haxscramper> use tree-sitter to deal with C syntax
13:40:50FromDiscord<haxscramper> provide user-defined hooks on every stage
13:41:00FromDiscord<haxscramper> preprocessor, ast convesion etc.
13:41:09arkanoidI won't touch c++ even with very long branch
13:41:46FromDiscord<haxscramper> But this still leaves a lot of problems such as forward declarations cycles, C library dependencies (yes, believe or not C(++) libraries do depend on each other)
13:42:17FromDiscord<haxscramper> Latter is especially complicated problem, because nim thinks of two `importcpp: "std::string"` as two different types
13:42:28FromDiscord<haxscramper> btw we have three incomplete C++ stdlib wrappers in the nimble
13:42:33FromDiscord<haxscramper> they all define string
13:42:40FromDiscord<haxscramper> these strings are not interoperable with each other
13:42:55FromDiscord<haxscramper> nim won't allow this
13:43:57FromDiscord<haxscramper> libclang has full understanding of the code, but it is also a problem
13:44:05FromDiscord<haxscramper> Because it is not a feature, it is a requirement
13:44:17PMunchI'm basically just doing libclang because that's how Zig does it
13:44:26PMunchAnd the Zig way apparently works really well
13:44:46arkanoiddoes Zig convert C to Zig successfully?
13:45:21FromDiscord<haxscramper> For example, a while back someone asked me if my tool could help them wrap a library, and I tested it (with what I had at the moment). In the end I realized that it can't be wrapped directly, because it uses a configure script and insanely convoluted build system, where I would have to basically integrate hcparse into
13:45:33FromDiscord<haxscramper> But c2nim-like would handle it almost perfectly well
13:45:41FromDiscord<haxscramper> but reimplementing C parser
13:45:42PMunch@arkanoid, how it works in Zig: https://ziglang.org/documentation/0.8.0/#Import-from-C-Header-File
13:45:47FromDiscord<haxscramper> ...
13:47:25arkanoidPMunch: whoa! That's a real FFI. Beats nim without even playing
13:47:25FromDiscord<haxscramper> Although I don't understand why c2nim didn't use gcc's parsers, IIRC it was implemented in bison
13:47:49PMunchExactly, and there really isn't a good reason why Nim couldn't do the same thing
13:48:10FromDiscord<haxscramper> I think that having intermediate wrapper files is better in the long run
13:48:21PMunchI mean we're invoking a C compiler at some point, so half the work is just getting all the definitions for stuff
13:48:22arkanoidnim deserves a similar thing. Why don't just grab Zig code that does that and convert to nim?
13:48:51PMunchI did have a look at the Zig code, not quite sure what it was doing though
13:49:02PMunchUses a completely different way of parsing than I do..
13:49:13PMunchMaybe I'll rewrite it if down the line my way doesn't work
13:50:09arkanoidhaxscramper, why do you think that manual wrapping would work on the long run?
13:50:12FromDiscord<haxscramper> do you have a link to that part of compiler, or I should go search myself?
13:50:21PMunchThe plan is basically to just get all the type definitions and procedure signatures converted to Nim, then the rest is just a matter of linking it together with the original C sources and it should work fine
13:50:24*PMunch crosses fingers
13:50:58arkanoidit would be a game changer
13:52:39PMunch@haxscramper, this seems to be the main entry point of the parsing: https://github.com/ziglang/zig/blob/master/src/translate_c.zig#L355
13:52:41FromDiscord<haxscramper> Not manual wrapping↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
13:52:54FromDiscord<haxscramper> Explicit `.nim` with wrappersr written down
13:52:57FromDiscord<haxscramper> That you can document
13:53:11FromDiscord<haxscramper> Also you can rename things to nep1 compliant style
13:53:25FromDiscord<haxscramper> Also provide wrappers that turn error codes to exceptions
13:53:47FromDiscord<haxscramper> Also write examples that don't operate on "magically" created types, but instead use things that are written in the code
13:54:03FromDiscord<haxscramper> Also there is no middlemen between you writing things and nim compiler
13:54:52FromDiscord<haxscramper> But I don't mean "manual" I mean that you can have `import wrapper/somefile`, but how exactly it is generated is not my problem
13:55:12FromDiscord<haxscramper> Also I don't have to drag wrapper system alongside compiler implementation
13:55:22FromDiscord<haxscramper> IIRC nimterop runs `toast` binary each time I compile code
13:55:25FromDiscord<Rika> makes sense
13:55:35arkanoidmake sense, yeah
13:55:50FromDiscord<Rika> its easier to debug things when things arent "autogen"ed on cct
13:55:51FromDiscord<Rika> (edit) "cct" => "ct"
13:55:56arkanoidI do agree that nimifing interface is good
13:56:02FromDiscord<haxscramper> Exactly
13:56:28FromDiscord<haxscramper> Too much magic
13:56:28FromDiscord<haxscramper> Too complicated interface
13:56:29FromDiscord<haxscramper> My main issue with nimterop basically↵(@Rika)
13:56:33FromDiscord<haxscramper> If I don't like something in the `.nim` wrapper I can just open and edit
13:56:38FromDiscord<Rika> also no reason to run the gen every time you compile no
13:56:39arkanoidzig translate-c is the command line tool that does the same thing of compile-time @cImport, apparently
13:57:17arkanoidmaybe c2nim is the nearest point to equilibrium before diving into madness
13:57:36arkanoidbut if someone else is already maintaining that madness, why not
13:58:22FromDiscord<haxscramper> idea of c2nim is the closes you can go to the "average library" yes
13:58:37FromDiscord<haxscramper> Automate 95% of work
13:58:52FromDiscord<dom96> Anybody ever used this? https://cxx.rs
13:58:54FromDiscord<haxscramper> But sometimes you need 100%, and that's where things start to get super fun
13:59:00FromDiscord<haxscramper> Like wrapping Qt
13:59:02FromDiscord<Rika> if only 100% was automatable
13:59:11FromDiscord<haxscramper> 5% of qt is probably full-time work for a month
13:59:21FromDiscord<haxscramper> It is, but that's hard to do↵(@Rika)
13:59:30FromDiscord<Rika> i meant practically in this case
13:59:31FromDiscord<Rika> so yeah
13:59:45FromDiscord<haxscramper> NO, I mean it is practically possible as well
13:59:57FromDiscord<Rika> really?
14:00:01FromDiscord<Rika> what is holding us back then
14:00:26FromDiscord<haxscramper> It just requires an order of magnitude more work from both person wrapping a library and person implementing wrapper generator
14:01:07*pro joined #nim
14:01:17FromDiscord<haxscramper> Nothing, I'm already working on this↵(@Rika)
14:01:21FromDiscord<Rika> i see
14:01:24FromDiscord<Rika> GL
14:01:26arkanoidis the typing that's more difficult, or the functions
14:01:27FromDiscord<haxscramper> Right now I can safely say that I'm
14:01:36FromDiscord<haxscramper> closer to the end than to the start
14:01:42FromDiscord<haxscramper> that's all I can safely say
14:01:48FromDiscord<haxscramper> which is a lot btw
14:02:31FromDiscord<haxscramper> No, the most difficult part is considering the library as a whole, at once↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
14:02:31*PMunch quit (Quit: Leaving)
14:02:40arkanoidshouldn't this be a join effort of nim experts like you? seems important, and now that I know that another nim competitor is doing that successfully, why not?
14:02:56FromDiscord<Rika> "nim experts" are very scarce 🙂
14:03:01FromDiscord<haxscramper> yeah
14:03:31FromDiscord<Rika> im pretty sure theyre all booked too
14:03:51FromDiscord<Rika> so yeah arkanoid you better become one sooner or later 😛
14:04:03arkanoidif only I used nim instead of python for scientific computing years ago!
14:04:33FromDiscord<Rika> it probably would have taken you a lot more work to make (years ago)\
14:04:44FromDiscord<Rika> not a lot of libraries back then after all
14:04:46arkanoidI've converted one of my old algorithms just for fun and it goes three times faster
14:05:04FromDiscord<Rika> damn thats pretty huge
14:05:34arkanoidyeah but I was already using numpy, thats a C library with python interface
14:06:12FromDiscord<Rika> thats even more huge isnt it since that means for 2/3rds of the time it's just python being python....
14:07:10arkanoidexactly. Basically doing IPC to avoid GIL. With nim I used async mixed with multithreading and is smoooth
14:07:19*rockcavera joined #nim
14:07:19*rockcavera quit (Changing host)
14:07:19*rockcavera joined #nim
14:08:47arkanoidBtw, I want to learn how to parse. I realizes that I lack basic knowledge of this topic.
14:09:00FromDiscord<haxscramper> sent a long message, see http://ix.io/3x7X
14:10:16arkanoidI nave this piece of code that walks all over a directory of XML schema files, and reaches all nodes in order according to dependencies. Now I think I would need a grammar but I lack this knowledge
14:10:18FromDiscord<haxscramper> Having to do this requires to have graph library with graph algorithms, which I have to write from scratch, because nim did not really have anything of that sort, and closes alternative `disruptek/gram` used `static` for graph properties, but due to some implementation details I had to temporarity turn directed graph into undirected
14:11:16FromDiscord<haxscramper> Also C can do `struct A; struct B { a A;}` in one header, and `struct B; struct A { b B; }` in another header
14:11:42FromDiscord<haxscramper> It is easy to fix with c2nim - just copy things into one header
14:13:01FromDiscord<haxscramper> An maybe fix some imports. But if I must automate 100% then I have to keep track of all movements (or make things work as if there were no movements at all, which is easier due to `export` in nim - I can pretend that all files expose both `A` and `B`, while having them saved in a third file).
14:13:03FromDiscord<haxscramper> And so on
14:14:33FromDiscord<haxscramper> But I don't thin c2nim will ever switch to boost+tree-sitter implementation, nor does it have to, because this can be done using external tool
14:16:52*pro quit (Quit: WeeChat 3.2)
14:17:11arkanoidI fear there's quite a lot of different opinions on this topic
14:17:25FromDiscord<haxscramper> parsing?
14:17:35FromDiscord<haxscramper> or the wall of text I just dumped?
14:19:08arkanoidfrom the point of view of a nim user who doesn't like C++, but it's quite ok with C, the current FFI nim offers hard to use when header is quite convoluted, so welcome to project where complexity is on the other side
14:19:10arkanoidthe wall of text
14:19:57FromDiscord<cabboose> Hey I’m a bit confused with HashSets; I assumed the `[]` proc would just use the hash of the object and give you whatever element in the set had that same hash value but that doesn’t seem to be the case for me
14:20:37FromDiscord<haxscramper> No, hashset does not simply reuse the hash, it also compares object for equality in case of collisions
14:20:45FromDiscord<cabboose> ah
14:20:53FromDiscord<cabboose> that sucks
14:20:55FromDiscord<haxscramper> So object must be `hash(X) == hash(Y) and X == Y` to be considered equal IIRC
14:21:01FromDiscord<haxscramper> you can overload `==`
14:21:09FromDiscord<cabboose> I thought I had though
14:21:25FromDiscord<Rika> can you make a playground example?
14:21:31FromDiscord<cabboose> I have; maybe it’s not using it though, I’ll have another tinker in the morning
14:21:40FromDiscord<haxscramper> Yes, usually having complexity on the other side is preferrable↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
14:21:58FromDiscord<cabboose> Unfortunately the mrs is forcing me off which is why i asked here instead of madly throwing things at it to fix it
14:22:07FromDiscord<cabboose> i’ll check in on the forum tomorrow if i cant figure it
14:22:09FromDiscord<cabboose> thanks
14:38:54*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:39:44arkanoidI'm giving c2nim another try, just to test again after some time the same thing I've been struggling months ago
14:40:00arkanoidbut I'd like to ask now, instead of guessing
14:40:15arkanoidwhat does this C define means? #define SOAP_STRINGIFY(s) #s
14:41:10arkanoidwhat that second hash means?
14:42:22FromDiscord<haxscramper> `#s` converts `s` token to string
14:42:47FromDiscord<haxscramper> nim version is a `template soap(s: untyped): untyped = astToStr(s)`
14:42:55FromDiscord<dom96> @haxscramper what is the approach your taking for FFI? are you building a better c2nim?
14:43:01FromDiscord<dom96> (edit) "your" => "you're"
14:43:33FromDiscord<haxscramper> including that, yes
14:43:38FromDiscord<haxscramper> But not the only part
14:43:49FromDiscord<haxscramper> Well, I think better c2nim is a one-week project at most
14:44:39arkanoidhaxscramper, so in #ifdef C2NIM that would become "def SOAP_STRINGIFY(s) template SOAP_STRINGIFY(s: untyped): untyped = astToStr(s)" ?
14:46:10*jjido joined #nim
14:46:58FromDiscord<haxscramper> No, I don't think so. From the documentation of `#def` in c2nim I think there is no way to have `#s`
14:47:14FromDiscord<haxscramper> Maybe you can try to
14:47:36FromDiscord<haxscramper> `#def SOAP_STRINGIFY(s) #s`? At least that's how I understand `#def`
14:47:47FromDiscord<haxscramper> > ↵> #def is very similar to C's #define, so in general the macro definition can be copied and pasted into a #def directive.↵>
14:48:23arkanoidyeah I've already tried "def SOAP_STRINGIFY(s) #s", but I get Error: identifier expected, but got: s
14:49:54FromDiscord<dom96> In reply to @haxscramper "But not the only": what's the other part?
14:50:35FromDiscord<haxscramper> Remaining 5% for full automation
14:50:45FromDiscord<haxscramper> c2nim approach is not automatic, it is about first 95%
14:50:58FromDiscord<haxscramper> It is relatively easy to do, you just push decision to the end users
14:51:28FromDiscord<haxscramper> But if you need to squeeze the last 5%, it becomes exponentially more difficult to implement
14:51:55FromDiscord<haxscramper> But this is equally important in the long run
14:53:11FromDiscord<dom96> how are you getting that last 5%?
14:53:40FromDiscord<haxscramper> using libclang instead of boost-wave+tree-sitter
14:58:26FromDiscord<dom96> Nice, likely the best approach. I've considered doing the same after writing an obfuscator using libclang
15:03:53FromDiscord<haxscramper> For full automation yes, but average use case requires 95%
15:04:52FromDiscord<enthus1ast> 🤣 to avoid this annoying antivirus false positive?↵(@dom96)
15:06:27FromDiscord<dom96> hah
15:06:46FromDiscord<dom96> nah, it was my BSc project
15:07:38FromDiscord<enthus1ast> \:)
15:08:05FromDiscord<dom96> you can try it here: https://picheta.me/obfuscator
15:13:55FromDiscord<ajusa> Does Nimx require laying out all the elements by hand? There's no automatic layout system similar to flexbox?
15:15:15FromDiscord<ajusa> Also, it seems like there aren't many cross platform options for GUI interfaces that work on Android as well - Nimx and Qt seem to be the only ones that can be used
15:23:35*flynn quit (Read error: Connection reset by peer)
15:24:43*flynn joined #nim
15:29:06FromDiscord<whisperdev> required type for fd: SocketHandle↵ but expression 'fd' is of type: SocketHandle
15:54:04*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
16:07:32NimEventerNew thread by Kalbhairab: How to reverse string in nim, see https://forum.nim-lang.org/t/8370
16:29:44FromDiscord<enthus1ast> @ajusa\: maybe fidget, at least this is the plan I think
16:30:07FromDiscord<enthus1ast> https://github.com/treeform/fidget
16:30:14FromDiscord<ajusa> Yeah, but Fidget 2 is months away so I don't want to spend too much time working with normal Fidget
16:30:48FromDiscord<ajusa> Treeform's mentioned that it'll be very different, plus it will support stuff like touch events and scrolling I think
16:31:21FromDiscord<enthus1ast> Then you're better informed than me 😁
16:32:20FromDiscord<enthus1ast> Currently building guis is terrible, only html is crossplatform
16:32:31arkanoidhaxscramper, do you know what's the name of "#define SOAP_STRINGIFY(s) #s" thing? I'm trying to google it, but I lack the right keyword
16:32:56FromDiscord<ajusa> Ah okay 😅. ↵Yeah I think I'll just write this using Jester and opening a link to the local server in the user's browser, that seems like the easiest way of doing things...
16:33:15FromDiscord<haxscramper> https://gcc.gnu.org/onlinedocs/gcc-4.8.5/cpp/Stringification.html#:~:text=When%20a%20macro%20parameter%20is,This%20is%20called%20stringification%20.
16:34:51*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
16:37:40NimEventerNew Nimble package! kombinator - Kombinator is a tool to generate commands line from parameters combination from a config file., see https://gitlab.com/ArMour85/kombinator.git
16:39:26*Gustavo6046 joined #nim
16:57:26FromDiscord<gogolxdong (liuxiaodong)> `/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)`
16:57:39FromDiscord<Yardanico> that's a known issue with arc
16:57:42FromDiscord<Yardanico> lemme show you
16:57:58FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/14226
17:04:16arkanoidhaxscramper, thanks! Gonna ask in the forum for a solution
17:09:49NimEventerNew thread by Giaco: C2nim and Stringification, see https://forum.nim-lang.org/t/8372
17:22:20FromDiscord<dom96> happy Friday!
17:23:15FromDiscord<dom96> oooh nimforum on HN front page
17:33:57*jjido joined #nim
17:47:00*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
18:02:39*stkrdknmibalz joined #nim
18:04:04*byanka_ quit (Read error: Connection reset by peer)
18:04:48*byanka_ joined #nim
18:13:10nrds<Prestige99> seems like people are complaining that it's "mobile first" and uses javascript, lol
18:14:08*nrds quit (Remote host closed the connection)
18:14:31*nrds joined #nim
18:23:40FromDiscord<retkid> hey
18:23:49FromDiscord<retkid> is there any nim header i can generate
18:24:00FromDiscord<retkid> i just need a function name and an output
18:24:11FromDiscord<retkid> i could read the source but i feel like thats gonna be annoying
18:40:01NimEventerNew thread by Alexeypetrushin: Any plans for better optional arguments?, see https://forum.nim-lang.org/t/8373
18:44:58FromDiscord<retkid> can functions be used in the parameters for other functions?
18:45:17FromDiscord<retkid> or do you have to pass them to vars before?
18:52:11FromDiscord<haxscramper> Yes, nim has first-order functions `proc a(cb: proc())`
18:52:40FromDiscord<haxscramper> What exactly do you mean by "nim header"? Header file?↵(@retkid)
18:52:58FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#types-procedural-type
18:53:32FromDiscord<retkid> i want a list of functions with return types
18:53:46FromDiscord<retkid> im writing some python to parse it now
18:55:23FromDiscord<haxscramper> There is a `--header` option, but it is deprecated
18:55:53FromDiscord<haxscramper> "official" way is to write some external tool, or generate wrappers manually based on `exportc` procs
18:56:22FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/880888483634380851/unknown.png
18:56:34FromDiscord<retkid> now all i need to do is get the paramater types
18:56:37FromDiscord<retkid> (edit) "paramater" => "parameter"
18:56:38FromDiscord<retkid> but
18:56:57FromDiscord<retkid> the putting functions in the function is kinda hard
18:57:28FromDiscord<retkid> i suppose it wont be difficult if the function is in the file
18:57:37FromDiscord<retkid> if the function is somewhere else that might be impossible
18:57:57FromDiscord<haxscramper> you are parsing nim code?
18:58:25FromDiscord<retkid> yes
18:58:37FromDiscord<Recruit_main707> for what?
18:58:54FromDiscord<retkid> just need a list of functions, param, and return type
18:59:02FromDiscord<retkid> so i can automatically generate classes for ffi
18:59:54FromDiscord<retkid> (edit) "param," => "param types,"
18:59:55FromDiscord<Recruit_main707> id say macro as pragma would probably be more useful but alright
19:00:14FromDiscord<Recruit_main707> i actually did something similar but ive lost the code probably
19:01:01FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3x9v
19:01:15FromDiscord<retkid> all i need is the params which are really dicey
19:03:06FromDiscord<haxscramper> `import compiler`?
19:03:26FromDiscord<retkid> ?
19:03:38FromDiscord<Recruit_main707> you can use the compiler as a module
19:03:45FromDiscord<haxscramper> https://github.com/haxscramper/hnimast/blob/master/src/hnimast/pnode_parse.nim#L13
19:04:10FromDiscord<haxscramper> yes, parsing nim using naive string handling is not the best idea
19:04:25FromDiscord<retkid> yea thats why im using py
19:04:32FromDiscord<haxscramper> That is, if you need somewhat robust solution
19:04:45FromDiscord<retkid> parsing a language with that language can cause weird unexpected issues
19:04:55FromDiscord<retkid> or maybe i underthought it
19:05:12FromDiscord<Recruit_main707> that sentence definetly doesnt make sense xd
19:05:36FromDiscord<retkid> lol idk lemme be im running on half steam and cheese cake
19:05:41FromDiscord<Recruit_main707> specially in nim because you can use the actual compiler
19:06:29FromDiscord<Recruit_main707> yeah yeah, no worries, whatever you are comfortable man, checking the nim way could also be useful to learn tho
19:07:10FromDiscord<retkid> well, this stuff is pretty simple so i would really only be learning how to split strings in nim
19:07:17FromDiscord<retkid> unless im doing the compiler which might be overkill
19:08:50FromDiscord<retkid> ooh i have an idea
19:12:00FromDiscord<Recruit_main707> https://stackoverflow.com/questions/32487507/nim-code-parser
19:18:35FromDiscord<haxscramper> This answer is ancient and all API has changed since
19:18:37FromDiscord<haxscramper> Also `import compiler.modules, compiler.ast, compiler.astalgo, compiler.passes, compiler.llstream`
19:18:37FromDiscord<haxscramper> First time seeing it like thsi
19:45:50FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3x9K
19:47:22FromDiscord<Ayy Lmao> The error is `Error: unhandled exception: ccgexprs.nim(809, 10) `tupType.kind == tyTuple` [AssertionDefect]`
20:18:37*auxym_ joined #nim
20:44:49*cyraxjoe quit (Read error: Connection reset by peer)
20:45:44*cyraxjoe joined #nim
20:47:34*Gustavo6046 joined #nim
21:08:37arkanoidc2nim is trying to parse inside a "#if defined(MYSYMBOL)" even if #assumendef MYSYMBOL is in C2NIM section
21:09:51arkanoidcan you take a look at the .h file I'm trying to feed to c2nim and find out why?
21:10:40*auxym_ quit (Ping timeout: 240 seconds)
21:15:12arkanoiddocumentation says it should work on these constructs: https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#assumedef-and-assumendef-directives
21:17:39*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
21:20:17FromDiscord<haxscramper> If you share your header file I will look into it with hcparse & try out my latest idea. If everything goes well I might be able to produce working result
21:20:51FromDiscord<haxscramper> will look into it tomorrow
21:21:53arkanoidhaxscramper https://termbin.com/5ttm9
21:22:52arkanoidhaxscramper, if you feed this to c2nim, you get error on line 716, inside the block defined by WITH_PURE_VIRTUAL, that is assumendef
21:25:29arkanoidhaxscramper, this is and include that is required by the .h generated procedurally, so this is human generated probably. The real deal is the next file once this works
21:26:10FromDiscord<haxscramper> Can you also share it as well so I have more things to test on
21:28:35FromDiscord<haxscramper> First file you linked also contains implementation of the template function (at the very end) - it should be simply wrapped or converted as well?
21:32:07*max22- quit (Quit: Leaving)
21:33:29arkanoidhaxscramper: sure. this is soapH.h https://termbin.com/8xvc, this is soapStub.h https://termbin.com/fgvu , these are both generated procedurally using thr gSOAP toolkit that reads a .wsdl and creates data binding
21:35:41arkanoidhaxscramper: this is the bash script that generates them https://termbin.com/aim6
21:37:45arkanoidlong story short, wsdl2h takes a wsdl file and returns a .h file that has an internal sytax similar to C but is parsed by next tool. soapcpp2 takes this .h and creates actual .h and .c files that compiles successfully with gcc
21:41:28arkanoidand about your question about the template function at the very end: as you can see by the command line of the bash script I've shared, I've selected to generate C code and not C++, so __cplusplus should not be defined
21:44:20FromDiscord<haxscramper> Good. Hopefully boost wave would be able to correctly process all of this.
21:44:29FromDiscord<haxscramper> All of these macro defines
21:45:27arkanoidI though you were using libclang
21:46:42NimEventerNew thread by Ggibson: How to make a const array in a proc w/ template?, see https://forum.nim-lang.org/t/8374
21:46:53arkanoidall the assumendef you find on top are just picked from manual
21:47:30arkanoidany idea why WITH_PURE_VIRTUAL block is parsed even if it is assumendef?
21:54:00FromDiscord<haxscramper> Probably c2nim bug
21:54:19FromDiscord<haxscramper> In reply to @arkanoid "I though you were": I'm using everything
21:54:54arkanoidhaha
21:55:29arkanoidI would be very curious watching you writing nim code. Have you ever though about doing screencasts?
22:00:09*rockcavera quit (Remote host closed the connection)
22:09:57arkanoidhaxscramper, I've read what wave boost is, I didn't even know about it's existance. It says to be even more compliant than Intel compiler proprocessor
22:34:28arkanoidhaxscramper, I'm trying to learn by reading your code. May you tell me where wrapWithConfig is defined? https://github.com/haxscramper/hcparse/blob/5bbe20c005bb947d0dafc77c20e8a37b2ee1062a/src/hcparse/clang_raw/make_wrap.nim#L47
22:39:56FromDiscord<dan> i have been asking myself this for quite some time, but why is there a need to specify the header when cimporting? 🤔
22:40:17FromDiscord<dan> is there information missing from the nim declaration?
22:43:26FromDiscord<dan> also adding onto that: what is the recommended way of exposing a c interfare to a nim shared library? is it better to just write my own header and practically re-wrap it in nim or use the nim feature of generating a header which afaik then depends on the nimbase.h?
22:47:17*xet7 quit (Remote host closed the connection)
22:48:05*xet7 joined #nim
23:12:23*Vladar quit (Remote host closed the connection)
23:12:28FromDiscord<ajusa> I'm trying to convert a proc to a template but I'm getting↵` Error: in expression '"test"()': identifier expected, but found '"test"'`, still somewhat new to templates in Nim though. Any idea what I'm doing wrong?
23:13:29FromDiscord<ajusa> Minimal example: https://play.nim-lang.org/#ix=3xaw
23:20:57*auxym_ joined #nim
23:33:00*flynn quit (Read error: Connection reset by peer)
23:34:06*flynn joined #nim
23:44:23FromDiscord<Paulo> maybe i got it wrong, but I can use nimscripts to set compiler options like "--threads:on", right? if so, how do i do it?
23:54:35FromDiscord<Elegantbeef> @ajusa\: inside templates the parameters are replaced wherever a identifier matches
23:55:07FromDiscord<Elegantbeef> @Paulo\: you can do `switch("threads", "on")` in a config.nims or `yourMainFile.nims`
23:55:49FromDiscord<Paulo> In reply to @Elegantbeef "<@164144089682411520>\: you can do": thank you