00:16:27 | FromDiscord | <thugshaker.online> this language is fucking horrible and i love it |
00:16:38 | FromDiscord | <thugshaker.online> (edit) "this language is fucking horrible ... and" added "to use as a beginner" |
00:16:45 | FromDiscord | <thugshaker.online> (edit) "this language is fucking horrible to use as a beginner ... and" added "(me)" |
00:18:04 | FromDiscord | <raynei486> In reply to @thugshaker.online "is it just me": I think you're just not used to reading docs |
00:31:44 | * | lumo_e joined #nim |
00:41:29 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4H28 |
00:41:42 | FromDiscord | <leorize> s/export/var |
00:41:49 | FromDiscord | <leorize> and you're of to the races |
00:42:06 | FromDiscord | <leorize> and add a `` after `console`, too |
00:42:45 | FromDiscord | <raynei486> yeah nim has no export keyword |
00:42:50 | FromDiscord | <millymox> In reply to @leorize "s/export/var": I’m slow sorry what do you mean? S/export? |
00:42:53 | FromDiscord | <raynei486> it's just a `` after the name to export |
00:43:11 | FromDiscord | <millymox> In reply to @raynei486 "yeah nim has no": Ahhh i see okay |
00:43:13 | FromDiscord | <raynei486> In reply to @millymox "I’m slow sorry what": it means replace export with var |
00:43:24 | FromDiscord | <raynei486> it's sed commands |
00:43:28 | FromDiscord | <raynei486> or vim idk |
00:44:38 | FromDiscord | <millymox> Hmm i did what you guys said still doens’t seem to working |
00:44:51 | FromDiscord | <millymox> Doesn’t do what its suppose to do + intellisense would recognize it |
00:46:43 | FromDiscord | <millymox> sent a code paste, see https://paste.rs/TBLAS |
00:46:56 | FromDiscord | <millymox> import nim_module/app |
00:47:00 | FromDiscord | <millymox> Then i try to use it |
00:47:06 | FromDiscord | <millymox> And fails, what am i doing wrong here?> |
00:47:50 | FromDiscord | <leorize> wdym by fails? |
00:48:32 | FromDiscord | <millymox> It’s not exporting it seems, because intellisense won’t see it and when i try to use it, it doesn’t log anything |
00:48:52 | FromDiscord | <Elegantbeef> "not exporting"? |
00:49:02 | FromDiscord | <Elegantbeef> You're also not calling it in the above code |
00:49:15 | FromDiscord | <millymox> I’m trying to use it from another file |
00:49:27 | FromDiscord | <Elegantbeef> `log` |
00:51:08 | FromDiscord | <millymox> Did this jus now tried again and its still not working, i also noticed intellisense doesn’t pick up on it https://media.discordapp.net/attachments/371759389889003532/1154580604436893776/IMG_4949.png |
00:54:36 | FromDiscord | <leorize> do you have sample files for us to test? |
00:57:26 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4H2a |
00:57:55 | FromDiscord | <millymox> And main.nim is empty with just a proc |
00:58:24 | FromDiscord | <millymox> The init custom console is just pseudo code |
00:58:28 | FromDiscord | <millymox> But it doesn’t bring any errors up |
01:02:56 | FromDiscord | <millymox> Works fine in app.nim but not outside of it |
01:03:48 | FromDiscord | <Elegantbeef> You didnt do `import app` |
01:04:18 | FromDiscord | <millymox> In reply to @Elegantbeef "You didnt do `import": I did import nim_module/app |
01:04:23 | FromDiscord | <millymox> I’m making a library |
01:04:29 | FromDiscord | <millymox> I think its because of the directories |
01:09:54 | FromDiscord | <millymox> Works fine |
01:09:56 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4H2e |
01:09:58 | FromDiscord | <millymox> In main.nim |
01:10:18 | FromDiscord | <millymox> But mine doesn’t |
01:10:27 | termer | Is it reasonably feasible to call Nim from C in the same project |
01:10:35 | termer | I have no issues calling C from Nim in the same project |
01:16:22 | FromDiscord | <Elegantbeef> You can write system libraries, so why not |
01:18:04 | FromDiscord | <fenilli> sent a long message, see http://ix.io/4H2g |
01:18:20 | FromDiscord | <fenilli> (edit) "http://ix.io/4H2g" => "http://ix.io/4H2h" |
01:19:06 | termer | If you want to do virtual methods, you can use the `method` syntax which will do that for you |
01:19:17 | termer | I'm not really equipped to answer the rest right now though |
01:19:25 | termer | Elegantbeef, I mean more from a project perspective |
01:19:44 | termer | obviously I can generate Nim C files and then include them in C |
01:19:53 | termer | but that introduces 2 build steps |
01:20:49 | FromDiscord | <leorize> build a binding then create a library |
01:20:50 | FromDiscord | <Elegantbeef> Right, that's the sane thing to do |
01:21:01 | FromDiscord | <leorize> either a dynamic or static, doesn't matter |
01:21:09 | FromDiscord | <leorize> then consume it just like any other deps in your C pipeline |
01:21:15 | FromDiscord | <Elegantbeef> Make a static library for your Nim code, include that in your C, problem solved |
01:21:56 | FromDiscord | <leorize> is this a C++ interop or just a Nim best practices question?↵(@fenilli) |
01:22:37 | FromDiscord | <fenilli> Nim best practices, I'm following a c++ tutorial on how to build and simple engine called `Dragonfly`, and it uses class and stuff, but I want to write it in nim style. |
01:22:45 | FromDiscord | <fenilli> as to learn nim and that at the same time. |
01:23:02 | FromDiscord | <fenilli> (edit) "and" => "a" |
01:23:19 | FromDiscord | <leorize> you should start by doing the tutorial verbatim |
01:23:28 | FromDiscord | <leorize> unless they're doing multiple inheritance |
01:23:41 | FromDiscord | <leorize> in that case then you'll have to analyze the data flow |
01:25:21 | FromDiscord | <fenilli> but if it wasn't in the tutorial per say, would it be better to construct a class variant of `Manager` with kind? if so I would have to write overload procs with kinds of startup/shutdown correct? |
01:26:38 | FromDiscord | <fenilli> and in that case could there be a proc without kind that would run in "base" without a kind? for any kind? for example? |
01:28:05 | FromDiscord | <fenilli> sent a code paste, see https://paste.rs/YO2uR |
01:28:10 | FromDiscord | <leorize> inheritance and variants lets you polymorph your object at runtime |
01:28:11 | FromDiscord | <leorize> if you can get away with generics + overloads, then go for it instead |
01:28:39 | FromDiscord | <Elegantbeef> Yes |
01:28:49 | FromDiscord | <Elegantbeef> Nim has overloading |
01:30:45 | FromDiscord | <leorize> as a quick tip, composition isn't very popular with beginners is because they are really hard to do well |
01:31:37 | FromDiscord | <leorize> inheritance is a simple tree model where things are progressively enhanced, which vibes a lot better with human thinking |
01:33:34 | FromDiscord | <fenilli> but even with inheritance, nim doesn't provide the same level of OOP as C++, so wouldn't there be a roadblock at some point if following that? |
01:34:15 | FromDiscord | <fenilli> but sure I might as well try to write using inheritance at first and convert it to overloads later. |
01:37:09 | FromDiscord | <millymox> In reply to @raynei486 "yeah nim has no": Uh i did export console and it works now |
01:37:42 | FromDiscord | <Elegantbeef> @raynei486\: Nim has an export keyword |
01:48:02 | FromDiscord | <millymox> Why is logging console? |
01:48:03 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4H2l |
01:48:27 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4H2m |
01:50:28 | FromDiscord | <Elegantbeef> cause it's the first parameter |
01:51:01 | FromDiscord | <leorize> or rather because the wrapper is wrong |
01:51:57 | FromDiscord | <leorize> I think you should be able to get away with just importjs and no string has to be supplied |
01:55:06 | FromDiscord | <millymox> sent a long message, see http://ix.io/4H2n |
01:55:10 | FromDiscord | <millymox> When i remove the string param |
02:01:29 | FromDiscord | <leorize> that's not what I meant |
02:01:43 | FromDiscord | <leorize> but rather `{.importjs.}` is all you needed |
02:02:14 | FromDiscord | <leorize> it comes with a default pattern that do `firstparam.log(the, rest, of, params)` |
02:02:50 | FromDiscord | <millymox> Oh i was trying to bind it to nim so it has intellisense lol\ |
02:03:26 | FromDiscord | <leorize> sent a code paste, see https://play.nim-lang.org/#ix=4H2o |
02:04:28 | FromDiscord | <millymox> Ohh i get it let me try |
02:07:32 | FromDiscord | <leorize> if you ever want to wrap a npm package, then I do have this old thing (which maybe someone else already make something better)\: https://github.com/alaviss/setup-nim/blob/ng/src/private/utils.nim#L145 |
02:07:44 | FromDiscord | <millymox> .importjs. Routine requires a pattern |
02:07:45 | FromDiscord | <leorize> which can be used like this\: https://github.com/alaviss/setup-nim/blob/ng/src/private/actions/core.nim#L34 |
02:07:47 | FromDiscord | <millymox> Says compiler |
02:08:17 | FromDiscord | <leorize> I guess you can cheat with importcpp, but lemme dig that pattern up for you |
02:09:22 | FromDiscord | <leorize> `#.log(@)` \<- that's your pattern |
02:09:39 | FromDiscord | <leorize> looks like nim removed the default pattern? |
02:09:41 | FromDiscord | <leorize> weird choice |
02:11:13 | FromDiscord | <millymox> Okay now why is it doing this lmfao↵↵ console.log(makeNimstrLit("HEYYY")); |
02:12:06 | FromDiscord | <Elegantbeef> `cstring` |
02:12:07 | FromDiscord | <leorize> because you used `string` as your input type |
02:12:09 | FromDiscord | <leorize> switch to `cstring` |
02:13:40 | FromDiscord | <millymox> It works now, God bless you all |
02:13:45 | FromDiscord | <millymox> For putting up with my idiocy |
02:14:13 | * | lumo_e quit (Quit: Quit) |
02:14:43 | FromDiscord | <leorize> well this is a support channel \:P |
02:15:12 | FromDiscord | <Elegantbeef> If that's the case why have I not got the support I clearly need?! |
02:15:37 | FromDiscord | <leorize> you've used up your free trial, that's why |
02:15:47 | FromDiscord | <Elegantbeef> Ah |
02:16:09 | FromDiscord | <Elegantbeef> Guess I'll just eat these homeopathic pills until the voices stop |
02:43:06 | FromDiscord | <millymox> sent a long message, see http://ix.io/4H2s |
03:09:20 | FromDiscord | <millymox> Fixed it |
03:41:55 | * | azimut quit (Ping timeout: 252 seconds) |
03:53:36 | * | greaser|q quit (Changing host) |
03:53:36 | * | greaser|q joined #nim |
03:53:39 | * | greaser|q is now known as GreaseMonkey |
04:47:10 | * | rockcavera quit (Remote host closed the connection) |
04:54:10 | FromDiscord | <n00nehere> anyone know why ratel says that nimeval is missing when installing it? |
04:54:55 | FromDiscord | <Elegantbeef> try `nimble install --path:"$nim" ratel` |
04:55:05 | FromDiscord | <Elegantbeef> What OS are you on? |
05:22:25 | * | NimEventer quit (Remote host closed the connection) |
05:22:39 | * | NimEventer joined #nim |
06:15:53 | * | advesperacit joined #nim |
06:16:52 | * | disso-peach quit (Quit: Leaving) |
06:37:04 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Guess I'll just eat": Embrace the voices, you are many, many are one... |
06:52:47 | * | advesperacit quit () |
07:01:11 | * | PMunch joined #nim |
07:08:48 | * | advesperacit joined #nim |
07:29:42 | * | ntat joined #nim |
07:52:30 | * | ntat quit (Quit: leaving) |
08:29:44 | * | flalom joined #nim |
08:32:53 | * | junaid_ joined #nim |
08:37:41 | * | junaid_ quit (Remote host closed the connection) |
08:46:57 | * | flalom quit () |
08:57:09 | FromDiscord | <xerxemi> how do you convert an IntLit to an int? |
09:00:44 | FromDiscord | <Elegantbeef> If you're in a macro you do `.intVal` |
09:01:18 | FromDiscord | <Elegantbeef> Depending on what you're doing you might just want `static int` |
09:01:39 | FromDiscord | <xerxemi> alr |
09:11:46 | * | flalom joined #nim |
09:12:26 | * | flalom quit (Client Quit) |
09:28:46 | FromDiscord | <xerxemi> is there any way to make a macro remember certain variables? since macros run at compile time it also seems impossible to use a global |
09:49:12 | * | xmachina quit (Ping timeout: 260 seconds) |
09:50:03 | * | blop_ quit (Ping timeout: 252 seconds) |
09:57:54 | FromDiscord | <odexine> https://nim-lang.org/docs/macrocache.html |
10:03:26 | * | xmachina joined #nim |
10:07:12 | PMunch | xerxemi, you can use a global `var myGlobal {.compileTime.} = 100` |
10:08:48 | NimEventer | New thread by rajmac: Ggplot and lapack revisited, see https://forum.nim-lang.org/t/10509 |
10:30:32 | * | PMunch_ joined #nim |
10:33:38 | * | PMunch quit (Ping timeout: 246 seconds) |
10:33:48 | * | PMunch_ is now known as PMunch |
10:34:56 | * | def- quit (Quit: -) |
10:36:41 | * | def- joined #nim |
10:58:49 | * | xmachina quit (Ping timeout: 255 seconds) |
11:12:48 | * | xmachina joined #nim |
11:25:31 | * | Batzy_ quit (Ping timeout: 264 seconds) |
11:26:46 | FromDiscord | <juh9870> Hello, is there a method to take `n` items from iterator and skip the rest? I want to only print first 5 items from an iterator |
11:26:50 | * | Batzy joined #nim |
11:34:03 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4H48 |
11:42:11 | * | azimut joined #nim |
11:49:22 | * | jmdaemon quit (Ping timeout: 260 seconds) |
12:24:38 | * | def- quit (Quit: -) |
12:25:52 | * | def- joined #nim |
12:49:32 | * | xmachina1 joined #nim |
12:49:38 | * | derpydoo joined #nim |
12:51:04 | * | xmachina quit (Ping timeout: 244 seconds) |
12:54:14 | * | xmachina1 is now known as Co2 |
12:57:25 | * | Co2 quit (Quit: WeeChat 4.0.4) |
13:00:04 | FromDiscord | <fabric.input_output> how is it looking https://fabriciopashaj.github.io/yarolin/results.html |
13:02:00 | FromDiscord | <odexine> ? |
13:09:21 | FromDiscord | <fabric.input_output> I mean like what do you think, does it look good? |
13:09:31 | FromDiscord | <fabric.input_output> the library |
13:14:47 | * | def- quit (Quit: -) |
13:15:37 | * | def- joined #nim |
13:18:05 | FromDiscord | <juh9870> sent a code paste, see https://play.nim-lang.org/#ix=4H4s |
13:28:56 | * | def- quit (Quit: -) |
13:29:09 | * | def- joined #nim |
13:38:35 | * | xmachina joined #nim |
13:43:23 | * | xmachina quit (Client Quit) |
13:46:51 | * | PMunch quit (Quit: Leaving) |
13:53:15 | * | xmachina joined #nim |
13:53:15 | * | xmachina is now known as Co2 |
13:53:43 | * | Co2 is now known as xmachina |
13:53:58 | * | edr joined #nim |
13:54:26 | * | rockcavera joined #nim |
13:59:29 | arkanoid | nim forum web app is giving me lots of ux glitces, recently. For example the preview button just prints to console, the reply button doesn't actually reply, delete button doesn't work |
14:17:52 | * | blop_ joined #nim |
14:23:13 | * | blop_ quit (Ping timeout: 252 seconds) |
14:31:09 | * | junaid_ joined #nim |
14:35:20 | FromDiscord | <Chronos [She/Her]> Are tables the fastest way to store key-value structures? |
14:35:34 | FromDiscord | <Chronos [She/Her]> I'm mapping a string to another string (for translation keys) |
14:35:53 | FromDiscord | <odexine> fastest depends on the structures and what other properties you need... |
14:36:19 | FromDiscord | <odexine> and start worrying about performance when you really have a performance problem |
14:36:42 | FromDiscord | <Chronos [She/Her]> Just curiousity rn |
14:37:01 | FromDiscord | <Chronos [She/Her]> In reply to @odexine "fastest depends on the": Another requirement is being usable across threads |
14:37:09 | FromDiscord | <.aingel.> What would be faster than a table |
14:37:14 | FromDiscord | <Chronos [She/Her]> Tho ig that's why I'd allocate shared memory manually |
14:37:16 | FromDiscord | <.aingel.> Maybe with a custom faster hash func? |
14:37:25 | FromDiscord | <Chronos [She/Her]> In reply to @.aingel. "What would be faster": 🤷♀️ that's why I'm asking |
14:38:25 | FromDiscord | <juancarlospaco> In reply to @chronos.vitaqua "Are tables the fastest": If it wont need to grow, an array like `var t = {"a": "b"}` |
14:39:54 | FromDiscord | <Chronos [She/Her]> Makes sense, it'll be read from a file though |
14:40:01 | FromDiscord | <Chronos [She/Her]> Or some other string input I'd assume |
14:41:09 | FromDiscord | <.aingel.> In reply to @juancarlospaco "If it wont need": What do u mean? |
14:41:26 | FromDiscord | <.aingel.> Oh this is not a dynamic memory store? |
14:41:29 | FromDiscord | <odexine> yes |
14:41:35 | FromDiscord | <odexine> arrays are non-heap |
14:41:40 | FromDiscord | <toma400> I wish there was extendable tuple/various-typed hash table type, if we talk about dictionary types |
14:41:49 | FromDiscord | <odexine> but i dont know if arrays can be string indexed |
14:42:01 | FromDiscord | <.aingel.> It would require some sort of hash anyways |
14:42:19 | FromDiscord | <juancarlospaco> In reply to @.aingel. "Oh this is not": Nah. |
14:42:32 | FromDiscord | <.aingel.> I meant more like it was not a requirement for Rika |
14:42:38 | FromDiscord | <demotomohiro> afaik, tables are the fastest to set/get a value with a key. |
14:42:39 | FromDiscord | <.aingel.> Not your code sample |
14:42:45 | FromDiscord | <odexine> it's not my question |
14:42:50 | FromDiscord | <.aingel.> oh sorry |
14:42:53 | FromDiscord | <.aingel.> Chronos |
14:43:03 | FromDiscord | <.aingel.> My bad 😆 |
14:43:07 | FromDiscord | <odexine> lol |
14:43:15 | FromDiscord | <juancarlospaco> `vat t = {"a": "b"}` is an array of tuples. |
14:43:19 | FromDiscord | <.aingel.> What's the default hash function for a table? |
14:44:52 | FromDiscord | <demotomohiro> Is `proc hash(t: Table): Hash` defined? |
14:45:02 | FromDiscord | <juancarlospaco> If it can me immutable an enum with values `type Foo = enum A = "foo", B = "bar"` |
14:45:54 | FromDiscord | <odexine> In reply to @juancarlospaco "`vat t = {"a":": i forgot about that lol |
14:46:05 | FromDiscord | <odexine> but that means a linear search if unsorted anyway |
14:46:10 | FromDiscord | <odexine> hash tables are likely faster |
14:46:15 | FromDiscord | <odexine> (edit) "hash tables are likely faster ... " added "for large data" |
14:46:25 | FromDiscord | <odexine> easier to use for most cases |
14:46:29 | FromDiscord | <juancarlospaco> Yeah, it depends |
14:46:41 | FromDiscord | <demotomohiro> In reply to @.aingel. "What's the default hash": https://github.com/nim-lang/Nim/blob/devel/lib/pure/hashes.nim |
14:46:45 | FromDiscord | <odexine> In reply to @.aingel. "What's the default hash": i believe nim's hashes module is based on wyhash |
14:48:07 | FromDiscord | <Chronos [She/Her]> In reply to @odexine "hash tables are likely": Yeah it will be p large tbh |
14:48:19 | FromDiscord | <Chronos [She/Her]> Depending on the application |
14:48:30 | FromDiscord | <odexine> large as in more than a few thousand keys i'd say... |
14:48:40 | FromDiscord | <odexine> maybe even more |
14:52:44 | FromDiscord | <Chronos [She/Her]> I mean you could imagine something like Minecraft....or you could imagine a small CLI tool |
15:05:04 | * | def- quit (Quit: -) |
15:06:20 | * | def- joined #nim |
15:16:18 | FromDiscord | <millymox> sent a code paste, see https://paste.rs/nRFPc |
15:22:10 | FromDiscord | <demotomohiro> In reply to @millymox "attempting to call routine:": https://nim-lang.org/docs/system.html#on |
15:23:12 | FromDiscord | <demotomohiro> Or you forget to export mark to proc `on`? |
15:24:03 | FromDiscord | <demotomohiro> Or you need to `export on` |
15:34:13 | FromDiscord | <sirolaf> Is there a preferred way to deal with pragmas in untyped type sections or am I on my own there in terms of stdlib |
15:35:57 | FromDiscord | <sirolaf> sent a code paste, see https://play.nim-lang.org/#ix=4H76 |
15:36:29 | FromDiscord | <odexine> "deal with"? |
15:37:14 | FromDiscord | <sirolaf> Yes, it gives me a nnkRecList with ident defs in it but depending on what pragmas are attached I wanna change what it does |
15:37:48 | FromDiscord | <vindaar> there's https://nim-lang.github.io/Nim/macros.html#hasCustomPragma.m%2Ctyped%2C and friends. Not sure if that's what you have in mind |
15:38:34 | FromDiscord | <sirolaf> Tried that already, the pragma is an ident insted of a sym so it doesn't recognize it |
15:38:40 | FromDiscord | <sirolaf> (edit) "insted" => "instead" |
15:39:49 | FromDiscord | <millymox> In reply to @demotomohiro "Or you need to": Neither of these solutions work for me unfourntely |
15:41:24 | * | ntat joined #nim |
15:42:19 | FromDiscord | <millymox> In reply to @demotomohiro "Or you forget to": I do not have a proc named on |
15:44:35 | FromDiscord | <millymox> In reply to @demotomohiro "Or you need to": No this did fix it thank you, i made a typo lol |
15:51:45 | * | xmachina quit (Ping timeout: 258 seconds) |
15:55:02 | FromDiscord | <.aingel.> In reply to @demotomohiro "https://github.com/nim-lang/Nim/blob/devel/lib/pure": Thanks! |
15:55:24 | FromDiscord | <.aingel.> In reply to @odexine "i believe nim's hashes": Gotcha |
15:57:11 | * | blop_ joined #nim |
16:00:39 | FromDiscord | <Chronos [She/Her]> In reply to @millymox "attempting to call routine:": Oh btw you might like the `do` macro |
16:01:05 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4H7v |
16:01:18 | FromDiscord | <Chronos [She/Her]> Think it's in the std/sugars library |
16:03:20 | FromDiscord | <mratsim> In reply to @sirolaf "Is there a preferred": I have something somewhere |
16:03:55 | FromDiscord | <mratsim> The {.push mypragma.} are tricky |
16:05:40 | * | xmachina joined #nim |
16:15:05 | FromDiscord | <mratsim> In reply to @sirolaf "Is there a preferred": Here you go: https://github.com/mratsim/constantine/blob/master/constantine/platforms/code_generator/bindings/c_abi.nim#L37 |
16:16:26 | FromDiscord | <mratsim> You can use getAst with this macro or quote do to this kind of macro to deal with pragmas in an untyped macro |
16:23:48 | * | azimut_ joined #nim |
16:24:35 | * | azimut quit (Ping timeout: 252 seconds) |
16:30:06 | FromDiscord | <Chronos [She/Her]> I'm depending on if I should make a component builder or if I should figure out a way to not do that |
16:30:38 | FromDiscord | <Chronos [She/Her]> I want to make it so properties are inherited by the parent component by default but hm |
16:33:14 | * | Mister_Magister quit (Ping timeout: 244 seconds) |
16:34:39 | * | derpydoo quit (Ping timeout: 245 seconds) |
16:48:44 | * | Mister_Magister joined #nim |
16:54:08 | * | krux02 joined #nim |
16:57:50 | FromDiscord | <Chronos [She/Her]> Not sure what's the best way to code this lol |
17:08:13 | * | blop_ quit (Ping timeout: 252 seconds) |
17:08:39 | FromDiscord | <Chronos [She/Her]> Hm maybe concepts will be useful for this because of people wanting custom component types...? |
17:08:48 | FromDiscord | <Chronos [She/Her]> But hm |
17:10:56 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4H7I |
17:11:04 | FromDiscord | <Chronos [She/Her]> Literally the only thing I can think of oof- |
17:11:07 | * | blop_ joined #nim |
17:11:26 | FromDiscord | <Chronos [She/Her]> They need to also chain upon eachother tho so ugh.... |
17:12:04 | FromDiscord | <Chronos [She/Her]> ` next: BaseComponent`? |
17:12:49 | FromDiscord | <Chronos [She/Her]> I should really figure out a better way to do this, tho ig I do have to leave serialisation to the implementer of the component anyway so not my issue |
17:14:43 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4H7L |
17:14:51 | FromDiscord | <Chronos [She/Her]> I am fucking up markdown sorry |
17:15:36 | FromDiscord | <Chronos [She/Her]> Wait couldn't the `std/streams` module be rewritten with components? |
17:16:40 | FromDiscord | <Chronos [She/Her]> Very tempting to try... But I need to do my own thing first....or do I? |
17:35:38 | FromDiscord | <Chronos [She/Her]> Enough of that, sigh |
17:37:08 | FromDiscord | <.aingel.> What are you building? |
17:38:32 | FromDiscord | <Chronos [She/Her]> Text component library |
17:38:56 | FromDiscord | <Chronos [She/Her]> For things such as formatting text in a way that can be implemented in other libraries |
17:40:12 | FromDiscord | <.aingel.> Oh right, what sort of formatting |
17:40:17 | FromDiscord | <.aingel.> Other than i18n |
17:40:50 | FromDiscord | <Chronos [She/Her]> Text colours, italics/bold/underlining, something like this here: https://docs.advntr.dev/text.html |
17:41:37 | FromDiscord | <Chronos [She/Her]> I also plan for it to be possible to implement custom serializing logic too, so you could output JSON if needed, or instead you could output something for the terminal |
17:41:47 | FromDiscord | <Chronos [She/Her]> Just want to do it in a way that isn't distinctly... Java |
17:42:41 | * | azimut_ quit (Ping timeout: 252 seconds) |
17:45:03 | FromDiscord | <voidwalker> isn't that in notcurses/ncurses ? |
17:45:27 | FromDiscord | <Chronos [She/Her]> Not sure? Haven't looked into it |
17:45:41 | FromDiscord | <Chronos [She/Her]> But either way I still need it so it could be implemented in a game too |
17:45:42 | FromDiscord | <voidwalker> or is this html text? |
17:46:57 | * | advesperacit quit (Ping timeout: 260 seconds) |
17:47:09 | FromDiscord | <Chronos [She/Her]> Not HTML |
17:47:20 | FromDiscord | <voidwalker> how do you bold non html text ? unicode ? |
17:47:21 | * | advesperacit joined #nim |
17:49:56 | FromDiscord | <Chronos [She/Her]> That's up to who implements the library, but terminals have ANSI codes for that stuff |
17:51:30 | * | azimut joined #nim |
17:53:25 | FromDiscord | <Chronos [She/Her]> Okay this is very difficult |
17:55:31 | * | derpydoo joined #nim |
17:56:37 | * | azimut quit (Ping timeout: 252 seconds) |
18:00:57 | * | azimut joined #nim |
18:06:08 | FromDiscord | <Chronos [She/Her]> I don't this is doable in the way I want oof |
18:11:33 | FromDiscord | <jviega> I have a library like that. There's a `print()` statement that allows you to add html tags for formatting. It converts markdown automatically too, and then renders for the terminal. We already use it pretty extensively, generating a lot of tables, etc. Will probably pretty it up for other people in a few weeks. |
18:16:33 | FromDiscord | <jviega> You can inline stuff like `print("<atomiclime><bg-black>Hello</bg-black></atomiclime>") `but you can also do `print("<h1>Hello</h1>") `and apply a style to h1. I need to implement html class and id attributes soon, but it all is quite nifty |
18:17:18 | FromDiscord | <jviega> We have a ton of inline documentation and I wanted to be able to both generate web pages and render in-app on the command line, with one automation path. |
18:22:21 | FromDiscord | <Chronos [She/Her]> In reply to @jviega "I have a library": Sounds useful! My library was also supposed to add stuff like translatable keys tho rip |
18:22:45 | FromDiscord | <jviega> What does that mean? |
18:22:47 | FromDiscord | <.aingel.> Is there a way to do `cast[xmlchar](name.cstring)` something like name.cstring.cast[xmlchar] |
18:22:52 | FromDiscord | <.aingel.> (edit) "name.cstring.cast[xmlchar]" => "`name.cstring.cast[xmlchar]`" |
18:23:40 | FromDiscord | <jviega> What are you trying to actually accomplish, Aingel? Don't understand the question |
18:24:00 | FromDiscord | <Chronos [She/Her]> So you could load a file with translation keys (probably a .ini file), pass it to a component serializer, and then have it output the string with the translation + formatting↵↵An example would be `TranslatableKey("this.is.a.key").bold().italic().colour(Green)` |
18:24:05 | FromDiscord | <jviega> What kind of data are you trying to cast in what circumstances? |
18:24:32 | FromDiscord | <.aingel.> In reply to @jviega "What are you trying": Just want to type it with different syntax |
18:24:35 | FromDiscord | <Chronos [She/Her]> Then to serialise it you'd do `serialise(TranslationKeys, ...)` where the `...` is the components |
18:24:41 | FromDiscord | <.aingel.> Sort of like foo.`$` vs $foo |
18:24:52 | FromDiscord | <.aingel.> Ruby style vs python style |
18:25:13 | FromDiscord | <.aingel.> Not sure what it's really called |
18:25:29 | FromDiscord | <jviega> Got it. Doesn't really matter what it is from my perspective, Chronos. You could automatically apply styles to it, and substyles if it's structured data |
18:25:39 | FromDiscord | <.aingel.> (edit) "foo.`$`" => "foo.\`$\`" |
18:26:43 | FromDiscord | <Chronos [She/Her]> Point would be to just make it near effortless to just swap in translatable text with existing formatting |
18:26:49 | FromDiscord | <jviega> Well, `name.cstring` is essentially `cstring(name)` which is a cooercion operation itself. `cast(x)` is too, but the one that is effectively the C cast that says, "just fing do it even if it makes little sense" |
18:27:10 | FromDiscord | <.aingel.> Yeah thats why I want to keep doing it postfix |
18:27:13 | FromDiscord | <.aingel.> Can I do the cast with postfix |
18:27:55 | FromDiscord | <.aingel.> Regardless if the code can be more efficient or if I don't need to do cstring, that's a secondary thin |
18:27:57 | FromDiscord | <.aingel.> (edit) "thin" => "thing" |
18:28:47 | FromDiscord | <jviega> Yeah, same here, you don't have to use `print` at all. I, for instance, have a simpletable() that takes a seq[seq[string]] and automatically formats. Again, like with style sheets, you can hit individual elements without having to write things inline |
18:29:14 | FromDiscord | <jviega> I've honestly never tried, if it doesn't work when you try it then I doubt it |
18:34:03 | * | def- quit (Quit: -) |
18:38:59 | * | def- joined #nim |
18:41:06 | FromDiscord | <.aingel.> @jviega Do you know how to do the cast in postfix |
18:41:09 | FromDiscord | <.aingel.> If that's the right term |
18:41:56 | FromDiscord | <jviega> Where the argument goes to the left of the function? |
18:43:07 | FromDiscord | <.aingel.> Um sort of |
18:43:25 | FromDiscord | <.aingel.> > Ruby supports functional style (pipe-like) programming more easily |
18:43:31 | FromDiscord | <.aingel.> I saw it described that way on stack overflow |
18:43:52 | FromDiscord | <.aingel.> Basically just chaining functions from left to right |
18:44:06 | FromDiscord | <.aingel.> I know nim does it, but just wondering about the cast operation |
18:44:10 | FromDiscord | <jviega> So here's an oddity of nim. Usually you can turn `foo(a, b)` into `a.foo(b)`. But the second you need to provide a type parameter like with `foo[string](a, b)`, that syntax does not work, as it's too ambiguous w/ array access. So you can't do `a.foo[string](b)` but there's an alternate syntax: `a.foo[:string](b)` |
18:44:33 | FromDiscord | <jviega> Well if you want to chain functions their return values have to support it |
18:45:31 | FromDiscord | <jviega> Some people have done macros to get around that, but there's no simple way in the language to get those kinds of semantics |
18:55:08 | FromDiscord | <.aingel.> Okay that's cool |
18:57:31 | FromDiscord | <.aingel.> @jviega I can't do two chains of functions it seems |
18:57:35 | FromDiscord | <.aingel.> :type doesn't help |
18:57:42 | FromDiscord | <.aingel.> name.cstring.cast[:xmlchar] |
18:57:44 | FromDiscord | <.aingel.> Doesn't work |
18:57:55 | FromDiscord | <.aingel.> /Users/saint/code/margaretXML/parse.nim(84, 46) Error: undeclared identifier: 'cast' |
18:57:57 | FromDiscord | <jviega> Yeah I figured, cast seemed unlikely to actually be a function call, and more a builtin |
18:58:08 | FromDiscord | <Elegantbeef> Cast is not a procedure |
18:58:24 | FromDiscord | <.aingel.> So is there any way to what I want to do with that sort of syntax |
18:58:28 | FromDiscord | <.aingel.> chaining syntax I guess |
18:58:30 | FromDiscord | <.aingel.> Or not for cast |
18:58:31 | FromDiscord | <Elegantbeef> Make your own cast procedure or template that internally does ast |
18:58:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4H8o |
18:59:10 | FromDiscord | <Elegantbeef> `name.cstring.castTo[:XmlChar]()` now should work |
18:59:20 | FromDiscord | <jviega> Like I said people do it w/ the macro/template system if they care. I've seen libraries that will auto-chain on the first parameter |
18:59:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4H8p |
18:59:46 | FromDiscord | <Elegantbeef> Then you can jusut do `name.cstring.castTo(XmlChar)` |
19:04:02 | FromDiscord | <.aingel.> Interesting, thanks! |
19:05:26 | * | junaid_ quit (Remote host closed the connection) |
19:11:07 | * | advesperacit quit (Ping timeout: 264 seconds) |
19:11:32 | * | advesperacit joined #nim |
19:13:02 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "So you could load": Hey Beef, do you think concepts would be a good fit for this or should I just scrap it completely? |
19:13:40 | FromDiscord | <Elegantbeef> Where is the concept part? |
19:14:14 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4H8r |
19:14:19 | FromDiscord | <Chronos [She/Her]> Was tryna do something like this but |
19:14:24 | FromDiscord | <Elegantbeef> You've just described a fixed API 😄 |
19:14:36 | FromDiscord | <Chronos [She/Her]> Oh? |
19:14:56 | FromDiscord | <Elegantbeef> I mean what would be generic in the above case? |
19:15:17 | FromDiscord | <Chronos [She/Her]> Anything that implements the `next` field? |
19:15:28 | FromDiscord | <Chronos [She/Her]> Oh wait I don't need a concept for this do I |
19:15:33 | FromDiscord | <Elegantbeef> What would next even do? |
19:15:49 | FromDiscord | <Chronos [She/Her]> Store a child component |
19:15:58 | FromDiscord | <Chronos [She/Her]> Basically like a linked list I think |
19:16:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4H8s |
19:16:29 | FromDiscord | <Elegantbeef> Atleast it probably doesnt work |
19:16:48 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4H8u |
19:17:05 | * | mio joined #nim |
19:17:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4H8v |
19:17:33 | FromDiscord | <Elegantbeef> But that's also an endlessly recursive concept, so it might explode |
19:18:05 | FromDiscord | <Chronos [She/Her]> Hm |
19:18:42 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4H8w |
19:18:55 | FromDiscord | <Chronos [She/Her]> `cannot instantiate: 'none[T]'`, which makes sense but is also really annoying |
19:19:20 | FromDiscord | <Elegantbeef> `none[T]` is the default state |
19:19:27 | FromDiscord | <Elegantbeef> So it doesnt matter |
19:19:32 | FromDiscord | <Elegantbeef> Also it's `none(T)` |
19:20:32 | FromDiscord | <Chronos [She/Her]> concept |
19:20:33 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4H8x |
19:21:00 | FromDiscord | <Elegantbeef> Nah |
19:21:08 | FromDiscord | <Elegantbeef> It's just default values does not work with generics |
19:21:23 | FromDiscord | <Elegantbeef> Also your `TextComponent` needs to be generic |
19:21:32 | FromDiscord | <Chronos [She/Her]> Tbf I don't even need a concept, but then I don't know how I'd know what proc I need to use, unless I make it `method`s instead |
19:21:49 | FromDiscord | <Elegantbeef> Why is that an issue |
19:21:53 | FromDiscord | <Elegantbeef> You are not using runtime dispatch |
19:22:34 | FromDiscord | <Chronos [She/Her]> Wait am I being stupid hold on |
19:22:58 | FromDiscord | <Elegantbeef> I have an entire GUI that doesnt use `method`s 😄 |
19:24:04 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4H8A |
19:24:07 | FromDiscord | <Chronos [She/Her]> No clue about the issue honestly |
19:24:25 | FromDiscord | <Elegantbeef> Again `= none(T)` is useless |
19:24:26 | FromDiscord | <Elegantbeef> The default state of `Option[T]` is `none(T)` |
19:25:00 | FromDiscord | <Chronos [She/Her]> Ah I misread then |
19:26:08 | FromDiscord | <Elegantbeef> Well I said two things 😄 |
19:26:09 | FromDiscord | <Elegantbeef> It's `none(T)` and it's uselss |
19:26:13 | FromDiscord | <Elegantbeef> useless\ |
19:28:31 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4H8B |
19:28:41 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "It's `none(T)` and it's": you underestimate how blind I can be |
19:28:48 | FromDiscord | <Elegantbeef> read my messages |
19:28:58 | FromDiscord | <Elegantbeef> you made text component a generic but did not inherit it generically |
19:29:07 | FromDiscord | <Elegantbeef> `object of RootComponent[T]` |
19:29:08 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Also your `TextComponent` needs": I made it generic |
19:29:13 | FromDiscord | <Chronos [She/Her]> Wait |
19:29:16 | FromDiscord | <Chronos [She/Her]> Ah... |
19:29:33 | FromDiscord | <Chronos [She/Her]> Still does not help tho oof |
19:30:39 | FromDiscord | <Elegantbeef> `RootComponent[T: RootComponent] = object of RootObj` is endlessly recursive aswell |
19:31:00 | FromDiscord | <Chronos [She/Her]> Not sure what else to do :p |
19:31:30 | FromDiscord | <Elegantbeef> Not make your type endlessly recursive? |
19:32:14 | FromDiscord | <Chronos [She/Her]> By removing `T: RootComponent` and just doing `T` or... |
19:32:24 | FromDiscord | <Chronos [She/Her]> Maybe I should just stop being insane :p |
19:33:42 | FromDiscord | <Elegantbeef> Probably |
19:33:43 | FromDiscord | <Elegantbeef> `T: RootComponent` makes no sense on these |
19:33:55 | FromDiscord | <Chronos [She/Her]> Yeah it still doesn't work even with that |
19:34:06 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "`T: RootComponent` makes no": On `TextComponent` too? Why? |
19:34:40 | FromDiscord | <Chronos [She/Her]> No matter what I do tho it still dies so... Lost |
19:34:47 | FromDiscord | <.aingel.> Is there a way to access values from a named tuple by name without defining the type? |
19:35:30 | FromDiscord | <juancarlospaco> In reply to @.aingel. "Is there a way": By index. |
19:35:36 | FromDiscord | <.aingel.> so if I have var a = (cat: "meow", dog: "woof"), but I don't define a type, is there a way to get a.cat or something similar, apart from a[0] |
19:35:41 | FromDiscord | <.aingel.> In reply to @juancarlospaco "By index.": Yeah by name |
19:35:51 | FromDiscord | <.aingel.> Is there any way to do it by name without defining the type |
19:36:01 | FromDiscord | <juancarlospaco> In reply to @.aingel. "so if I have": `a.cat` |
19:36:47 | FromDiscord | <Elegantbeef> I don't know what to say Chronos this just an odd data type |
19:37:50 | FromDiscord | <.aingel.> In reply to @juancarlospaco "`a.cat`": Without defining the type? |
19:38:05 | FromDiscord | <.aingel.> It doesn't seem like I can do a.cat if I don't have a type defined |
19:38:06 | FromDiscord | <Elegantbeef> That's what named tuple fields are for |
19:38:18 | FromDiscord | <juancarlospaco> In reply to @.aingel. "so if I have": Thats an assign. |
19:38:29 | FromDiscord | <Elegantbeef> Also @Chronos [She/Her] it's `TextComponent[RootComponent[...]](...)` |
19:38:38 | FromDiscord | <Elegantbeef> You need to specify the generic parameter everywhere |
19:39:15 | FromDiscord | <.aingel.> In reply to @juancarlospaco "Thats an assign.": I'm talking about using a.meow given I have that |
19:39:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4H8D |
19:40:15 | FromDiscord | <.aingel.> Yeah hmm |
19:40:34 | FromDiscord | <.aingel.> Let me find another example where I think it breaks |
19:40:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/eLWzv |
19:42:43 | FromDiscord | <.aingel.> sent a code paste, see https://play.nim-lang.org/#ix=4H8G |
19:42:44 | FromDiscord | <.aingel.> Right here is my problem |
19:42:48 | FromDiscord | <.aingel.> The last line gives me a compile error |
19:43:19 | FromDiscord | <Elegantbeef> Of course it does |
19:43:27 | FromDiscord | <Elegantbeef> You want a object |
19:43:29 | FromDiscord | <Elegantbeef> Use an object |
19:43:40 | FromDiscord | <Elegantbeef> You can do `tuple[cat, dog: string]` but ugh |
19:43:53 | FromDiscord | <.aingel.> Oh |
19:43:53 | FromDiscord | <Elegantbeef> Better to do `array[Animal, string]` imo |
19:44:04 | FromDiscord | <.aingel.> Let me try that tuple syntax |
19:44:48 | FromDiscord | <.aingel.> `var b = initTable[string, tuple[cat: string, dog: string]]()` |
19:44:51 | FromDiscord | <.aingel.> Nice this works |
19:44:54 | FromDiscord | <.aingel.> Excellent |
19:44:57 | FromDiscord | <.aingel.> Ty |
19:45:11 | FromDiscord | <juancarlospaco> Named tuples can have enums as names too. |
19:45:21 | FromDiscord | <.aingel.> Gotcha |
19:45:23 | FromDiscord | <Elegantbeef> It's' also awful |
19:45:32 | FromDiscord | <Elegantbeef> > Named tuples can have enums as names too.↵What? |
19:45:32 | FromDiscord | <.aingel.> This is more about just the idea of writing something fast |
19:45:43 | FromDiscord | <.aingel.> Or flexibl |
19:45:44 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "I don't know what": Yeah fair enough |
19:45:53 | FromDiscord | <Chronos [She/Her]> Maybe I can get by, by using a linked list |
19:46:19 | FromDiscord | <Chronos [She/Her]> I could even just use a seq but like |
19:46:22 | FromDiscord | <Chronos [She/Her]> Eh |
19:46:36 | FromDiscord | <Elegantbeef> DOD 😄 |
19:46:52 | FromDiscord | <Chronos [She/Her]> Wdym? |
19:47:06 | FromDiscord | <Chronos [She/Her]> I didn't understand DOD a year ago and not now either |
19:48:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4H95 |
19:48:43 | FromDiscord | <Elegantbeef> Oh I actually have a DOD fractal tree |
19:49:09 | FromDiscord | <Chronos [She/Her]> If next is smaller than `0`, that means there's no more left? |
19:49:15 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4H9b |
19:49:25 | FromDiscord | <Elegantbeef> In this tree yes |
19:49:31 | FromDiscord | <Elegantbeef> It's the last in the branch |
19:53:39 | * | ntat quit (Quit: leaving) |
19:57:16 | FromDiscord | <Chronos [She/Her]> Fun |
19:57:42 | FromDiscord | <Chronos [She/Her]> Any benefits compared to a typical linked list? They seem like they do the same function |
19:58:24 | FromDiscord | <.aingel.> Whats DOD? |
19:58:25 | FromDiscord | <Chronos [She/Her]> Also all would be recasted into `RootComponent` which means I need to do refs and use methods (because if someone implements their own component, I need to be able to call it) |
19:58:33 | FromDiscord | <Chronos [She/Her]> Data-oriented design |
19:58:38 | FromDiscord | <.aingel.> Ah |
20:10:20 | FromDiscord | <Elegantbeef> DOD is cache coherent↵(@Chronos [She/Her]) |
20:12:53 | arkanoid | the web ui of nim forum is not working correctly for me |
20:35:35 | * | disso-peach joined #nim |
20:51:42 | NimEventer | New post on r/nim by momoPFL01: PR for NeoVim Treesitter support for Nim, see https://reddit.com/r/nim/comments/16pl1xg/pr_for_neovim_treesitter_support_for_nim/ |
21:10:55 | FromDiscord | <.aingel.> In reply to @NimEventer "New post on r/nim": ooh |
21:35:21 | arkanoid | why nimlsp vs Nim-lang/langserver ? |
21:40:58 | FromDiscord | <Mike> If I'm using nimlangserver, where are the project-specific settings supposed to go? The readme spells out the config options but not where I'm supposed to put them |
21:44:30 | FromDiscord | <Chronos [She/Her]> https://github.com/treeform/llama2.nim this is interesting, I wonder if there's anywhere that using it would actually have a point |
21:45:50 | FromDiscord | <Elegantbeef> I believe the configuration options listed are specifically for vscode, configuration for other editors is undocumented |
21:46:02 | * | advesperacit quit () |
21:46:04 | FromDiscord | <Mike> Ah. So on neovim i'm just out of luck? |
21:46:15 | FromDiscord | <Elegantbeef> Actually no, neovim and vim are documented now |
21:46:43 | FromDiscord | <Elegantbeef> Though those are global settings, so what do I know |
21:47:46 | FromDiscord | <Mike> Yeah I made it that far, but it kinda breaks when I open files in my project directory that aren't the main project file |
21:48:14 | FromDiscord | <Mike> Which I think means i need to add a config file for the project, which I don't know how to do |
21:48:30 | FromDiscord | <Elegantbeef> Time to make an issue |
21:48:52 | FromDiscord | <Mike> Yeah guess so. Just wanted to make sure I wasn't missing something. Thanks |
22:01:31 | * | def- quit (Quit: -) |
22:03:01 | * | def- joined #nim |
22:08:43 | FromDiscord | <Langosta> In reply to @Elegantbeef "It's' also awful": What makes tuples bad? Are there large negatives to tuples besides not being indexable? Or is it that they are inappropriate within this context? I ask since I'm still learning and want to learn best practices. |
22:10:10 | FromDiscord | <jviega> What do you mean by "not indexable?" |
22:10:53 | FromDiscord | <jviega> If you do: |
22:11:08 | FromDiscord | <jviega> `var f = ("a", "b", "c")` and then ask for `f[1]` you will get `"b"` |
22:11:45 | FromDiscord | <jviega> And named tuples can obviously be indexed by name |
22:11:48 | FromDiscord | <Chronos [She/Her]> In reply to @alendrik "What makes tuples bad?": Tuples mostly aren't great because having an actual object is just better, by most people's standards |
22:11:59 | FromDiscord | <Chronos [She/Her]> Better to have dedicated types with clear names |
22:12:48 | FromDiscord | <jviega> Yeah, if it's more than 2, maybe 3 items, or if the data object is going to be used across more than a function or so, an object is generally better |
22:17:10 | FromDiscord | <Elegantbeef> Tuples cannot be runtime indexed |
22:17:19 | FromDiscord | <Elegantbeef> Tuples are also structurally typed |
22:18:19 | FromDiscord | <jviega> Well sure, not at runtime, but if you aren't treating it as a mini struct anyway, you're doing it wrong. Never even occured to me people might try dynamic indices 🙂 |
22:24:41 | * | derpydoo quit (Ping timeout: 246 seconds) |
22:31:53 | FromDiscord | <Elegantbeef> I mostly agree with Odin's stance of multi return types |
22:32:31 | FromDiscord | <Elegantbeef> It does not have tuples but it does have `name :: proc(..) -> (X, Y)` |
22:33:08 | FromDiscord | <Elegantbeef> Using tuples is generally a code smell in my view, though there are cases they're completely fine |
22:33:27 | FromDiscord | <Elegantbeef> I really like using them as varadic generics |
22:34:56 | FromDiscord | <Chronos [She/Her]> My event system thing uses them by unpacking a tuple to be used when calling a proc :p |
22:35:11 | FromDiscord | <Chronos [She/Her]> https://github.com/Nimberite-Development/Trigger-Nim |
22:35:56 | FromDiscord | <Elegantbeef> Right, did I ever mention I added part of that functionality to Micros? 😄 |
22:36:03 | FromDiscord | <Chronos [She/Her]> https://github.com/Nimberite-Development/Trigger-Nim/blob/main/src/trigger.nim#L22 here |
22:36:11 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Right, did I ever": Oh? You haven't actually lol |
22:36:24 | FromDiscord | <Elegantbeef> https://github.com/beef331/micros/blob/master/src/micros/introspection.nim |
22:37:20 | FromDiscord | <Chronos [She/Her]> Epic! |
22:37:31 | FromDiscord | <Chronos [She/Her]> No reason for me to use micros as a dep for this single piece of code tho xD |
22:37:52 | FromDiscord | <Chronos [She/Her]> Also I wonder how well this would even map to C, probably pretty poorly lol (the API) |
22:38:12 | FromDiscord | <jviega> I think it's fine for something small like splitPath() |
22:38:28 | FromDiscord | <jviega> Esp when named, that's basically an object at that point. |
22:38:37 | FromDiscord | <Elegantbeef> I do really want to have micros full of things like this |
22:38:37 | FromDiscord | <Elegantbeef> Right jviega, that's a return type meant to be directly consumed |
22:39:03 | FromDiscord | <Elegantbeef> People base entire libraries on tuples and it's such a typeless hellscape |
22:39:11 | FromDiscord | <jviega> I do hate unpacking syntaxes and the overloading of the parenthesis |
22:40:40 | FromDiscord | <Elegantbeef> Meh the syntax is the least of my issues |
22:40:45 | FromDiscord | <.aingel.> In reply to @Elegantbeef "Tuples cannot be runtime": Whats an example when u want to runtime index something? Also what do you mean by structurally typed? |
22:41:15 | FromDiscord | <Elegantbeef> I mean I do not have a case right now, but I've seen it and ran into it myself |
22:41:37 | FromDiscord | <Elegantbeef> Structural typing is where only the fields have to match type |
22:41:54 | FromDiscord | <jviega> "structurally typed" means type equality occurs when the structure of the object is the same, even if the names are different |
22:42:04 | FromDiscord | <Chronos [She/Her]> In reply to @.aingel. "Whats an example when": Choosing options from a fixed array based on user input, perhaps? |
22:42:05 | FromDiscord | <.aingel.> Oh gotcha @jviega |
22:42:22 | FromDiscord | <Chronos [She/Her]> For the first question |
22:42:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Ha9 |
22:42:33 | FromDiscord | <.aingel.> In reply to @chronos.vitaqua "For the first question": Oh so u can't do that with tuples? |
22:42:47 | FromDiscord | <Elegantbeef> whoops |
22:42:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Haa |
22:42:52 | FromDiscord | <Chronos [She/Her]> Nope, at least, I don't think so according to Beef |
22:42:58 | FromDiscord | <.aingel.> Gotcha |
22:43:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Hab |
22:43:33 | FromDiscord | <.aingel.> How do you use the nim bot thing on discrd btw |
22:43:39 | FromDiscord | <.aingel.> Nim eval or whatever it is |
22:43:58 | FromDiscord | <jviega> Wow, `let` to a constant isn't treated as a constant? |
22:44:14 | FromDiscord | <Elegantbeef> Of course not |
22:44:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Had |
22:44:20 | FromDiscord | <Elegantbeef> What if you take the address of it somewhere |
22:44:46 | FromDiscord | <jviega> I mean, you can take the address of static data |
22:44:48 | FromDiscord | <.aingel.> In reply to @jviega "Wow, `let` to a": let is evaluated at run time right |
22:45:12 | FromDiscord | <Elegantbeef> You'd have to analyse the entire usage of the variable |
22:45:18 | FromDiscord | <.aingel.> In reply to @Elegantbeef "You need to do": Yeah I was thinking that you could do some sort of if statement and then put a constant in there |
22:45:32 | FromDiscord | <Elegantbeef> And if you write to that address? |
22:46:03 | FromDiscord | <Elegantbeef> Of course that proc only works on homogenously typed tuples |
22:46:27 | FromDiscord | <jviega> I suppose when `let` means "this one data object won't change, but its contents might"... |
22:46:46 | FromDiscord | <Elegantbeef> Well you can also override `let` |
22:47:49 | FromDiscord | <jviega> Personally, I'd rather just have `var` and `const`, the extra performance you can eke out isn't worth the complex semantics in my view. |
22:47:59 | FromDiscord | <jviega> Still I use `let` all the time |
22:48:04 | FromDiscord | <Elegantbeef> Eh immutability is nice |
22:48:14 | FromDiscord | <jviega> Except it's not really immutable |
22:48:21 | FromDiscord | <Elegantbeef> Except it is |
22:48:23 | FromDiscord | <jviega> In the sense that people except |
22:48:25 | FromDiscord | <jviega> expect |
22:48:50 | FromDiscord | <Elegantbeef> Nim is a language that says the programmer knows better |
22:48:51 | FromDiscord | <jviega> No, because you can still go into an "immutible" object and change its mutable fields |
22:49:04 | FromDiscord | <jmgomez> I would love to see const ref in Nim ngl |
22:49:04 | FromDiscord | <Elegantbeef> If you tell the compiler you know what you're doing, it's on you |
22:49:26 | FromDiscord | <Elegantbeef> You cannot go into an immutable value object and change it |
22:49:27 | FromDiscord | <Elegantbeef> Plus with strict funcs you cannot mutate a ref |
22:49:53 | FromDiscord | <jviega> Yeah but that's what I mean about complex semantics |
22:49:59 | FromDiscord | <Elegantbeef> It's not that complex imo |
22:52:13 | FromDiscord | <jviega> For my experience with the typical programmer, they occasionally still get surprised when stuff that automatically passes by ref is mutated by a call-ee, even if they've been programming in the language for decades. Or when local changes AREN'T reflected when things are truly immutable across a call boundry. And those are much simpler semantics. |
22:52:34 | FromDiscord | <Elegantbeef> jmgomez with `type ConstRef[T: ref] = distinct T` and `.` macros we technically can have const refs with an ok API |
22:54:10 | FromDiscord | <.aingel.> Is there a Debug Adapters DAP implementation for nim? |
22:54:21 | FromDiscord | <.aingel.> (edit) "Adapters DAP" => "Adapter (DAP)" |
22:54:29 | FromDiscord | <jviega> I'm personally fine with most levels of complexity. I've done most of my programming in life in C or some variant 🙂 But I care a lot about usability, let's remove as much of the knowledge burden from other smart people as possible. Not everyone cares about compilers, etc. How simple can you make it to equip them to be effective at what THEY do. |
22:54:42 | FromDiscord | <Chronos [She/Her]> In reply to @.aingel. "How do you use": !eval echo "Hi" |
22:54:48 | FromDiscord | <Chronos [She/Her]> Uh |
22:54:53 | FromDiscord | <Chronos [She/Her]> !eval echo "Hi" |
22:54:56 | FromDiscord | <Chronos [She/Her]> Hm |
22:54:56 | NimBot | Hi |
22:55:07 | FromDiscord | <Chronos [She/Her]> Oh there it is, just very slow lol |
22:55:32 | FromDiscord | <.aingel.> It seems to work better on IRC haha |
22:55:32 | FromDiscord | <jviega> Honestly, Nim's a lot better on that front than most languages in its class, which is part of why I'm here. |
22:55:43 | FromDiscord | <jviega> But it was mostly on accident I think 🙂 |
22:56:09 | FromDiscord | <Elegantbeef> I'd say that the present `let` semantics are a bit more useful than immutable refs |
22:56:29 | FromDiscord | <Elegantbeef> In your case you declare all `ref` as `var` and then can mutate where they point |
22:56:39 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4Hai |
22:57:48 | FromDiscord | <jmgomez> @jviega you seem to have a love/hate relationship with Nim 😛 |
22:58:01 | FromDiscord | <jviega> I suppose |
22:58:42 | FromDiscord | <jmgomez> In reply to @Elegantbeef "jmgomez with `type ConstRef[T:": yes, I guess. A bit convoluted but could work |
22:59:24 | FromDiscord | <jviega> I would say I've always loved languages and compilers. Used to teach uni classes on them at NYU too. Every language makes trade-offs, so will have stuff one doesn't like. I don't expect any to make all the tradeoffs I would make. |
23:00:22 | NimEventer | New thread by Millymox: How do i add and utilze a nested object when wrapping JS?, see https://forum.nim-lang.org/t/10510 |
23:01:45 | FromDiscord | <.aingel.> How do you get syntax highlight in the code blocks? |
23:01:54 | FromDiscord | <.aingel.> On discord |
23:02:05 | FromDiscord | <jmgomez> In reply to @jviega "I would say I've": Yes, that's a good take. I guess Nim is plus attractive on that context because you could technically build small things that you miss |
23:02:12 | FromDiscord | <millymox> In reply to @.aingel. "How do you get": Put the language just before making a new Line to input code block |
23:02:26 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4Hal |
23:02:28 | FromDiscord | <.aingel.> Ahh gotcha |
23:02:28 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix= |
23:02:34 | FromDiscord | <.aingel.> Thank you! |
23:02:37 | FromDiscord | <millymox> Np! |
23:03:23 | FromDiscord | <jviega> Yeah. I think there are plenty of corners of the language that are messy, where people dinked around a lot and things aren't polished enough. And I don't love that. But they're mostly in the corners, where most people don't see them. And I do like that. |
23:03:51 | FromDiscord | <jviega> Concepts for instance, are still pretty half baked |
23:04:11 | FromDiscord | <Elegantbeef> Don't you insult those poor little guys |
23:04:13 | FromDiscord | <jmgomez> Yeah, I feel that too. But it's kind of normal, there arent much resources |
23:04:16 | FromDiscord | <Elegantbeef> Concepts are lovely in their present state |
23:05:14 | FromDiscord | <jviega> The danger zone I think is with generics, especially the interaction with UFCS, but in general, I think when I've seen people stray outside the basic functionality zone, they tend to feel like they're playing "guess the syntax" |
23:06:10 | FromDiscord | <jmgomez> you mean the `[:` thing? |
23:06:47 | FromDiscord | <jviega> IDK, Beef. I've used them one or two places just fine, but EVERYONE we see ask questions about them ends up having a hard time wrapping their head around the fact that they're compile-time only. They really want to basically have as much static checking as possible, and then a boxed object at runtime, and have it be all automatic. Everyone expects interfaces |
23:06:59 | FromDiscord | <Chronos [She/Her]> Really wish I could make my own language sigh, but I just don't really have the motivation for them |
23:07:20 | FromDiscord | <Chronos [She/Her]> In reply to @jviega "IDK, Beef. I've used": Haha my mistake :p |
23:07:21 | FromDiscord | <Elegantbeef> Yea I don't disagree there |
23:07:24 | FromDiscord | <Elegantbeef> But once you grok them you realise that it's grand, plus I've got traitor 😛 |
23:07:30 | FromDiscord | <jviega> Yeah, more that if you don't know about [: the errors you end up with are often a big surprise in most ways |
23:08:11 | FromDiscord | <jmgomez> In reply to @jviega "IDK, Beef. I've used": Yeah, but as you said the issue is expectations not concepts itself. Concepts are a good take on parametric polymorphism, better than others IMO |
23:08:28 | * | krux02 quit (Remote host closed the connection) |
23:08:56 | FromDiscord | <jviega> I don't think they add enough value over the parametric polymorphism that's already there if you then have to manually translate to dynamic types |
23:08:59 | FromDiscord | <jmgomez> In reply to @jviega "Yeah, more that if": right, but this is more like a first class problem. Bugs are worst than that when they appear. It was disccused not so long ago in the compiler, and seems fixable |
23:09:27 | FromDiscord | <jmgomez> (edit) "In reply to @jviega "Yeah, more that if": right, but this is more like a first ... class" added "world" |
23:09:51 | FromDiscord | <jmgomez> (edit) "compiler," => "internal channel," |
23:10:05 | FromDiscord | <jviega> For me personally, I always hated the C++ style for generics, and preferred the ML style, where they're just type variables. `x is better than [T] for me |
23:11:17 | FromDiscord | <Elegantbeef> Any example of that ML style? |
23:11:36 | FromDiscord | <jviega> I just gave you one 🙂 |
23:11:42 | FromDiscord | <jmgomez> I prefer ML style too over C++ but I have to grant to C++ the flexibility that Nim seems inspired by |
23:12:05 | FromDiscord | <Elegantbeef> No you didnt |
23:12:06 | FromDiscord | <jviega> Yeah, if you want to constrain the types more you need to do something else |
23:12:09 | FromDiscord | <Elegantbeef> You just said `x` is better than `[T]` but without context that means less than Nothing |
23:12:13 | FromDiscord | <jviega> Sure |
23:12:44 | FromDiscord | <jmgomez> In reply to @jviega "Yeah, if you want": that's why concepts exists in both langs 🙂 |
23:13:08 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix= |
23:13:43 | FromDiscord | <Elegantbeef> So implicit generics |
23:13:44 | FromDiscord | <Elegantbeef> Gotcha |
23:14:00 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix= |
23:14:09 | FromDiscord | <jviega> There's nothing implicit about it. I still give a name to the types. |
23:14:16 | FromDiscord | <Elegantbeef> I mean it's implicit |
23:14:26 | FromDiscord | <jviega> ML did do type inference of course, but that's beside the point |
23:14:29 | FromDiscord | <Elegantbeef> `proc sort(a: auto): typeof(a)` |
23:14:35 | FromDiscord | <jviega> ML was the first language w/ generics |
23:15:28 | FromDiscord | <jmgomez> I mean, what I like more (or used to) about the ML family is the strictness. But nowdays I think I prefer flexibility |
23:16:10 | FromDiscord | <jviega> You can get flexibility w/ a syntax where you don't have to overload the bracket that badly if types can be first class parameters |
23:17:01 | FromDiscord | <Elegantbeef> Just use Zig style generics with Nim UFCS |
23:17:16 | FromDiscord | <jviega> I've done some pretty involved hindley-milner based systems with tons of features |
23:18:18 | FromDiscord | <jmgomez> didnt look into Zig yet, doesnt attract me much but I guess I will to take the time to go over it at some point |
23:18:32 | FromDiscord | <jmgomez> In reply to @jviega "I've done some pretty": oh really? You should help with the compiler 😛 |
23:18:37 | FromDiscord | <jviega> Anyway, my wife isn't thrilled with this discussion on type systems, and would much rather follow through on our dinner plans. |
23:18:57 | FromDiscord | <Langosta> you should invite her! |
23:19:03 | FromDiscord | <Elegantbeef> Zig doesnt have generics and to do it you have to make a function that takes in the typedesc |
23:19:08 | FromDiscord | <Langosta> I'm sure she would love to talk more about tuples and type systems |
23:19:21 | FromDiscord | <Chronos [She/Her]> Generics are something I like tbh |
23:19:25 | FromDiscord | <Elegantbeef> so like `proc sort(t: typedesc, s: ptr UncheckedArray[t]) ...` |
23:19:31 | FromDiscord | <jviega> I think Nim's got too much legacy cruft for me to want to wade in that deep. Maybe if I cared enough about something I'd do some small PRs, but wouldn't get excited to work on it |
23:20:00 | FromDiscord | <Elegantbeef> Araq wants to replace the Nim TypeNodes so it's the perfect time! |
23:20:25 | FromDiscord | <Elegantbeef> Or atleast clean it up |
23:20:31 | FromDiscord | <jmgomez> exactly, I had zero experience with compilers before Nim and didnt find the code that legacy |
23:20:43 | FromDiscord | <jmgomez> Im also used to UE which is real legacy 😛 |
23:21:14 | FromDiscord | <jmgomez> In reply to @Elegantbeef "so like `proc sort(t:": I see, thanks |
23:21:58 | FromDiscord | <jviega> I mean, how many different memory managers are there again? |
23:22:25 | FromDiscord | <jviega> Okay see ya! |
23:22:33 | FromDiscord | <Elegantbeef> There are really only 3( + JS) supported ones |
23:32:13 | FromDiscord | <millymox> In reply to @Elegantbeef "There are really only": How can i make an option param for a proc? |
23:34:04 | FromDiscord | <Chronos [She/Her]> In reply to @millymox "How can i make": Option param as in default value? |
23:34:17 | FromDiscord | <Chronos [She/Her]> Or as in actual Option type |
23:34:26 | FromDiscord | <millymox> No like a param that basically doesn’t need to be set its purely optional |
23:34:54 | FromDiscord | <millymox> Proc main(param1: string) |
23:34:59 | FromDiscord | <Chronos [She/Her]> And if it's not set, does nothing in the code? Assuming a boolean doesn't work |
23:35:08 | FromDiscord | <millymox> Yeah does nothing |
23:35:11 | FromDiscord | <Chronos [She/Her]> Does an empty string work? `param1: string = ""`? |
23:35:30 | FromDiscord | <Chronos [She/Her]> It's the go-to for most people |
23:35:33 | FromDiscord | <millymox> What about a Boolean? |
23:35:45 | FromDiscord | <millymox> Optionally set true por false or leave blank |
23:35:50 | FromDiscord | <millymox> Or |
23:36:13 | FromDiscord | <Chronos [She/Her]> Booleans have to be true or false, but you can use `std/options` |
23:36:57 | FromDiscord | <Chronos [She/Her]> It has an `Option` type, so you could do `var a = none(bool)` for example, and that'd mean that no value was given |
23:36:58 | FromDiscord | <Chronos [She/Her]> Hold on |
23:37:47 | FromDiscord | <Chronos [She/Her]> sent a long message, see http://ix.io/4Haw |
23:37:49 | FromDiscord | <Chronos [She/Her]> I hope that works lol |
23:38:04 | FromDiscord | <millymox> sent a code paste, see https://paste.rs/S2dGj |
23:38:37 | FromDiscord | <Chronos [She/Her]> Nope it most definitely will not lol |
23:38:48 | FromDiscord | <Chronos [She/Her]> Why are you doing `show = bool`? |
23:38:55 | FromDiscord | <Chronos [She/Her]> `bool` is the type |
23:39:11 | FromDiscord | <Chronos [She/Her]> You probably want `show = false` since that's considered the default value for everything |
23:39:21 | FromDiscord | <Chronos [She/Her]> Though look at the docs |
23:39:26 | FromDiscord | <Chronos [She/Her]> They may say something different |
23:39:28 | FromDiscord | <Chronos [She/Her]> (JS docs) |
23:39:39 | FromDiscord | <Chronos [She/Her]> I'm not an expert in the JS backend really |
23:39:50 | FromDiscord | <millymox> ahh okay okay thank you |
23:39:58 | FromDiscord | <Chronos [She/Her]> Sorry aha |
23:40:00 | FromDiscord | <millymox> ill see the show = false |
23:40:04 | FromDiscord | <millymox> Np np |
23:41:03 | FromDiscord | <millymox> In reply to @chronos.vitaqua "You *probably* want `show": This works! |
23:41:06 | FromDiscord | <millymox> Thanks so much |
23:41:31 | FromDiscord | <Chronos [She/Her]> Eyy nice! |
23:45:25 | FromDiscord | <millymox> Yep! |