00:13:13 | * | tefter joined #nim |
00:38:37 | * | ng0 joined #nim |
00:44:30 | * | ng0 quit (Quit: ZNC 1.7.2+deb3 - https://znc.in) |
00:47:01 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
00:50:15 | * | rhenvar joined #nim |
00:50:22 | rhenvar | Hello guys |
00:50:38 | rhenvar | anyone have experience building nim shared libraries w docker? |
01:04:45 | * | couven92 quit (Ping timeout: 240 seconds) |
01:05:32 | FromDiscord | <Rika> disruptek how else would I edit nodes other than with []? |
01:05:40 | FromDiscord | <Rika> And quote do |
01:34:16 | FromGitter | <Varriount> rhenvar: Do you mean, using Docker as a build environment, or building container images containing shared libraries? |
02:15:32 | * | chemist69 quit (Ping timeout: 248 seconds) |
02:17:33 | * | chemist69 joined #nim |
02:32:34 | * | casaca quit (Quit: leaving) |
02:54:40 | disruptek | rika: the point is that [3] imparts zero knowledge to the reader. |
02:55:27 | disruptek | sadly, /i/ am that clueless reader. |
02:57:32 | disruptek | a comment or two would be sufficient. |
02:58:07 | disruptek | my openapi codegen is 1400 lines of macro crap and i cannot find a single case where i index a nimnode. |
02:58:24 | disruptek | i guess it's not a requirement, just a choice that another programmer foists upon us. |
02:59:34 | FromDiscord | <Elegant Beef> Just for clarity sake, what's the alternative? |
03:09:55 | disruptek | it varies. |
03:11:09 | disruptek | not sure what it was i was looking at because, of course, it was just a random deref. |
03:12:37 | disruptek | but, you could iterate, findChild, expect*, hasArgOfName, or write your own op. |
03:20:02 | FromDiscord | <Rika> I see |
03:24:45 | leorize | is it possible to estimate the amount of bits needed for a multiplication? |
03:25:13 | disruptek | i would assume so. |
03:25:27 | disruptek | certainly it's possible for some operations. |
03:25:39 | disruptek | eg. 2*n 😉 |
03:26:09 | leorize | yea except my problem is x * 5 ^ y :) |
03:26:20 | disruptek | yeah, those damned 5s. |
03:26:46 | leorize | I'll just plug in the biggest boundary for x and y to wolfram alpha and get the bit count from there |
03:27:34 | leorize | I'd certainly want a formula to estimate the bit count though |
03:27:41 | disruptek | i would just look up the work on the subject. i really don't think it should be hard. |
03:28:09 | * | muffindrake quit (Ping timeout: 272 seconds) |
03:28:32 | FromDiscord | <Elegant Beef> My enum generation works but it's happening ina manner that makes the compiler angry |
03:28:41 | FromDiscord | <Elegant Beef> Im glad im dull |
03:29:08 | disruptek | me too. i don't think i could handle being upstaged by a canuck. |
03:29:48 | * | muffindrake joined #nim |
03:30:31 | FromDiscord | <Elegant Beef> lol |
03:31:10 | FromDiscord | <Elegant Beef> because of the way i have this i basically have to compile components then the base component class then everything else |
03:31:19 | FromDiscord | <Elegant Beef> But i feel like that's just me being daft |
03:31:39 | FromDiscord | <Elegant Beef> base component file* |
03:31:53 | disruptek | well, i won't tell if you don't. |
03:32:22 | * | skrylar joined #nim |
03:32:24 | skrylar | ahoy |
03:32:33 | FromDiscord | <Elegant Beef> Well as much as i like cheeky comments, sadly they dont help 😄 |
03:32:59 | disruptek | no one cares which order you put your socks on, as long as you put your shoes on last. |
03:33:20 | FromDiscord | <Elegant Beef> *Is this an implication you can actually control the compile order, and it's not silly? |
03:33:21 | FromDiscord | <Elegant Beef> *Is this an implication you can actually control the compile order, and it's not silly?* |
03:33:29 | disruptek | nope. |
03:33:56 | disruptek | but if you hold your laptop closer to the router, i'd be happy to try. |
03:34:11 | FromDiscord | <Elegant Beef> Damn i dont have a laptop |
03:34:20 | disruptek | maybe some other time, then. |
03:35:27 | FromDiscord | <Elegant Beef> so atm i call a macro on my sub components that subscribe them, then call another macro that makes the actual enum off these, that works fine but enforces a compile order |
03:35:33 | * | Prestige quit (Quit: Prestige) |
03:36:07 | disruptek | good; otherwise, it wouldn't work. |
03:41:00 | skrylar | issues with compile orders? |
03:41:19 | FromDiscord | <Elegant Beef> Well i reference the created enum in other files and it cant find it |
03:41:52 | FromDiscord | <Elegant Beef> Because some files that rely on this compile before it is created |
03:42:04 | * | rockcavera quit (Remote host closed the connection) |
03:42:24 | skrylar | that should only happen if you are not importing modules correctly or the macro is actually creating the enum privately (ex. foo instead of foo*) |
03:42:57 | FromDiscord | <Elegant Beef> Well the enum is created in a macro |
03:43:15 | skrylar | that is fine, have you tried dumping the AST to make sure its creating a published enum though? |
03:43:23 | FromDiscord | <Elegant Beef> Yea it works in another file |
03:46:45 | skrylar | oh. trying to do component registration at compile time |
03:47:42 | FromDiscord | <Elegant Beef> Yea im trying to make an enum/LUT for runtime |
03:47:53 | skrylar | yea i'm not sure i would try to get the macro system to do that tbh |
03:49:15 | skrylar | when its done at runtime theres a chance to run the module initializers regardless of the actual compile order (which is how a lot of the c++ ones do it, afaik) to do it at compile time does require you to explicitly list them "somewhere" although there are some tricks |
03:49:50 | FromDiscord | <Elegant Beef> You can generate types at runtime? 😄 |
03:50:06 | skrylar | not really |
03:50:21 | skrylar | but you're trying to use a hard wired method which necessarily means hard wiring some parts |
03:50:33 | FromDiscord | <Elegant Beef> Well i had an int generation setup before |
03:50:49 | FromDiscord | <Elegant Beef> that worked fine but not using *proper* bitflags |
03:53:16 | skrylar | you can read text files and run programs during nim builds so you could have it read a list of types to hard wire in one file |
03:53:46 | skrylar | although tbh i would just generate the file the old way from a script for that |
03:54:20 | FromDiscord | <Elegant Beef> Well i mean i had a bit op based array of int32s before |
03:54:32 | FromDiscord | <Elegant Beef> Well i mean i had a array of int32s before for components |
03:54:51 | FromDiscord | <Elegant Beef> i'd just add a `exposeComponent(Type)` |
03:54:59 | FromDiscord | <Elegant Beef> and it'd instantly be added and i'd have data buckets |
03:55:52 | FromDiscord | <Elegant Beef> Ill probably just revert my changes |
03:56:15 | FromDiscord | <Elegant Beef> Comeback to this later |
03:56:25 | skrylar | okies |
03:56:47 | FromDiscord | <Elegant Beef> *how happy im i decided to use git for this* 😄 |
03:58:31 | skrylar | slowly shoring up a janet wrapper on this end |
03:58:40 | skrylar | then back to gtk/gdk, bleh |
03:58:51 | * | Cube30 joined #nim |
04:03:18 | leorize | disruptek: turns out you can just sum up the amount of bits of every single components in the multiplication |
04:04:12 | leorize | took me longer than expected to even reach step 3 of the "basic" converter |
04:04:28 | leorize | it sure looked short on the paper |
04:14:37 | rhenvar | Varriount: Using nim in an intermediary build stage in docker to produce a shared library to be used in another build stage |
04:24:27 | * | nsf joined #nim |
04:26:37 | rhenvar | both alpine linux images |
04:27:15 | * | Cube30 quit (Remote host closed the connection) |
04:30:09 | leorize | what problem are you running into? |
04:37:21 | FromDiscord | <Elegant Beef> so i know i was suggested to use this <https://github.com/zacharycarter/bgfx.nim> but im curious if anyone here's used it, cause i built bgfx, moved it to my /lib/ folder and the project folder, no cigar |
04:37:48 | FromDiscord | <Elegant Beef> Still complains about the build library |
04:41:50 | FromGitter | <Varriount> rhenvar: What problem are you having? Are you passing in compiler options to build a shared library? |
04:44:50 | * | hax-scramper quit (Ping timeout: 240 seconds) |
04:47:32 | * | LER0ever quit (Remote host closed the connection) |
04:50:17 | * | hax-scramper joined #nim |
04:51:53 | * | LER0ever joined #nim |
04:54:31 | * | hax-scramper quit (Read error: Connection reset by peer) |
04:54:57 | * | hax-scramper joined #nim |
04:55:19 | * | my_dude quit (Ping timeout: 260 seconds) |
05:17:13 | * | FromDiscord_ joined #nim |
05:17:16 | * | FromDiscord quit (Remote host closed the connection) |
05:23:05 | * | hax-scramper quit (Read error: Connection reset by peer) |
05:23:14 | * | hax-scramper joined #nim |
05:34:31 | * | hax-scramper quit (Read error: Connection reset by peer) |
05:35:39 | * | hax-scramper joined #nim |
05:47:01 | * | NimBot joined #nim |
06:03:46 | * | ptdel quit (Ping timeout: 240 seconds) |
06:11:06 | * | hax-scramper quit (Read error: Connection reset by peer) |
06:11:22 | * | hax-scramper joined #nim |
06:12:47 | * | narimiran joined #nim |
06:16:36 | * | marmotini_ joined #nim |
06:22:01 | * | hoijui joined #nim |
06:26:06 | FromGitter | <xflywind> Why when I use varargs[(string, string)] as macro parameters, the compiler crashed instead of informing me that varargs[(string, string)] can't appear in macro parameters? |
06:36:31 | FromGitter | <xflywind> When I use seq[(string, string)] or use proc version, all is right. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e4e28ef8b2d4664ef12ac96] |
06:37:24 | * | dddddd quit (Ping timeout: 248 seconds) |
06:41:48 | * | lritter joined #nim |
07:17:32 | * | marmotini_ quit (Remote host closed the connection) |
07:17:42 | rhenvar | Varriount: Correct - I'm adding options --app:lib to build a shared library for the first stage, but i'm trying to use the .so in the second stage but it doesn't recognize some of the exported functions for some reason |
07:18:05 | * | marmotini_ joined #nim |
07:19:48 | rhenvar | Varriount: for more context, I'm trying to use https://github.com/Taymindis/nginx-link-function with a nim built shared library, but it can't read the init function. It works on bare metal but not docker |
07:21:05 | * | marmotini_ quit (Read error: Connection reset by peer) |
07:21:05 | rhenvar | Varriount: nm and objdump within the container both show the expected functions labeled 'T' |
07:21:17 | * | marmotini_ joined #nim |
07:32:18 | * | solitudesf joined #nim |
07:44:40 | * | sigmapie8 joined #nim |
07:54:41 | FromGitter | <Varriount> rhenvar: Can you share the source code? |
07:56:12 | FromGitter | <Varriount> You have to use the dynlib and cdecl pragmas to export procedures, as well as possible build the runtime DLL depending on what gc you're using |
07:58:37 | leorize | you don't need the runtime dll if you don't share memory between Nim heaps |
07:58:52 | leorize | heaps from different Nim dlls |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:05:00 | * | gmpreussner joined #nim |
08:12:58 | * | endragor joined #nim |
08:33:55 | * | Vladar joined #nim |
08:39:47 | * | solitudesf quit (Ping timeout: 260 seconds) |
08:48:27 | * | kaputt is now known as qwertfisch |
08:49:27 | vegai | is there some rationale(!) for making rationals not be the default non-whole numbers? |
08:49:36 | vegai | I'm kinda missing that from various lisps ;/ |
08:50:08 | vegai | I know of the rationals lib, just wondering about the defaults |
08:53:06 | skrylar | the docker talk reminds me i need to bother some folk since i emailed that nim patch to the listed maintainer and they seem to be asleep at the wheel after a week or two... courtesy periods over, probably time to go around them ^^; |
08:53:49 | skrylar | also i'm not sure about the rationals; are they substantively different from floats? |
08:55:19 | skrylar | (i know sometimes doing the 'more correct thing' by default can get your language dinged; ex. Pharo will actually treat 1/4 as a request for a Fraction object which gives you correct math but makes the math slow and then you have to explain to everyone who walks by how to get the faster math people *usually* want but i dunno if that applies here) |
08:55:47 | vegai | docker talk? |
08:55:58 | skrylar | earlier in chat |
08:55:59 | vegai | skrylar: yeah, they are |
08:56:10 | vegai | I'll get over it :) like I said, I just miss that default from the lisps |
08:56:35 | vegai | possibly lisps are the only ones who do that though |
08:57:02 | skrylar | no, squeak/pharo will do rationa/fractions if you divide integers and floats if you divide floats |
08:57:41 | vegai | at least nim doesn't do what python2 did by default :) |
08:57:44 | vegai | 1/2 => 0 |
08:57:52 | skrylar | i really do like (declaim) style blocks or dialecting (red, janet, vaguely Ring) for this kind of thing, but ... meh |
08:59:18 | skrylar | admittedly if you want to do macro legwork you can use the block parameter notation to have it intercept math and replace it with the more precise constructors |
08:59:48 | skrylar | well just the constants would have to be ast patched |
09:00:14 | skrylar | heading off for now though |
09:00:15 | * | skrylar quit (Quit: WeeChat 2.7) |
09:02:42 | * | marmotini_ quit (Remote host closed the connection) |
09:03:15 | * | marmotini_ joined #nim |
09:07:54 | * | marmotini_ quit (Ping timeout: 258 seconds) |
09:17:51 | * | LER0ever quit (Remote host closed the connection) |
09:18:16 | * | marmotini_ joined #nim |
09:20:31 | * | LER0ever joined #nim |
09:21:54 | * | marmotini_ quit (Remote host closed the connection) |
09:35:08 | FromDiscord_ | <clyybber> Araq: Regarding sup, the varargs[untyped] think doesn't work for block syntax |
09:35:24 | * | sigmapie8 quit (Quit: Leaving) |
09:39:51 | * | floppydh joined #nim |
09:42:18 | * | xd joined #nim |
09:42:37 | * | xd quit (Remote host closed the connection) |
09:54:48 | * | rokups joined #nim |
09:58:22 | * | couven92 joined #nim |
10:16:52 | * | Vladar quit (Remote host closed the connection) |
10:17:14 | * | Vladar joined #nim |
10:35:17 | * | couven92 quit (Read error: Connection reset by peer) |
10:35:43 | * | couven92 joined #nim |
11:05:01 | * | oculuxe joined #nim |
11:07:07 | * | oculux quit (Ping timeout: 240 seconds) |
11:08:02 | * | mipri joined #nim |
11:10:45 | FromDiscord_ | <sveri> Araq: Hi, I have been looking into adding attributes to htmlgen an it's indeed easy. I just wonder, data-* are attributes that are user defined, so, there is an endless stream of possible attributes and I don't think it makes sense to add them statically to the source code. |
11:10:45 | FromDiscord_ | <sveri> Is there a way to allow everything that starts with `data-`? |
11:11:08 | * | mipri left #nim (#nim) |
11:12:25 | FromDiscord_ | <sveri> Or should I create a bug report for this discussion? |
11:15:34 | * | endragor quit (Remote host closed the connection) |
11:16:35 | * | endragor joined #nim |
11:16:39 | * | gangstacat quit (Quit: Ĝis!) |
11:18:05 | * | chemist69 quit (Ping timeout: 272 seconds) |
11:18:33 | * | chemist69 joined #nim |
11:23:02 | * | gangstacat joined #nim |
12:02:36 | FromDiscord_ | <sveri> I created this bug report: https://github.com/nim-lang/Nim/issues/13444 |
12:02:38 | disbot | ➥ htmlgen does not support `data-*` attributes ; snippet at 12https://play.nim-lang.org/#ix=2cdc |
12:05:17 | * | glassofethanol joined #nim |
12:05:31 | * | glassofethanol quit (Client Quit) |
12:11:52 | * | rockcavera joined #nim |
12:13:02 | * | Kaivo joined #nim |
12:14:14 | * | rokups quit (Quit: Connection closed for inactivity) |
12:57:44 | * | nsf quit (Quit: WeeChat 2.7) |
13:10:01 | * | dddddd joined #nim |
13:10:20 | * | endragor quit (Remote host closed the connection) |
13:34:31 | * | solitudesf joined #nim |
13:36:16 | * | dadada joined #nim |
13:37:16 | dadada | choosenim devel , Downloading C Sources from GitHub, currently at 81mb and climbing, is this considered normal? |
13:39:53 | FromDiscord_ | <clyybber> I think so, yeah |
13:47:08 | * | xet7 quit (Remote host closed the connection) |
13:48:07 | * | Vladar quit (Quit: Leaving) |
13:48:20 | * | xet7 joined #nim |
13:51:03 | * | krux02 joined #nim |
13:58:55 | shashlick | dadada: latest choosenim will delete the folder after bootstrap to save you space |
14:11:17 | * | zickzackv joined #nim |
14:22:51 | * | nsf joined #nim |
14:27:04 | FromDiscord_ | <mratsim> Rust and most LLVM based project sit at 600+MB |
14:28:12 | * | hax-scramper quit (Ping timeout: 265 seconds) |
14:29:37 | * | hax-scramper joined #nim |
14:49:29 | * | lurker quit (Remote host closed the connection) |
14:53:22 | FromDiscord_ | <clyybber> tbf csources is a bit bloated |
14:53:27 | FromDiscord_ | <clyybber> and could be much smaller |
14:57:00 | * | glassofethanol joined #nim |
14:59:28 | dadada | there are deprecated code examples on the macros documentation page |
14:59:39 | narimiran | PRs welcome |
14:59:41 | dadada | this is the example: |
14:59:43 | dadada | var res = findChild(n, it.kind == nnkPostfix and it.basename.ident == toNimIdent"foo") |
14:59:49 | dadada | toNimIdent is deprecated |
15:00:13 | dadada | it.basename.ident probably also |
15:01:18 | dadada | this example belongs to the findChild template, which itself is not deprecated |
15:13:11 | * | glassofethanol quit (Ping timeout: 260 seconds) |
15:15:54 | * | hax-scramper quit (Ping timeout: 258 seconds) |
15:16:30 | * | hax-scramper joined #nim |
15:18:49 | * | nsf quit (Quit: WeeChat 2.7) |
15:20:35 | FromDiscord_ | <treeform> Elegant Beef, I tried using bgfx but I was not able to get it to work. It compiled and ran, but it would just render garbled screen. |
15:20:46 | FromDiscord_ | <treeform> @Elegant Beef, I tried using bgfx but I was not able to get it to work. It compiled and ran, but it would just render garbled screen. |
15:25:18 | * | ptdel joined #nim |
15:26:04 | FromDiscord_ | <exelotl> I was never able to compile it on windows with msys2/mingw64 |
15:31:48 | lqdev[m] | dadada: `toNimIdent` is deprecated, `ident` is not |
15:32:56 | * | glassofethanol joined #nim |
15:33:23 | dadada | lqdev[m]: https://nim-lang.org/docs/macros.html#ident%2CNimNode |
15:33:48 | dadada | there's a different ident which isn't deprecated, but the one I meant, seems to be |
15:34:19 | dadada | and the compiler agrees with me |
15:34:24 | FromDiscord_ | <Rika> yeah |
15:34:27 | FromDiscord_ | <Rika> string ident is ok |
15:34:31 | FromDiscord_ | <Rika> nimnode ident is not |
15:37:18 | * | gangstacat quit (Quit: Ĝis!) |
15:39:22 | * | gangstacat joined #nim |
15:44:28 | dadada | how would I make a macro for a special infix macro/operator? the arguments to a macro are not sufficient to do that, right? |
15:48:53 | FromGitter | <alehander92> what do you mean |
15:49:41 | dadada | alehander92: https://play.nim-lang.org/ |
15:50:03 | dadada | ah, I destroyed my example |
15:50:26 | * | glassofethanol quit (Ping timeout: 240 seconds) |
15:51:01 | * | glassofethanol joined #nim |
15:58:44 | FromGitter | <alehander92> noo |
16:02:11 | FromDiscord_ | <Rika> F |
16:05:41 | * | zedeus_ joined #nim |
16:08:48 | * | zedeus quit (Ping timeout: 258 seconds) |
16:24:29 | dadada | well, it's possible after all, I got confused |
16:24:40 | * | zedeus_ is now known as zedeus |
16:24:52 | dadada | does somebody know if the color scheme on play.nim-lang.org is available in vscode? |
16:26:41 | leorize | the color scheme is dracula iirc |
16:27:00 | * | solitudesf quit (Quit: Leaving) |
16:29:47 | * | leorize quit (Quit: WeeChat 2.6) |
16:30:03 | dadada | leorize[m]: ty |
16:45:52 | * | ng0 joined #nim |
17:02:06 | * | glassofethanol quit (Ping timeout: 240 seconds) |
17:03:06 | * | floppydh quit (Quit: WeeChat 2.7) |
17:06:12 | * | Trustable joined #nim |
17:07:01 | dadada | https://play.nim-lang.org/#ix=2ceG |
17:07:14 | dadada | want to make the above work without the global variable |
17:10:22 | shashlick | inject maybe |
17:11:01 | * | anakata joined #nim |
17:11:29 | anakata | hi all. Do you guys know how i can iterate over all keys / values for yaml? |
17:12:09 | disruptek | convention suggests pairs(). |
17:12:30 | disruptek | shashlick: don't hate my thumbs. |
17:14:16 | * | glassofethanol joined #nim |
17:17:36 | disruptek | pro-tip: if you hate stropping your identifiers in quote do:, try this one simple trick. |
17:17:53 | disruptek | template someid = ident"aRealIdentifier" |
17:18:04 | disruptek | then you can simply quote do: echo someid |
17:18:26 | * | marmotini_ joined #nim |
17:22:31 | disruptek | ah, nevermind. it's just gensym'ing in the background like a bastard. |
17:23:09 | disruptek | man i hate that. |
17:24:37 | disruptek | pmunch: you would make me so happy if you'd add a word-wrap button to toggle wrap on output panes. |
17:27:59 | * | zedeus_ joined #nim |
17:30:46 | * | zedeus quit (Ping timeout: 240 seconds) |
17:32:54 | * | anakata quit (Remote host closed the connection) |
17:34:33 | FromGitter | <Vindaar> @dadada https://play.nim-lang.org/#ix=2ceL |
17:41:07 | dadada | Vindaar: thank you ... I find your version also works without the block around it and it works without the intermediator it as well |
17:44:45 | dadada | Vindaar: only on play.nim-lang.org though |
17:45:57 | * | nsf joined #nim |
17:47:47 | dadada | ah, sry, stropping error |
17:48:23 | lqdev[m] | psst |
17:48:44 | lqdev[m] | people don't know this, but the `do` after `quote` is optional |
17:48:47 | lqdev[m] | and looks weird |
17:49:00 | dadada | good to know, thanks |
17:49:24 | disruptek | it's convention. |
17:49:33 | * | zahary joined #nim |
17:49:48 | * | abm joined #nim |
17:49:51 | lqdev[m] | syntactically, `x:` and `x do:` are both an nnkCall(ident"x", nnkStmtList(...)) |
17:51:03 | disruptek | i know which i grep for, though. |
17:51:51 | * | rockcavera quit (Remote host closed the connection) |
17:52:37 | * | zedeus joined #nim |
17:53:20 | FromGitter | <Vindaar> @dadada yes, it also works without the block, but then a second call of the macro will produce an error |
17:53:52 | * | zedeus__ joined #nim |
17:55:57 | * | zedeus_ quit (Ping timeout: 268 seconds) |
17:57:16 | * | zedeus quit (Ping timeout: 255 seconds) |
17:58:07 | * | zedeus joined #nim |
18:01:07 | * | zedeus__ quit (Ping timeout: 258 seconds) |
18:02:01 | rhenvar | Varriount: the library code is the example from right here: https://github.com/ba0f3/ngxcmod.nim |
18:02:16 | rhenvar | this works without issue outside of docker |
18:08:32 | * | ptdel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
18:11:02 | * | casaca joined #nim |
18:11:49 | * | kungtotte quit (Read error: Connection reset by peer) |
18:12:50 | * | kungtotte joined #nim |
18:17:55 | FromGitter | <nixfreakz_twitter> n00bie here -- so class in python is just a type in nim? |
18:18:18 | FromGitter | <nixfreakz_twitter> and *init*:self with python is just creating a new object with nim? |
18:21:28 | FromGitter | <zetashift> It's not really a class; type in Nim is more of a structure |
18:22:10 | FromGitter | <nixfreakz_twitter> I'm just looking at this .. https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers |
18:23:37 | FromGitter | <zetashift> it's close enough for beginning learning Nim |
18:23:50 | FromGitter | <zetashift> but this post helped me out a lot more understanding types https://peterme.net/nim-types-originally-a-reddit-reply.html |
18:27:21 | FromGitter | <nixfreakz_twitter> awesome thanks |
18:30:37 | * | Jesin quit (Quit: Leaving) |
18:32:57 | * | Jesin joined #nim |
18:38:47 | * | solitudesf joined #nim |
18:41:19 | FromGitter | <nixfreakz_twitter> Thats a good read |
18:56:16 | disruptek | nice: https://blurha.sh/ https://github.com/woltapp/blurhash |
19:06:54 | dadada | Vindaar: hmm, I tried a second call of the macro, without the block, and there's no error, what am I doing wrong here? |
19:08:03 | * | rhenvar quit (Ping timeout: 240 seconds) |
19:13:26 | * | glassofethanol quit (Ping timeout: 240 seconds) |
19:17:43 | * | glassofethanol joined #nim |
19:24:21 | * | zedeus_ joined #nim |
19:27:06 | * | zedeus quit (Ping timeout: 240 seconds) |
19:27:37 | * | zedeus joined #nim |
19:30:55 | * | zedeus_ quit (Ping timeout: 268 seconds) |
19:31:56 | * | ptdel joined #nim |
19:34:28 | * | opal quit (Remote host closed the connection) |
19:37:05 | * | rockcavera joined #nim |
19:41:50 | FromGitter | <Vindaar> ehh, no idea. With my macro? I would have guessed it should trigger a "redeclared identifier" error, because the `var n` I declare will be declared again (assuming you call the macro in the same scope again) |
19:42:30 | * | opal joined #nim |
19:43:58 | FromGitter | <erhlee-bird> is there a way to write an anonymous proc type that doesn't have an output type? ⏎ e.g. `proc test(hook: (string) -> nil)` |
19:44:00 | * | sigmapie8 joined #nim |
19:49:21 | disruptek | proc test(hook: string) = ... |
19:50:37 | FromGitter | <erhlee-bird> Had omitted, but there are other arguments. I'm trying to pass in a callback function that doesn't have a return value |
19:53:02 | * | nsf quit (Quit: WeeChat 2.7) |
19:53:35 | FromGitter | <erhlee-bird> I want to express `proc test(arg1: string, hook: proc(string))`, but it doesn't seem like I can do this without providing a return type for the anonymous function |
19:54:03 | * | Jesin quit (Quit: Leaving) |
19:54:34 | FromGitter | <erhlee-bird> It works fine if I change it to `template test(arg1: string, hook: untyped)` but I think I lose some type safety with this workaround |
19:57:21 | * | Jesin joined #nim |
19:58:13 | Araq | the syntax to use is proc test(arg1: string, hook: proc(string)) |
20:00:54 | Araq | and no, you don't "lose" type safety via templates, the code is still checked, albeit after template instantiation |
20:02:03 | FromGitter | <erhlee-bird> Gotcha |
20:02:49 | FromGitter | <erhlee-bird> This is a contrived full example that doesn't compile. Is this something you'd expect to work that I should make an issue for? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e4ee5e88e726c7dc5b8c893] |
20:03:15 | FromGitter | <erhlee-bird> I'm running with Nim 1.0.4 |
20:04:48 | * | rhenvar joined #nim |
20:08:31 | * | hax-scramper quit (Read error: Connection reset by peer) |
20:08:47 | * | hax-scramper joined #nim |
20:09:54 | * | rhenvar1 joined #nim |
20:10:23 | rhenvar1 | also sorry if I missed anything Varriount, just switched networks. Working on ZNC |
20:11:37 | * | rhenvar quit (Ping timeout: 268 seconds) |
20:11:50 | * | rhenvar1 is now known as rhenvar |
20:22:43 | * | glassofethanol quit (Ping timeout: 268 seconds) |
20:27:14 | FromGitter | <alehander92> huh i didnt know |
20:27:21 | FromGitter | <alehander92> you can do proc(string) |
20:27:28 | FromGitter | <alehander92> i thought you can only proc(a: string) |
20:29:06 | FromGitter | <erhlee-bird> actually adding the `a: string` makes it work |
20:29:10 | FromGitter | <erhlee-bird> thanks @alehander92 |
20:30:26 | FromGitter | <alehander92> ah ok |
20:30:33 | FromGitter | <alehander92> yeah i guess the other syntax is not supported |
20:31:00 | * | marmotini_ quit (Remote host closed the connection) |
20:31:28 | FromDiscord_ | <clyybber> Yeah, because of f(a = "hey") |
20:31:36 | * | marmotini_ joined #nim |
20:32:07 | FromGitter | <alehander92> but as a type, what is the ambiguity |
20:32:23 | FromGitter | <alehander92> ah |
20:32:23 | FromDiscord_ | <clyybber> because you wouldn't be able to call hook this way then |
20:32:37 | FromGitter | <alehander92> but sometimes i want people to not be able to do it |
20:32:43 | FromGitter | <alehander92> just to pass a predicate on string |
20:32:45 | FromGitter | <alehander92> or something |
20:33:25 | disruptek | wait, what? |
20:33:41 | disruptek | you want to deny named param use? |
20:34:05 | FromDiscord_ | <clyybber> insanity to me, insanity for you |
20:34:21 | FromDiscord_ | <clyybber> nah, but seriously, I don't think its a good idea to deny that |
20:34:32 | FromGitter | <alehander92> no no |
20:34:35 | FromGitter | <alehander92> i use that a lot |
20:34:38 | FromDiscord_ | <clyybber> and by all means not by passing it through an indirection |
20:34:47 | FromGitter | <alehander92> i meant when i have a *parameter* func |
20:34:55 | FromGitter | <alehander92> i usually dont care for *its* param name |
20:35:10 | disruptek | oh, right. |
20:35:12 | FromGitter | <alehander92> because i can pass funcs with all kinds of param name |
20:35:46 | * | marmotini_ quit (Ping timeout: 240 seconds) |
20:42:40 | * | letto quit (Quit: Konversation terminated!) |
20:43:26 | * | LER0ever quit (Ping timeout: 240 seconds) |
20:44:09 | * | LER0ever joined #nim |
20:44:38 | * | letto joined #nim |
20:55:32 | * | abm quit (Quit: Leaving) |
21:08:12 | * | sigmapie8 quit (Quit: Leaving) |
21:14:32 | * | solitudesf quit (Remote host closed the connection) |
21:17:33 | dadada | can I define a macro so that it will only work inside a specific other macro? |
21:19:00 | FromGitter | <alehander92> yes |
21:19:10 | FromGitter | <alehander92> you can define a compile time variable with initial value |
21:19:10 | dadada | let's say a macro named myFor can contain myContinue statements, and those statements are also implemented with macros, but I don't want myContinue to be allowed outside of myFor |
21:19:19 | FromGitter | <alehander92> which changes only inside the other macro |
21:19:26 | FromGitter | <alehander92> around internal invocations |
21:19:56 | FromGitter | <alehander92> so myContinue would check this compile time variable value |
21:20:54 | * | leorize joined #nim |
21:21:30 | dadada | but that doesn't prevent name conflicts, right? Say there's a function which coindicidentally is also named myContinue |
21:21:49 | dadada | outside of myFor I'd like the myContinue function to be called |
21:21:55 | FromGitter | <alehander92> well this is about overloading |
21:22:01 | * | zickzackv quit (Ping timeout: 255 seconds) |
21:22:09 | FromGitter | <alehander92> if it sig matches first |
21:22:13 | FromGitter | <alehander92> it would be called indeed |
21:22:18 | dadada | inside of myFor I'd like the macro to be executed at compile time/but not outside |
21:22:18 | FromGitter | <alehander92> ah, i see |
21:22:47 | FromGitter | <alehander92> you can then just define myContinue inside the expanded code of myFor |
21:22:56 | FromGitter | <alehander92> something like what is supposed to happen for await in async |
21:23:35 | FromGitter | <alehander92> e.g. template myContinue: untyped = myContinueMacro(..) |
21:24:32 | leorize | use gensym |
21:24:45 | leorize | it will generate an unique symbol for you that won't match anything else |
21:25:04 | leorize | you will need to pass the symbol node to whatever that you want to grant access to |
21:25:57 | FromGitter | <alehander92> but he still wants to match myContinue ? |
21:26:29 | FromGitter | <nixfreakz_twitter> Is anyone porting python3 scripts to nim ? |
21:26:54 | disruptek | why not just have the outer macro impl the inner behavior? |
21:27:13 | FromGitter | <alehander92> i still think its the same as async/await |
21:30:25 | * | narimiran quit (Ping timeout: 258 seconds) |
21:31:50 | dadada | disruptek: the outer macro would then need to iterate through every contained statement/substatement, which could get somewhat complex, it seems much easier to delegate the task of replacing the code to a template/macro |
21:32:10 | disruptek | what do you think the difference is? |
21:32:49 | * | zahary quit (Quit: Leaving.) |
21:33:08 | dadada | that the code gets easier to read/write for me is my hope here |
21:33:19 | dadada | read/write/maintain |
21:39:26 | * | hoijui quit (Ping timeout: 240 seconds) |
21:41:59 | * | leorize quit (Remote host closed the connection) |
21:42:40 | * | leorize joined #nim |
21:44:01 | * | lurker148257 quit (Remote host closed the connection) |
21:44:05 | dadada | managed to do it :D |
21:46:21 | * | Trustable quit (Remote host closed the connection) |
21:47:41 | disruptek | nice. |
21:50:58 | * | uvegbot joined #nim |
21:51:31 | * | zahary joined #nim |
21:52:03 | * | sagax quit (Ping timeout: 272 seconds) |
21:53:08 | * | zyklon quit (Ping timeout: 248 seconds) |
21:56:25 | * | lritter quit (Quit: Leaving) |
21:59:50 | * | Jesin quit (Quit: Leaving) |
22:03:30 | * | Jesin joined #nim |
22:06:33 | FromGitter | <Varriount> dadada: Welcome to the world of macros. It's like the world of turtles, but everything is a tree structure |
22:08:21 | * | Jesin quit (Remote host closed the connection) |
22:36:26 | * | jjido joined #nim |
22:36:32 | * | rhenvar quit (Ping timeout: 268 seconds) |
22:50:39 | * | krux02 quit (Remote host closed the connection) |
22:52:58 | Araq | scope based destruction is beginning to work |
22:53:20 | * | NimBot joined #nim |
22:53:22 | Araq | and I found out why my async cycle workaround doesn't work |
22:53:32 | Araq | it never did work. surprise! |
22:55:20 | FromDiscord_ | <clyybber> lol |
22:55:25 | * | ptdel quit (Ping timeout: 240 seconds) |
22:56:06 | * | ptdel joined #nim |
23:00:45 | disruptek | you said that temporaries are lifted and destroyed; does this mean that top-level loop vars get re-init'd correctly now? or is that basically a vm problem? |
23:01:13 | zedeus | Araq: have you seen this? http://gallium.inria.fr/blog/incremental-cycle-detection/ |
23:01:30 | FromDiscord_ | <clyybber> disruptek: Its just a VM problem AFAIK |
23:04:46 | Araq | zedeus: no, interesting, thanks. not sure if it applies to GCs directly |
23:07:02 | FromDiscord_ | <clyybber> it applies to gc:orc maybe? |
23:07:47 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:11:08 | dadada | is there a generalized way in nim to check for emptiness that works for strings/lists/sequences and all other types that can logically be empty? |
23:11:23 | dadada | would len == 0 always work like in go? |
23:11:36 | disruptek | == to default(T)? |
23:11:47 | FromDiscord_ | <Recruit_main70007> I was gonna say that, haven’t tried it though |
23:12:03 | leorize | len == 0 is the way |
23:12:05 | disruptek | len will work for those types, yes. |
23:12:14 | disruptek | but for arbitrary types... |
23:13:41 | disruptek | i guess technically, you could have a type which defaults to some concept of "un-empty", from alloc0. so i guess there's no generic emptiness concept. impl len on your types. |
23:14:11 | Araq | zedeus: it doesn't apply |
23:14:23 | Araq | it does detect cycles, but not in a GC setting |
23:14:52 | Araq | and the trick with the pseudo-topological numbering is known to me |
23:15:14 | zedeus | ah ok, it didn't mention garbage collection but I figured it was interesting enough to share |
23:15:22 | Araq | I mean, ok, ok you could use it for a GC |
23:15:31 | Araq | but it's worse than my stuff |
23:16:29 | FromDiscord_ | <clyybber> Araq: Is orc still buggy or is it working now? |
23:16:55 | Araq | dunno, too busy with arc |
23:17:06 | Araq | but if it works, I know how to make it fast |
23:17:25 | Araq | and if it doesn't, I know other algorithms that do work |
23:18:08 | Araq | but it remains in conflict with "deterministic" destruction |
23:21:46 | disruptek | the current approach is in conflict? |
23:21:53 | disruptek | or other approaches? |
23:22:56 | * | rhenvar joined #nim |
23:24:24 | * | ptdel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
23:25:57 | FromDiscord_ | <treeform> Is there a way to cast a seq without copying it? I though casting would do no copy... but it does: https://play.nim-lang.org/#ix=2cgr |
23:27:42 | leorize | take the address of it |
23:28:02 | leorize | you can't magically alias via casting :P that'd be too wrong |
23:29:06 | leorize | and no, the cast didn't copy, the thing that was copied was the resulting seq from the cast |
23:29:35 | FromDiscord_ | <treeform> I tried `var b = cast[ptr seq[uint64]](addr a)[]` |
23:29:40 | FromDiscord_ | <treeform> still same thing? |
23:29:52 | leorize | `=` copies the seq to the result |
23:30:00 | leorize | that's the part that copied |
23:30:09 | leorize | cast don't do any copying |
23:30:48 | FromDiscord_ | <treeform> I just want to operating on ints (which are int64) like they are uint64... |
23:31:53 | FromDiscord_ | <treeform> ok I think I got it to work: https://play.nim-lang.org/#ix=2cgu |
23:32:21 | FromDiscord_ | <treeform> I see now as soon as I do c = b[] it copies |
23:33:09 | FromDiscord_ | <clyybber> copies *what* though? |
23:33:35 | FromDiscord_ | <clyybber> it doesn't deepcopy, unless you are on --gc:arc and its not a last read |
23:35:37 | * | azed joined #nim |
23:37:08 | FromDiscord_ | <treeform> the elements of the array |
23:48:45 | dadada | why do expressions of type string ("""manylines""") have to be discarded ... they could be a convenient way of uncommenting code for dev purposes |
23:48:53 | dadada | like ''' in python |
23:49:05 | dadada | sure Nim is not python, I know that ... |
23:50:08 | shashlick | #[ |
23:50:23 | dadada | I know... this one is inconvient to type on my keyboard |
23:51:07 | FromDiscord_ | <Recruit_main70007> That’s a shame, but I don’t think they are changing it |
23:52:47 | shashlick | What editor |
23:53:00 | dadada | vscode |
23:53:10 | dadada | new to it though |
23:54:15 | FromDiscord_ | <Recruit_main70007> Personally, I really like it |
23:54:26 | disruptek | when false: is a better convention for commenting out code, i think. better than #[ ]#, anyway. |