00:27:10 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
00:27:29 | * | njoseph joined #nim |
00:56:51 | * | D_ quit (Ping timeout: 250 seconds) |
01:47:33 | * | rockcavera quit (Read error: Connection reset by peer) |
01:48:02 | * | rockcavera joined #nim |
02:07:28 | * | D_ joined #nim |
02:48:01 | * | thomasross quit (Ping timeout: 260 seconds) |
03:01:45 | * | j-james[m] left #nim ("User left") |
03:44:25 | * | spiderstew_ joined #nim |
03:46:41 | * | spiderstew quit (Ping timeout: 240 seconds) |
03:54:21 | * | oprypin quit (Remote host closed the connection) |
03:56:18 | * | FromGitter quit (Remote host closed the connection) |
03:56:39 | * | FromGitter joined #nim |
03:57:42 | * | oprypin joined #nim |
04:01:56 | Benjamin[m]1 | I noticed xmldom was removed from stdlib in 2018 in favor of xmltree, but as far as I can tell, functions such as nextSibling were never added to xmltree. Am I missing something? |
04:21:08 | * | rockcavera quit (Remote host closed the connection) |
04:22:05 | FromDiscord | <creonico> Weird question, can I write smart contracts in Ethereum with Nim? |
04:22:27 | * | narimiran joined #nim |
04:29:03 | FromDiscord | <Rika> I don’t see why not |
04:29:22 | FromDiscord | <creonico> I can? |
04:29:37 | FromDiscord | <creonico> I though you could only use Solidity or Viper |
04:46:35 | FromDiscord | <Rika> I don’t understand the question well |
04:46:59 | FromDiscord | <Rika> Ah |
04:47:08 | FromDiscord | <Rika> In the VM |
04:47:21 | FromDiscord | <Rika> Not sure, do you have a C compiler for the VM? |
04:55:17 | ForumUpdaterBot | New thread by Nnahito: How to use SharedList, see https://forum.nim-lang.org/t/7927 |
05:53:14 | * | blitzworksD1337d joined #nim |
06:24:18 | * | PMunch joined #nim |
06:46:30 | ForumUpdaterBot | New Nimble package! stb_truetype - Nim bindings for stb_truetype., see https://github.com/guzba/stb_truetype |
06:59:06 | * | narimiran quit (Ping timeout: 240 seconds) |
07:02:48 | * | narimiran joined #nim |
07:08:41 | * | narimiran quit (Ping timeout: 240 seconds) |
07:09:33 | * | NimBot joined #nim |
07:12:38 | * | narimiran joined #nim |
07:33:03 | * | kayabaNerve joined #nim |
07:34:32 | kayabaNerve | Is it possible to have a Nimble file only require a dependency when not compiled with a specific definition? |
07:35:23 | kayabaNerve | As in, I have a nogui define configured (so `nimble build -d:nogui`), and I only want to require a dependency of the GUI lib when compiled with `nimble build`; not `nimble build -d:nogui` |
07:35:41 | kayabaNerve | I did try `when not defined(nogui):`; seems to have had no effect |
07:35:50 | kayabaNerve | My guess is requires are pre processed in some form? |
07:37:17 | FromDiscord | <Rika> the nimble file does not dictate what is importable in your library, only what is installed alongside your library |
07:38:14 | FromDiscord | <haxscramper> Also `-d:nogui` is passed to compiler, not nimble itself IIRC |
07:44:11 | kayabaNerve | Yeah, I got that latter part. I'm trying to figure out if it's possible to dynamically use the requires statement. |
07:44:43 | * | crem quit (Ping timeout: 260 seconds) |
07:45:17 | * | crem joined #nim |
07:45:52 | kayabaNerve | According to the docs, it looks like I can move requires into a task; question becomes getting the command from Nimscript. |
07:46:14 | kayabaNerve | Also, there are rules on passing to compiler; doesn't Nimble have a depsOnly flag? |
07:46:25 | kayabaNerve | Like it is possible to pass a flag to it post-"build" |
07:50:05 | kayabaNerve | ... does `nimble build` no longer execute the build task if defined? |
07:51:34 | FromDiscord | <vieru> the fuck |
07:51:43 | FromDiscord | <vieru> i cant even download nim |
07:51:48 | FromDiscord | <vieru> windows defender |
07:52:01 | PMunch | Wow, really? |
07:52:11 | FromDiscord | <vieru> yeah |
07:52:16 | FromDiscord | <ElegantBeef> Yep 1.4.6 triggers defender |
07:52:20 | FromDiscord | <vieru> and ive allowed it like 10times |
07:52:23 | FromDiscord | <ElegantBeef> 1.4.4 before does not |
07:52:51 | PMunch | I thought you would be able to download it, just not run it |
07:53:43 | FromDiscord | <ElegantBeef> All cause of a single malware we get the joys of software being marked as a virus |
07:54:40 | FromDiscord | <ElegantBeef> You guys think the malware was published in debug, release or danger? |
07:55:19 | FromDiscord | <vieru> https://media.discordapp.net/attachments/371759389889003532/839409908650213386/20210505_105338.jpg |
07:55:55 | FromDiscord | <haxscramper> I think they used `-d:degenerate` when building their garbage |
07:56:08 | FromDiscord | <vieru> what malware ? |
07:56:30 | FromDiscord | <ElegantBeef> nimzbaloader or w/e it's called |
07:56:37 | FromDiscord | <ElegantBeef> Vieru follow this https://github.com/dom96/choosenim#installation |
07:56:55 | FromDiscord | <ElegantBeef> It's a better way to get Nim anyway |
07:57:33 | FromDiscord | <vieru> thanks |
07:57:59 | FromDiscord | <ElegantBeef> Sucks that antiviruses are too dumb to actually reason if it's a threat or not, and just do a lazy method of "does it have X" |
07:58:29 | * | Vladar joined #nim |
08:06:38 | PMunch | Have anyone raised tickets with the popular antivirus vendors by the way? |
08:08:54 | FromDiscord | <ElegantBeef> Uncertain, feel like the response would be "sucks to suck" |
08:09:08 | FromDiscord | <Rika> well try it |
08:16:18 | * | vicfred quit (Quit: Leaving) |
08:25:24 | FromDiscord | <FireWire> windows defender security threat page thing -> scroll and find "Virus and threat protection settings" -> click "Manage settings" -> scroll to the bottom and click on "Add or remove exclusions" -> add the .nimble folder as an exclusion |
08:29:14 | FromDiscord | <FireWire> also is there any way to sort of load and/or compile at runtime? |
08:29:26 | FromDiscord | <FireWire> sort of like how python has cogs and stuff |
08:30:02 | FromDiscord | <ElegantBeef> You can use Nimscript or dynamic loaded libraries |
08:30:18 | FromDiscord | <FireWire> hmm ok ill look into it |
08:30:19 | FromDiscord | <FireWire> thx! |
08:31:32 | FromDiscord | <ElegantBeef> My nimscripter library is probably the easiest way to see/play with nimscript from compiled nim https://github.com/beef331/nimscripter |
09:06:36 | * | Gustavo6046 quit (Ping timeout: 260 seconds) |
09:19:23 | PMunch | Hmm, how can I add -lwhatever for my C wrapped functions? |
09:29:42 | * | wasted_youth2 quit (Quit: Leaving) |
09:30:24 | FromDiscord | <dabmlfz> Is there a way to take a parameter through "reference" or so that it's not copied? `var` works but I don't want to mark my parameter as mutable(or is that okay?). `ptr` seems unidiomatic. |
09:30:47 | FromDiscord | <Tavon> ref |
09:31:03 | FromDiscord | <ElegantBeef> If the object is large enough it's copied as a reference, so if you're worried about memory consumption dont be |
09:31:11 | FromDiscord | <dabmlfz> oh |
09:31:29 | FromDiscord | <ElegantBeef> i mean passed as a reference |
09:31:44 | FromDiscord | <dabmlfz> thanks, yeah that is what I was worried about. |
09:46:42 | FromDiscord | <madman> @ElegantBeef do you code nimscript in VS Code? |
09:46:51 | FromDiscord | <madman> that's a nice library |
10:00:54 | * | clyybber joined #nim |
10:04:22 | Clonkk[m] | <PMunch "Hmm, how can I add -lwhatever fo"> {.passL: "-lwhatever".} ? |
10:04:36 | PMunch | It didn't seem to work.. |
10:05:08 | PMunch | Ah, never mind |
10:05:11 | Clonkk[m] | You may need the additionnal {.passL: "-Wl,-rpath," & pathToLib .} |
10:05:18 | PMunch | I just couldn't have it as one of my pushes |
10:05:22 | Clonkk[m] | And {.passL: "-L" & pathToLib.} |
10:05:36 | Clonkk[m] | Never tried to use it as Push |
10:07:30 | PMunch | Okay, next question. What is the "correct" way of wrapping a low level library and then adding some abstractions |
10:11:28 | PMunch | I've seen people do this in different ways |
10:12:16 | FromDiscord | <haxscramper> Depends on the library of course, but I often start with defining convenience primitives like `items/[]`, sane enum names and `initT`/`newT` |
10:12:42 | FromDiscord | <haxscramper> This is not exactly an abstraction |
10:12:45 | PMunch | I was more thinking structure |
10:14:08 | FromDiscord | <haxscramper> I don't think there is a conclusive answer to that - depends on the library too much. |
10:14:47 | FromDiscord | <haxscramper> Sometimes I write code as if I already had all abstraction primitives/ergonomics, and then implement boilerplate mapping between low-level code and high-level wrappers |
10:15:30 | FromDiscord | <haxscramper> So top-down approach if you could say. And that helps me figure out the "structure" |
10:18:43 | Clonkk[m] | <PMunch "Okay, next question. What is the"> The way I do it is try to contain all the ``importc`` to a single folder and create a higher leve lAPI above |
10:19:25 | PMunch | Yeah that's what I was thinking |
10:19:31 | Clonkk[m] | For global initialization, there is a neat trick using ``proc init(x: type MyLib)`` |
10:21:36 | Clonkk[m] | You can look for examples : https://github.com/Clonkk/nimjl/blob/devel/nimjl/interop.nim#L17. Otherwise, here are some wrapper of C or C++ lib / header : |
10:21:36 | Clonkk[m] | https://github.com/SciNim/flambeau, https://github.com/Clonkk/nim-cppstl, https://github.com/SciNim/nimfftw3 |
10:22:12 | Clonkk[m] | The ZMQ wrapper is also a good example https://github.com/nim-lang/nim-zmq |
10:30:53 | PMunch | So you'd call it as e.g. Julia.init()? |
10:31:57 | PMunch | I did something similar for my keyboard firmware, but that was mostly to support future extensions to boards with more than one I2C port for example (so now I have I2C.init(), but for other boards it could be I2C_1.init()) |
10:35:02 | Clonkk[m] | Yep |
10:36:04 | Clonkk[m] | The idea is to have exactly that ``Julia.init()`` or ``init(Julia)`` it's cleaner IMO |
10:36:31 | PMunch | Doesn't really apply here though since I don't have an init |
10:37:05 | PMunch | For reference this is what I'm wrapping: https://github.com/gtoubassi/femtozip/blob/master/cpp/libfz/src/femtozip.h |
10:40:55 | * | lritter_ joined #nim |
10:50:21 | * | lritter_ quit (Remote host closed the connection) |
10:50:59 | giaco | this thing that testament builds next to nim file and you can't change this is making me revert to unittest |
10:56:43 | giaco | I feel that testament is fit for the compiler project and is not made to bend to other projects |
10:57:13 | giaco | just consider that if you set --outdir switch, it wont work |
11:02:14 | ForumUpdaterBot | New thread by Alexeypetrushin: How to make HttpServer more robust against too many connection opened?, see https://forum.nim-lang.org/t/7929 |
11:22:50 | PMunch | Hmm, a range check in my code generates invalid C code |
11:22:52 | PMunch | Very strange |
11:27:12 | PMunch | http://ix.io/3lPX |
11:27:30 | PMunch | The openarray version of buildModel |
11:27:48 | PMunch | Works with -d:danger because it removes the range check |
11:28:18 | PMunch | This is the exact error: http://ix.io/3lPY |
11:28:56 | FromDiscord | <zidsal> @giaco testament is great for testing that your macro produces a compile error (if you are expecting it to) I've yet to find another way to write that kind of test |
11:54:07 | * | xet7 quit (Read error: Connection reset by peer) |
11:59:21 | PMunch | Can I disable certain checks for parts of the code? |
12:00:58 | FromDiscord | <Stuffe> what do these brackets mean? <seq[string]> |
12:01:09 | FromDiscord | <Stuffe> im getting an error with <seq[string]> vs seq[string] |
12:02:45 | Amun_Ra | PMunch: you can f.e. {.push checks: off.} / {.pop.} |
12:04:16 | PMunch | Yeah I figured it out. I was putting it inside the proc, but I had to move it outside |
12:06:47 | * | PMunch quit (Quit: leaving) |
13:00:05 | FromDiscord | <dain> is it possible to examine external files at compile-time? |
13:01:09 | FromDiscord | <dain> for example, a dataframe library that at compile time, looks at a csv file to determine the types of the columns, and then auto-generate a schema. so you don't have to write it yourself |
13:03:00 | FromDiscord | <Rika> I'm pretty sure that's possible, just not using open |
13:03:09 | FromDiscord | <Rika> You have to use static read or something I forget the name |
13:03:28 | FromDiscord | <Rika> Unless within a macro, then I believe open will work |
13:14:17 | FromDiscord | <zidsal> @dain I did exactly this with generating types from a castledb file |
13:16:06 | FromDiscord | <zidsal> @dain my prototype for this can be found here https://play.nim-lang.org/#ix=3lQA I never bothered to clean the code up but you should get the idea on how to do this |
13:23:16 | FromDiscord | <haxscramper> https://nim-lang.org/docs/system.html#staticRead%2Cstring |
13:23:44 | * | rockcavera joined #nim |
13:23:55 | FromDiscord | <dain> In reply to @zidsal "<@225449938258100225> my prototype for": neato, thanks |
13:27:15 | * | vsantana joined #nim |
13:27:59 | FromDiscord | <dain> sent a long message, see http://ix.io/3lQE |
13:28:29 | FromDiscord | <dain> e.g. say you had a big file but you can just do the processing on it a line at a time |
13:29:24 | FromDiscord | <dain> or just look at the first N bytes |
13:30:06 | FromDiscord | <dain> or the first N lines |
13:34:46 | FromDiscord | <haxscramper> No, I don't think there is any way to read file line-by-line at compile-time |
13:35:01 | FromDiscord | <haxscramper> Though if you are reading multi-gigabyte files at compile-time ... |
13:35:44 | FromDiscord | <dain> well more like just looking at the first thousand or so lines of a csv |
13:36:40 | FromDiscord | <haxscramper> Streams are not accessible at compile-time, but if you really want you can `head -n1000` your file or something like taht |
13:36:44 | FromDiscord | <haxscramper> (edit) "taht" => "that" |
13:36:59 | FromDiscord | <haxscramper> Or write codegen script and `exec` it at compile-time |
13:37:15 | FromDiscord | <dain> hm yeah that would make sense |
13:37:17 | FromDiscord | <haxscramper> https://nim-lang.org/docs/system.html#staticExec,string,string,string |
13:37:21 | FromDiscord | <dain> just use staticexec |
13:38:31 | FromDiscord | <dain> I was reading about how the Nim REPL would have hot code reloading, is this actually implemented? |
13:39:18 | FromDiscord | <haxscramper> HCR was implemented several years go, but I don't think `inim` REPL has it, and it is not widely used anyway (HCR) |
13:39:35 | FromDiscord | <dain> what about `nim secret` |
13:39:36 | FromDiscord | <haxscramper> `nim secret` executes in VM, so it of course does not have access to HCR |
13:39:38 | FromDiscord | <dain> or is that the same |
13:39:41 | FromDiscord | <dain> o |
13:41:09 | FromDiscord | <dain> so nim isnt really usable as a live data science environment yet, like ipython or jupyter |
13:41:11 | FromDiscord | <dain> ? |
13:42:03 | FromDiscord | <haxscramper> well, I would not say it is "not usable", more like there was no explicit effort to make it work for this use case |
13:42:04 | FromDiscord | <haxscramper> https://github.com/stisa/jupyternim |
13:42:51 | FromDiscord | <haxscramper> But `nimscript` has the capability, the only thing lacking is an easy way to interface with compiled C code, though https://github.com/beef331/nimscripter can be used for that |
13:43:12 | FromDiscord | <haxscramper> So you evaluate dynamic nimscript that is powered by compiled nim code |
13:44:08 | FromDiscord | <haxscramper> Similar to python+C pair, though everything is written in one language. At least in theory this is possible, and does not require some major reengineering effort in the language implementation side |
13:45:47 | stisa | Just wanted to add that jupyternim does have some initial support for hotcodereloading, but it had a bug with printing floats that made me stop working on it for the time being |
13:46:59 | stisa | Tbh I should find some time to do some maintenance on the code and see if it improved in the last few months |
13:50:49 | FromDiscord | <dain> I'll have to play around with these things then :) |
14:01:36 | * | kwilczynski quit () |
14:10:07 | * | whitefly quit (Remote host closed the connection) |
14:36:58 | * | kwilczynski joined #nim |
14:40:22 | * | kwilczynski left #nim (#nim) |
15:51:07 | Clonkk[m] | Has anyone used Nim to create RPM / Deb package before ? |
15:59:58 | FromDiscord | <Hi02Hi> In reply to @creonico "Weird question, can I": Something like this?↵https://github.com/status-im/nim-eth-contracts |
16:02:55 | FromDiscord | <creonico> thats cool, thank you |
16:06:32 | * | Gustavo6046 joined #nim |
16:08:59 | FromDiscord | <dain> are there any benchmarks that compare nimscript to other scripting languages |
16:09:03 | FromDiscord | <dain> like bash or python or ruby or something |
16:09:17 | FromDiscord | <dain> how fast is it? |
16:09:54 | FromDiscord | <haxscramper> No, but nimscript is comparable to python in speed IIRC. VM optimization is not a main priority, so it might generally be slower than let's say python |
16:09:59 | FromDiscord | <haxscramper> In some cases |
16:10:43 | FromDiscord | <haxscramper> But it is a register-based VM for statically typed language, so it might have a speed advantage because of that, in some workloads |
16:15:14 | Clonkk[m] | If performance is an important factor, I wouldn't use Nimscript anyway. It wasn't designed for high performance computing |
16:18:24 | * | Gustavo6046_ joined #nim |
16:18:31 | * | Gustavo6046 quit (Ping timeout: 260 seconds) |
16:20:30 | * | Gustavo6046_ is now known as Gustavo6046 |
16:27:21 | * | fredrikhr joined #nim |
16:50:18 | * | vicfred joined #nim |
16:58:08 | FromDiscord | <jtiai> I'm using fusion/btreetables. If I know one position in table can I get like 10 previous and 10 next by some means? |
17:15:49 | FromDiscord | <exelotl> in my experience the VM has a startup time of a second or so to load the necessary parts of the standard library, which is a little painful for using it to run standalone scripts :( |
17:16:21 | FromDiscord | <exelotl> I had a setup which was: nim build (config.nims) <-> helper program <-> nim e data.nim |
17:16:40 | FromDiscord | <exelotl> where the output of running `nim e` would be piped back to the helper program |
17:18:05 | FromDiscord | <exelotl> But the execution time for `nim e` was too much.↵So I ended up instead processing `data.nim` from inside `config.nims`, marshalling the data to a csv file, and then reading the csv from the helper program. |
17:19:43 | FromDiscord | <exelotl> the savings from only having to start the VM once, far outweighed the cost of writing to a file and then reading that file back. :P |
17:23:04 | * | asdflkj quit (Ping timeout: 258 seconds) |
17:25:15 | * | asdflkj joined #nim |
17:31:04 | * | Vladar quit (Remote host closed the connection) |
17:34:41 | * | filcuc joined #nim |
17:36:15 | * | rockcavera quit (Read error: Connection reset by peer) |
17:36:44 | * | rockcavera joined #nim |
17:40:27 | * | icebattle quit (Quit: leaving) |
17:43:16 | * | icebattle joined #nim |
17:48:08 | * | PMunch joined #nim |
17:48:24 | FromDiscord | <haxscramper> It is possible to implement `nim secret` in your application too - https://github.com/haxscramper/hack/blob/master/testing/nim/compilerapi/test6.nim#L79, it does not suffer from startup costs when evaluating new code |
17:50:23 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3lSj |
17:54:13 | FromDiscord | <haxscramper> are you sure you want to have 2^32 elements in array? Most likely this is compiler crash because of that |
17:54:22 | FromDiscord | <haxscramper> That wasn't turned into proper error message |
17:54:23 | * | al1ranger joined #nim |
17:55:29 | * | al1ranger quit (Client Quit) |
17:57:36 | FromDiscord | <jtiai> Definitely 🙂 |
18:02:16 | * | filcuc quit (Ping timeout: 252 seconds) |
18:08:58 | FromDiscord | <neow> 2^32 elements only sounds like a few MBs |
18:11:53 | FromDiscord | <haxscramper> That is 4 GB even if it was an array of `char` |
18:13:13 | PMunch | With a concept that names some procedures to do stuff, how can I get those procedures in a proc that takes that concept to pass them as callbacks? |
18:17:36 | FromDiscord | <jtiai> I just need 64k entries. |
18:18:56 | FromDiscord | <jtiai> Actually.... I need only 21... |
18:22:43 | FromDiscord | <jtiai> Now back to my previous question. Given that I know only one key in btreetable (Table[uint16, string]) how I can get 10 previous and 10 next keys? |
18:32:26 | FromDiscord | <haxscramper> https://nim-lang.github.io/fusion/src/fusion/btreetables.html#valuesFrom.i%2CTable%5BA%2CB%5D%2CA for 10 next. 10 previous is not exposed |
18:36:06 | FromDiscord | <haxscramper> There is also a https://nim-lang.org/docs/heapqueue.html, but I don't exactly remember whether it fully sorts its values or only ensures `that a[0] is always its smallest element.` |
18:36:40 | FromDiscord | <haxscramper> Though it is probably not applicable in your use case anyway |
18:37:29 | FromDiscord | <haxscramper> But iteration from btreetables is implemented using 'cursor' that traverses the table in one direction - `next()`, so I doubt it is possible to get "10 previous" |
18:37:59 | FromDiscord | <jtiai> is there way to get index of key? |
18:38:23 | FromDiscord | <jtiai> since my keys are like " 1 3 6 10 22 32 33 34 40 50"... |
18:40:54 | FromDiscord | <haxscramper> No, ordered maps don't usually support getting index of a key as it is an internal implementation detail |
18:41:14 | FromDiscord | <haxscramper> What are you trying to do? |
18:42:11 | FromDiscord | <jtiai> print out part of the table from key X so that I around X key also 10 keys to both directions are printed. |
18:42:50 | FromDiscord | <jtiai> given above example of keys if my X = 32 and I want 2 around it I need list of keys which is "10 22 32 33 34" |
18:45:13 | PMunch | femtozip shared header compression library wrapper: https://github.com/pmunch/femtozip |
18:55:41 | * | Gustavo6046 quit (Ping timeout: 240 seconds) |
18:59:00 | * | Gustavo6046 joined #nim |
19:01:34 | * | laincat joined #nim |
19:06:48 | FromDiscord | <mlokis> nim provides reflection only for objects, em i right |
19:07:24 | FromDiscord | <haxscramper> depends on what do you mean by "reflection". `items` works for objects |
19:07:24 | FromDiscord | <mlokis> i mean objects that extend rootObj |
19:07:36 | FromDiscord | <haxscramper> (edit) "`items`" => "`fields`" |
19:07:56 | FromDiscord | <haxscramper> You mean runtime RTTI? |
19:08:05 | FromDiscord | <haxscramper> (edit) "runtime" => "runtime," |
19:08:22 | FromDiscord | <mlokis> well, i only know java and golang reflection |
19:08:34 | FromDiscord | <haxscramper> most of nim's reflection is compile-time |
19:08:58 | FromDiscord | <haxscramper> like you can get full structure of the type definition only from type name and implement all logic at compile-time in macros |
19:09:01 | FromDiscord | <ElegantBeef> Yea we use macros to get type information to expand at compile time |
19:09:28 | FromDiscord | <ElegantBeef> We dont really need runtime reflection since we have the macros that tell us everything we need |
19:09:59 | FromDiscord | <mlokis> so you can access types structure at compile time, recursivly? |
19:10:09 | FromDiscord | <ElegantBeef> Parents of parents of parents? |
19:10:27 | FromDiscord | <ElegantBeef> https://forum.nim-lang.org/t/7853#49914 |
19:10:29 | FromDiscord | <mlokis> i mean if object embeds object, can you find out what fields it has |
19:11:03 | FromDiscord | <ElegantBeef> Yes you should be able to since the field types should be symbols |
19:12:06 | * | laincat left #nim (#nim) |
19:12:47 | FromDiscord | <mlokis> because in rust you only know structure of current struct, witch is also really annoying. In go on the other hand you detect everything on runtime and it is very slow |
19:13:09 | FromDiscord | <ElegantBeef> Modification of the code on that forum post |
19:13:12 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3lTa |
19:13:38 | * | laincat joined #nim |
19:14:16 | FromDiscord | <mlokis> nim is owerpowered. i made macro in 100 lines that allows me to write components like in react |
19:14:21 | FromDiscord | <ElegantBeef> Yep |
19:14:29 | FromDiscord | <ElegantBeef> Procedural macros are nice |
19:14:45 | FromDiscord | <ElegantBeef> Atleast i think that's what these are called |
19:15:08 | FromDiscord | <mlokis> i love them, this is the lib btw https://github.com/jakubDoka/niml |
19:15:11 | FromDiscord | <haxscramper> Yeah, they called procedural |
19:15:33 | FromDiscord | <mlokis> have you ever tried procedural macros in rust |
19:15:43 | FromDiscord | <mlokis> biggest pain in the ass |
19:15:43 | FromDiscord | <ElegantBeef> I've never tried rust |
19:16:00 | FromDiscord | <ElegantBeef> Ah this is like karax but it generates the html statically |
19:16:00 | FromDiscord | <mlokis> you have to make separate project to define maycro |
19:16:12 | FromDiscord | <mlokis> and all you get is string |
19:16:49 | FromDiscord | <ElegantBeef> So it's your version of https://github.com/juancarlospaco/nim-html-dsl |
19:17:15 | FromDiscord | <haxscramper> fusion/matching was partially inspired by rust's macros, though only adapted good parts |
19:17:30 | FromDiscord | <mlokis> In reply to @ElegantBeef "So it's your version": i find that one very inflexible |
19:17:38 | FromDiscord | <haxscramper> And I would say there were not so many of them ergonomics-wise |
19:17:49 | FromDiscord | <haxscramper> https://veykril.github.io/tlborm/patterns/push-down-acc.html |
19:18:06 | FromDiscord | <ElegantBeef> Is it forced that macros are all called with `!` in rust or is that just convention? |
19:18:12 | FromDiscord | <haxscramper> forced |
19:18:43 | FromDiscord | <ElegantBeef> imagine if nim forced `macro` be appended to all names of macros, would be "fun" |
19:18:54 | FromDiscord | <mlokis> you know how painfull it is to develop macros in rust, even getting the output or printing what you are working with is dificult |
19:19:00 | FromDiscord | <haxscramper> Though techically rust macros are more powerful as they operate on tokens, so I suppose you can write more complex DSL, at least if you want to risk your sanity |
19:19:15 | FromDiscord | <ElegantBeef> Well you can do the same thing just using raw strings in Nim |
19:19:23 | FromDiscord | <haxscramper> But this looks ugly |
19:19:32 | FromDiscord | <ElegantBeef> Shhhh |
19:19:36 | FromDiscord | <ElegantBeef> Hide that under the rug |
19:19:53 | FromDiscord | <mlokis> nim syntax is flexible enough |
19:20:11 | FromDiscord | <haxscramper> In reply to @mlokis "you have to make": You are talking about procedural macros in rust (IIRC there are two types - `macro_rules!` and ones that are basically compiler plugins)? |
19:21:00 | FromDiscord | <mlokis> i em talking about proc macro not a macro, macro in rust is more like a template with annoying syntax |
19:22:31 | FromDiscord | <ElegantBeef> mlokis you pushed your .vscode folder |
19:22:41 | FromDiscord | <mlokis> idk why but since i found out about nim i stopped looking for good language, already found best one |
19:23:57 | FromDiscord | <ElegantBeef> I still need to try hax's pattern matching for macros, too fixed in my ways 😄 |
19:24:39 | FromDiscord | <haxscramper> Actually I don't use it all the time either |
19:25:00 | FromDiscord | <haxscramper> More like I don't use it at all, only for small macros that simple enough |
19:25:25 | FromDiscord | <haxscramper> Because in the end everything still comes down to 400-line switch on ast kind |
19:25:48 | FromDiscord | <haxscramper> But it is so much better for smaller use cases |
19:26:20 | FromDiscord | <ElegantBeef> Think it's mostly i've never used pattern matching, so just avoid it until i really feel the need |
19:26:24 | FromDiscord | <mlokis> I em now making a website and it cannot be easier, no need to use react or html, just nim js and css |
19:26:42 | FromDiscord | <ElegantBeef> why did you say js? 😛 |
19:27:13 | FromDiscord | <ElegantBeef> Where is our DSL for css?! |
19:27:26 | FromDiscord | <mlokis> i em kind of use to it |
19:27:57 | FromDiscord | <mlokis> i think css is simple enough, i also dont want to recompile when designing |
19:28:19 | FromDiscord | <ElegantBeef> I am just joking about the css, though why you're using js is odd |
19:28:40 | FromDiscord | <mlokis> thats disadvantage of nim for now, it recompiles whole codebase |
19:29:12 | FromDiscord | <mlokis> 111000 lines of code for nothing |
19:29:21 | FromDiscord | <mlokis> because i changed a string |
19:29:22 | FromDiscord | <ajusa> yeah, it can be kind of slow to compile |
19:29:38 | FromDiscord | <ajusa> hopefully the upcoming incremental compilation will fix that |
19:29:40 | FromDiscord | <mlokis> but when we get incremental it will speed up |
19:29:57 | * | filcuc joined #nim |
19:31:21 | FromDiscord | <mlokis> fortunately nim compiler is not as slow as rusts, (building project for 5 minutes lol) |
19:31:47 | FromDiscord | <ElegantBeef> I'm a simple man it takes less than 10 seconds for all my projects and i'm happy |
19:32:08 | FromDiscord | <ElegantBeef> Now doing compiler work, that's a bit tedious takes like 30 seconds for a build 😄 |
19:32:09 | FromDiscord | <mlokis> nim compiler is super fast actually |
19:32:22 | FromDiscord | <mlokis> when you look at language features, oh god |
19:32:24 | PMunch | Yeah that's one of the big benefits |
19:32:41 | PMunch | Building a C++ project is always a pain :P |
19:32:52 | FromDiscord | <mlokis> i tried to compile 1000000 of print stmt |
19:33:09 | PMunch | And Nim being able to target the same things but building super fast is really nice |
19:33:10 | FromDiscord | <mlokis> and nim got it down in few minutes |
19:33:28 | PMunch | Hehe, I'm not even going to mention the abuse I've put the compiler through :P |
19:33:53 | FromDiscord | <mlokis> go compiler famous for its speed could not compile 1000k lines, it crashed because of lack of memory |
19:33:56 | FromDiscord | <ElegantBeef> Pmunch i spent like a week working on a PR for stronger type inference, i think i harmed it more |
19:34:12 | FromDiscord | <ElegantBeef> In the end the PR failed the CI |
19:34:16 | FromDiscord | <ElegantBeef> So.... take that! |
19:34:32 | PMunch | I meant the stuff I have done to the already built compiler |
19:34:41 | FromDiscord | <ElegantBeef> Ah |
19:34:52 | PMunch | I actually haven't done much to the actual compiler |
19:35:20 | FromDiscord | <ElegantBeef> Me either, it's done more to me than I to it |
19:35:52 | FromDiscord | <mlokis> isnt like lot of things in nim built in macros? |
19:36:32 | FromDiscord | <ElegantBeef> In the compiler? Not really |
19:36:49 | PMunch | Lo of libraries though |
19:37:07 | FromDiscord | <ElegantBeef> Yea macros give you a 0 cost abstraction to lower level logic easily |
19:37:14 | FromDiscord | <haxscramper> In reply to @mlokis "go compiler famous for": I've seen at least two compiles that don't free memory by design, because that's "faster" |
19:37:17 | FromDiscord | <mlokis> i mean system package, well thats more about operators |
19:37:42 | FromDiscord | <ElegantBeef> There are rather few macros imported by default if any |
19:37:59 | FromDiscord | <mlokis> In reply to @haxscramper "I've seen at least": not thats because go compiler is written in go and go has gc |
19:38:21 | FromDiscord | <ElegantBeef> Nim is written in Nim and Nim has GC |
19:38:35 | FromDiscord | <mlokis> but nim gc is not thread safe |
19:38:37 | FromDiscord | <haxscramper> Go GC is optimized for different workloads? |
19:39:01 | FromDiscord | <haxscramper> so it does not perform as good for compiler that operates on very complex, deeply nested and interlinked data structures |
19:39:15 | FromDiscord | <haxscramper> At least that's my theory, |
19:39:30 | FromDiscord | <mlokis> well i just passed file full of print statements |
19:40:30 | FromDiscord | <haxscramper> Someone compiled 18million-argument functions |
19:40:38 | FromDiscord | <haxscramper> Or something like that |
19:40:41 | FromDiscord | <ElegantBeef> Yea i did something similar, replicated the vlang compile time benchmark using a macro, and the actually issue was gcc, with it it'd take minutes before gave up, so moved to tcc and took only 22seconds |
19:40:51 | FromDiscord | <ElegantBeef> That someone was pmunch i believe |
19:41:06 | FromDiscord | <haxscramper> In reply to @PMunch "Been running for 147h": the legend |
19:41:08 | FromDiscord | <ElegantBeef> Or he was doing something dumb like that then killed it after a few weeks |
19:41:41 | ForumUpdaterBot | New Nimble package! hypixel - The Hypixel API, in Nim., see https://github.com/Knaque/hypixel-nim |
19:41:44 | PMunch | Haha, yes that was me :P |
19:41:44 | FromDiscord | <mlokis> vlang is discusting language |
19:42:19 | * | xet7 joined #nim |
19:42:59 | FromDiscord | <mlokis> compiles 1000k lines in a second, in witch dimension does the author live |
19:43:11 | FromDiscord | <ElegantBeef> In reply to @mlokis "vlang is discusting language": I dont disagree, just was doing the benchmark to see their results |
19:43:25 | FromDiscord | <ElegantBeef> My favourite part is they do vlang vs C, vlang uses tcc C uses gcc |
19:43:41 | FromDiscord | <mlokis> whats tcc |
19:44:02 | FromDiscord | <mlokis> just simple desc |
19:44:08 | FromDiscord | <haxscramper> very fast C compiler |
19:44:23 | FromDiscord | <haxscramper> Does not produce really optimized binary but can give you millisecond compile times |
19:44:46 | FromDiscord | <haxscramper> you can compile nim with it too `nim c --cc:tcc`, and get around `200ms` compilation time |
19:44:55 | FromDiscord | <mlokis> sounds good for degugging |
19:44:56 | FromDiscord | <haxscramper> for simple code of course, but still pretty fast |
19:45:13 | FromDiscord | <ElegantBeef> It's one major use case is using C as a scripting langauge |
19:45:30 | FromDiscord | <mlokis> language that can be interpreted and compiled would be nice |
19:45:37 | FromDiscord | <haxscramper> Yes, `tcc` can run binary directly from memory, without storing it on disk etc |
19:45:50 | FromDiscord | <mlokis> thats lisp but lisp is shit |
19:45:57 | FromDiscord | <haxscramper> `nim run` does that IIRC? |
19:46:22 | FromDiscord | <mlokis> i mean interpret like python |
19:46:24 | FromDiscord | <ElegantBeef> Looks at nim's VM |
19:46:46 | FromDiscord | <ElegantBeef> Who's going to be the one that profiles it and makes it faster |
19:47:31 | FromDiscord | <haxscramper> I think someone mentioned one of the main bottlenecks is that it operates on PNode trees and packed AST somehow should make it faster |
19:48:11 | FromDiscord | <haxscramper> Not sure if it is really someone said though, maybe it was different thing |
19:50:11 | FromDiscord | <mlokis> i recon that intel c compiler produces fastest executables, did you know that? (i once was wery curious) |
19:55:11 | * | laincat quit (Quit: Leaving) |
19:55:41 | * | xet7 quit (Quit: Leaving) |
19:55:46 | * | laincat joined #nim |
19:56:47 | * | krux02 joined #nim |
19:57:14 | * | xet7 joined #nim |
20:08:55 | PMunch | Hmm, do we have a ring buffer implementation for strings anywhere? |
20:10:18 | PMunch | Basically I want to add strings to a buffer, and then be able to get a length and access random strings by an index in the range 0..<length |
20:11:29 | * | narimiran quit (Ping timeout: 268 seconds) |
20:28:27 | * | PMunch quit (Quit: leaving) |
20:36:12 | FromDiscord | <ajusa> is there any way to choose which version of a nimble package to use when compiling a program? Is there like a `nimble switch` command or something similar? |
20:39:09 | * | leorize quit (Ping timeout: 240 seconds) |
20:41:15 | * | leorize joined #nim |
20:52:01 | * | fredrikhr quit (Quit: Client Disconnecting) |
20:54:50 | FromDiscord | <jtiai> My emulator is progressing... https://media.discordapp.net/attachments/371759389889003532/839606084964843550/unknown.png |
20:55:17 | FromDiscord | <jtiai> Just if I knew why SDL2_ttf renders font a bit bad way... |
21:04:45 | * | leorize quit (Ping timeout: 240 seconds) |
21:21:57 | * | thomasross joined #nim |
21:22:12 | * | leorize joined #nim |
21:23:16 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
21:57:11 | * | filcuc quit (Ping timeout: 246 seconds) |
22:00:38 | * | xet7 quit (Remote host closed the connection) |
22:35:33 | * | Gustavo6046 quit (Ping timeout: 250 seconds) |
22:36:45 | * | oddp joined #nim |
22:41:30 | FromDiscord | <Hi02Hi> In reply to @mlokis "idk why but since": thats happened to a lot of us, welcome to the club |
22:48:12 | * | Gustavo6046 joined #nim |
23:09:58 | * | clyybber quit (Remote host closed the connection) |
23:30:37 | FromDiscord | <retkid> In reply to @ForumUpdaterBot "New Nimble package! hypixel": Is that needed often enough for a nim wrapper |
23:32:42 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/839645809795399693/image0.png |
23:33:01 | FromDiscord | <retkid> Assuming this isn’t going i in their portfolio |
23:33:51 | FromDiscord | <retkid> Also the fact that it’s not a wrapper raises so many more questions |
23:35:25 | FromDiscord | <retkid> This just reeks of pure undiluted programmer anger from hours of trial and error... |
23:35:51 | FromDiscord | <retkid> I want to find the person that made this |
23:37:14 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/839646954186735616/image0.png |
23:40:37 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/839647806477565962/image0.png |
23:41:04 | FromDiscord | <retkid> Should probably use elfi and make it more readable |
23:42:19 | FromDiscord | <retkid> You could also use a table to make this a lot cleaner |
23:46:02 | FromDiscord | <retkid> let rank = table[player(“rank”).getstr] |
23:47:35 | FromDiscord | <retkid> (edit) "table[player(“rank”).getstr]" => "table[player{“rank”}.getstr]" |
23:47:55 | FromDiscord | <ElegantBeef> Why do you want to find them |
23:48:26 | FromDiscord | <retkid> I have questions |
23:48:42 | FromDiscord | <ElegantBeef> Sometimes some packages only make me ask questions aswell |
23:49:44 | FromDiscord | <retkid> I wanna PR this stuff, but my computer is broken and I have no money to fix it |
23:51:22 | FromDiscord | <retkid> Typing my PR on mobile |
23:51:33 | FromDiscord | <retkid> Lol |
23:51:46 | FromDiscord | <ElegantBeef> I still want to talk to the dev of this https://github.com/j-a-s-d/xam just to see why they do what they dol |
23:51:48 | FromDiscord | <ElegantBeef> (edit) "dol" => "do" |
23:53:02 | FromDiscord | <retkid> I don’t like thus g |
23:53:15 | FromDiscord | <retkid> (edit) "thus g" => "this" |
23:54:50 | FromDiscord | <retkid> One of the good parts of programming is being accountable for your mistakes and eventually understanding you’re entire project from line 1 to line 10000 |
23:55:36 | FromDiscord | <retkid> It makes me feel really good when I fuck up, and the only person to blame is myself |
23:55:51 | FromDiscord | <retkid> Unless you have a sh |
23:56:09 | FromDiscord | <retkid> (edit) "sh" => "shitty library" |
23:59:51 | ForumUpdaterBot | New thread by Xioren: How to http post nested data?, see https://forum.nim-lang.org/t/7930 |