00:13:41 | FromDiscord | <snluu> Hi! Searching through the standard library, but I probably missed it. What modules/procs can I use to do things like listing files in a directory, getting file metadata (time created, size) etc. |
00:13:52 | disruptek | see the os module. |
00:14:38 | FromDiscord | <snluu> thanks! |
00:15:19 | * | Hideki_ joined #nim |
00:23:33 | * | Hideki_ quit (Remote host closed the connection) |
00:24:25 | * | Hideki_ joined #nim |
00:25:42 | clyybber | gn8 peeps |
00:25:44 | * | clyybber quit (Quit: WeeChat 2.7) |
00:28:49 | * | Hideki_ quit (Ping timeout: 258 seconds) |
00:41:06 | * | krux02_ joined #nim |
00:43:48 | * | krux02 quit (Ping timeout: 248 seconds) |
00:48:22 | sealmove | standard way to convert seq[byte] to string? |
01:01:10 | * | Hideki_ joined #nim |
01:13:15 | * | Hideki_ quit (Ping timeout: 240 seconds) |
01:13:27 | * | krux02_ quit (Remote host closed the connection) |
01:15:16 | * | seni quit (Quit: Leaving) |
01:22:28 | * | voltist joined #nim |
01:43:24 | * | icebattle quit (Ping timeout: 246 seconds) |
01:45:45 | * | icebattle joined #nim |
02:09:46 | FromDiscord | <Kaynato> @mratsim I'm porting an argmax_max with random tiebreaks which includes parallel argmax from my python RL framework, and I found the note you made about the degradation on MNIST. The following is what I was about to port (https://hastebin.com/kejuvigeho.py) - would using the regular old threadpool parallel/spawn work sensibly or would there be other things to worry about? |
02:46:53 | * | voltist quit (Remote host closed the connection) |
02:54:44 | * | sagax quit (Read error: Connection reset by peer) |
02:59:17 | FromGitter | <gogolxdong> What's the usage of `untyped{ident}`? |
02:59:45 | FromGitter | <gogolxdong> what's the `ident ` and the `{}`? |
03:00:18 | FromGitter | <gogolxdong> why could it follow untyped? |
03:02:14 | * | sagax joined #nim |
03:10:28 | sealmove | gogolxdong where did you see it? |
03:11:17 | FromGitter | <gogolxdong> https://github.com/mratsim/weave/blob/master/weave/parallel_for.nim |
03:12:07 | FromGitter | <gogolxdong> Is this hidden magic? |
03:16:04 | FromGitter | <dumjyl> It restricts the input to nodes of kind `nkIdent`. https://play.nim-lang.org/#ix=24PY |
03:17:20 | FromGitter | <dumjyl> See https://nim-lang.org/docs/manual_experimental.html#ast-based-overloading and https://nim-lang.org/docs/manual_experimental.html#term-rewriting-macros-parameter-constraints |
03:19:42 | FromGitter | <gogolxdong> ah, it's documented in experimental manual. |
03:23:14 | * | icebattle quit (Ping timeout: 240 seconds) |
03:44:40 | * | pbb quit (Ping timeout: 252 seconds) |
03:50:15 | * | endragor joined #nim |
03:59:34 | * | endragor quit (Remote host closed the connection) |
04:02:06 | * | sealmove quit (Quit: WeeChat 2.6) |
04:02:40 | * | endragor joined #nim |
04:03:39 | * | endragor quit (Remote host closed the connection) |
04:20:41 | * | pbb joined #nim |
04:24:27 | * | nsf joined #nim |
04:24:28 | * | chemist69 quit (Ping timeout: 245 seconds) |
04:26:43 | * | chemist69 joined #nim |
04:28:36 | * | pbb quit (Ping timeout: 246 seconds) |
04:29:03 | * | pbb joined #nim |
04:39:59 | FromDiscord | <snluu> when would one use `= ref RootObj` vs just (ref) `object` when declaring a new object type? |
04:40:14 | FromDiscord | <snluu> is RootObj required for inheritance? |
04:47:05 | nisstyre | I think it is required to do it at runtime |
04:47:13 | nisstyre | https://nim-lang.org/docs/tut2.html |
04:50:28 | * | endragor joined #nim |
04:59:42 | FromDiscord | <snluu> Thanks! |
05:01:08 | FromDiscord | <snluu> so, if I have something like `type Dog = object of Animal`, is there a short hand to create a new `ref Dog` object without having an explicit `type DogRef = ref Dog`? |
05:04:28 | disruptek | is `ref Dog` too long? |
05:08:57 | FromDiscord | <snluu> no, i mean, can I create a ref object without declaring a ref type? |
05:09:14 | disruptek | sure. |
05:10:01 | FromDiscord | <snluu> `var x: ref Animal`. How do I assign a `ref Dog` to `x` |
05:10:02 | FromDiscord | <snluu> ? |
05:10:19 | FromDiscord | <snluu> `x = ref Dog()` does not work |
05:10:27 | disruptek | you don't; x is a ref Animal. |
05:10:45 | * | Hideki_ joined #nim |
05:10:47 | FromDiscord | <snluu> if I have a `type DogRef = ref Dog`, `x = DogRef()` work just fine |
05:10:55 | disruptek | sure. |
05:11:58 | FromDiscord | <snluu> so thatโs what Iโm asking, is there a shorthand to `DogRef()` to create a new instance of `ref Dog` without explicitly declaring `DogRef` type |
05:15:10 | * | Hideki_ quit (Ping timeout: 258 seconds) |
05:15:21 | FromDiscord | <snluu> https://play.nim-lang.org/#ix=24Qd |
05:15:21 | FromDiscord | <snluu> Can I do this without having `type DogRef` |
05:28:12 | FromDiscord | <snluu> I guess I can do `x = (ref Dog)()` |
05:41:05 | * | Tanger quit (Remote host closed the connection) |
05:43:56 | * | narimiran joined #nim |
05:52:45 | * | gour joined #nim |
05:56:40 | * | lvmbdv quit (Quit: OH GOD THE CLINTONS CAME FOR ME) |
06:03:51 | * | lorenthal joined #nim |
06:03:58 | lorenthal | Hello everyone |
06:04:56 | * | lorenthal left #nim (#nim) |
06:16:01 | * | Tanger joined #nim |
06:30:46 | * | lorenthal joined #nim |
06:30:59 | * | lorenthal left #nim (#nim) |
06:41:09 | * | solitudesf joined #nim |
06:43:43 | * | ikan-keli_2 joined #nim |
06:44:43 | * | ikan-keli_ quit (Ping timeout: 268 seconds) |
07:02:07 | FromDiscord | <Kayaba> I saw I got a ping from Discord. Joined here to comment. |
07:02:07 | FromDiscord | <Kayaba> |
07:02:07 | FromDiscord | <Kayaba> It's interesting to see KMD get involved. Mind if I ask what specifically you're working on, @Slyris? |
07:22:38 | FromDiscord | <Milerius> Hello @Kayaba I'm working on the Desktop port of https://atomicdex.io, repo is here: https://github.com/KomodoPlatform/atomicDEX-QT (nim is in https://github.com/KomodoPlatform/atomicDEX-QT/tree/master/atomic_dex_desktop) |
07:23:08 | FromDiscord | <Milerius> atomicdex is a fully decentralized exchange, you can learn more here: https://komodoplatform.com/atomicdex-komodos-revolutionary-p2p-atomic-swap-decentralized-exchange-now-in-public-beta/ |
07:23:34 | FromDiscord | <Milerius> And here: https://komodoplatform.com/decentralized-exchange/ |
07:24:44 | FromDiscord | <Kayaba> Yep, I know what it is ๐ I've kept an eye onm Komodo's work for a while now despite not being the largest fan. |
07:26:45 | FromDiscord | <Milerius> No solution is perfect @Kayaba ๐คท |
07:28:33 | FromDiscord | <Kayaba> My main issue is with DPoW and cultism. Prime example of the latter is the modified SPV protocol which has some benefits yet was claimed to revolutionize making BTC accessible ๐ |
07:29:17 | FromDiscord | <Kayaba> Anyways. Happy to talk more in PM as I do appreciate AtomicDEX and this may not be the best place to have a long discussion ๐ |
07:29:27 | FromDiscord | <Milerius> Yeah doesn't hesitate ! |
07:29:31 | FromDiscord | <Milerius> i would love ! |
07:41:54 | * | PMunch joined #nim |
07:44:40 | * | ikan-keli_2 quit (Quit: ZNC 1.8.x-git-125-e415d9f5 - https://znc.in) |
07:44:46 | * | junland quit (Quit: %ZNC Disconnected%) |
07:46:02 | * | junland joined #nim |
07:46:26 | * | ikan-keli_ joined #nim |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:04:58 | * | gmpreussner joined #nim |
08:07:54 | * | dddddd quit (Remote host closed the connection) |
08:23:12 | Araq | anybody awake? want to listen to me streaming about the new runtime? |
08:27:15 | PMunch | With pleasure :) |
08:27:34 | federico3 | yup |
08:28:22 | Araq | https://www.twitch.tv/araq4k |
08:31:39 | * | krux02 joined #nim |
08:37:50 | * | Vladar joined #nim |
08:43:50 | FromDiscord | <Fern & Simula (They/Them)> I've got an `Ident` node. is there any way to check the identifier's type? |
08:44:39 | PMunch | .kind? |
08:45:10 | FromDiscord | <Fern & Simula (They/Them)> that's just nnkIdent |
08:45:30 | PMunch | Oh you want to check the type of what the ident points to |
08:45:50 | FromDiscord | <Fern & Simula (They/Them)> yeah |
08:46:22 | FromDiscord | <Fern & Simula (They/Them)> alternatively, a way to check if a type is valid for fieldpairs would also work |
08:46:39 | FromDiscord | <Fern & Simula (They/Them)> that's probably what i actually want lol |
08:48:30 | PMunch | https://play.nim-lang.org/#ix=24QD |
08:50:20 | FromDiscord | <Fern & Simula (They/Them)> awesome, thank you! |
08:50:42 | PMunch | No problem :) |
08:50:52 | FromDiscord | <Fern & Simula (They/Them)> nope, `node has no type` |
08:51:06 | FromDiscord | <Fern & Simula (They/Them)> wait |
08:51:06 | PMunch | Ah, you need to have your macro argument as `typed` |
08:51:19 | FromDiscord | <Fern & Simula (They/Them)> ah, alright |
08:52:09 | PMunch | Essentially the difference is that untyped happens before type checking, which is handy if what you pass in isn't actually Nim code but rather some random DSL. And typed happens after type checking which means that it has to be valid Nim code, but you get all the information Nim has about the input. |
08:53:01 | FromDiscord | <Fern & Simula (They/Them)> nope, still not working. macro only accepts identifiers |
08:53:16 | FromDiscord | <Fern & Simula (They/Them)> oh thats my own error |
08:53:42 | FromDiscord | <Fern & Simula (They/Them)> lol im so confused by what im doing |
09:04:11 | FromDiscord | <Fern & Simula (They/Them)> is there a way to check if a type is a nim builtin, ie not user-defined? |
09:04:20 | PMunch | Like int or string? |
09:04:48 | FromDiscord | <Fern & Simula (They/Them)> yeah |
09:04:59 | FromDiscord | <Fern & Simula (They/Them)> but for all nim types so i don't have to manually compare |
09:05:30 | PMunch | I guess check if getTypeImpl is just a single identifier |
09:05:53 | FromDiscord | <Fern & Simula (They/Them)> i think i want NimTypeKind |
09:06:06 | PMunch | Maybe with some logic to discern distinct types if you need that |
09:07:17 | FromDiscord | <KcVinu> I have type named Button which inherits another type named Control. This Control type have a proc named "text" which gives the text of the control. But how do i limit this proc to only specific types like Button, Label, Edit etc. Because, i don't want to use this proc for ListView, Menubar etc. |
09:07:55 | PMunch | y.getType.typeKind should work |
09:08:05 | PMunch | But note you will get ntyDistinct if it is a distinct type |
09:08:05 | * | clyybber joined #nim |
09:08:48 | PMunch | KcVinu, make another type |
09:09:01 | PMunch | Control -> Labeled -> Button |
09:09:14 | PMunch | And then have Control -> ListView |
09:09:17 | FromDiscord | <KcVinu> You mean make a clone of Control - ? |
09:10:13 | FromDiscord | <KcVinu> Is there any interface like things in nim ? |
09:12:29 | * | Hideki_ joined #nim |
09:17:12 | * | Hideki_ quit (Ping timeout: 265 seconds) |
09:22:33 | * | letto quit (Quit: Konversation terminated!) |
09:23:55 | * | letto joined #nim |
09:29:14 | FromDiscord | <Fern & Simula (They/Them)> can i pass multiple identifiers to a single typed macro body? like this example https://play.nim-lang.org/#ix=24QX |
09:33:11 | FromGitter | <gogolxdong> Is live streaming video recorded as well, we cannot access twitch without VPN from China. |
09:35:04 | FromGitter | <gogolxdong> Is it possible to send us a copy after live streaming? |
09:36:25 | FromGitter | <bung87> what โs the syntax import c pointer of struct ? |
09:41:24 | * | akitoshi quit (Quit: Connection closed for inactivity) |
10:00:36 | * | marmotini_ joined #nim |
10:01:11 | * | marmotini_ quit (Remote host closed the connection) |
10:01:12 | FromGitter | <sheerluck> @gogolxdong yes you can access video after live streaming: https://www.twitch.tv/araq4k/videos |
10:01:33 | * | NimBot joined #nim |
10:07:31 | FromGitter | <gogolxdong> I mean twitch is banned. |
10:07:49 | FromGitter | <gogolxdong> Is there any video copy? |
10:25:45 | * | marmotini_ quit (Remote host closed the connection) |
10:26:21 | * | Vladar quit (Quit: Leaving) |
10:29:05 | FromGitter | <gogolxdong> @Araq, you can upload to youtube so that we can get an English caption. |
10:31:00 | federico3 | Araq: doesn't the stream of Hints: bother you? |
10:33:34 | * | krux02 quit (Remote host closed the connection) |
10:34:59 | FromGitter | <bung87> found interesting thing https://github.com/iovisor/bcc |
10:36:50 | Araq | federico3, for me it's a shitty "progress" report |
10:37:05 | Araq | gogolxdong: will upload to youtube later, probably shorten it |
10:37:29 | Araq | turned out to be way more frustrating than I anticipated |
10:37:38 | federico3 | we could have a better one - how about dots printed on the current line and disabling Hints: by default? |
10:38:04 | clyybber | its handy to know what actually gets compiled |
10:38:31 | Araq | federico3, some real progress bar would be better, maybe we can calculate it somehow |
10:38:59 | federico3 | that could be a next step after the dots perhaps |
10:40:18 | federico3 | it could come out neatly as part of implementing parallel compilation |
10:40:20 | * | clyybber quit (Remote host closed the connection) |
10:41:08 | Araq | parallel compilation is nice but all my bets are on incremental compilation |
10:41:52 | Araq | which is slightly easier to get right and brings more benefit |
10:41:59 | federico3 | both should allow adding the progress bar I suppose |
10:42:47 | federico3 | incremental unit tests would be nice and good PR |
10:46:40 | Araq | the priorities are clear IMO, focus on --gc:arc for better runtime speed and embedded devices, then focus on IC for a better developer experience |
10:51:05 | federico3 | is arc == newruntime? |
10:53:35 | Araq | yes |
11:04:58 | federico3 | yay \o/ |
11:05:43 | * | marmotini_ joined #nim |
11:07:47 | FromGitter | <Willyboar> New gc, new threading. Perfect |
11:10:11 | Zevv | new threading how so? |
11:10:36 | FromGitter | <Willyboar> Weave |
11:24:07 | FromGitter | <alehander92> i think such a progress bar can be done |
11:24:13 | FromGitter | <alehander92> even now without problems |
11:24:51 | FromGitter | <alehander92> its especially useful for file watchers etc, where i turned off hints for now just to be able to easily see errors when i compile >10 outputs |
11:47:15 | FromDiscord | <kodkuce> did isAlphaAsci got removed form string? |
11:49:19 | FromDiscord | <kodkuce> https://nim-lang.org/docs/strutils.html#isAlphaAscii%2Cstring |
11:53:34 | FromGitter | <alehander92> its a good removal |
11:53:40 | FromGitter | <alehander92> but it needs a "use hint" |
11:53:43 | FromGitter | <alehander92> in the docs |
11:54:10 | FromGitter | <alehander92> usually people probably need stringValue.allIt(it.is..) |
12:02:46 | * | Vladar joined #nim |
12:04:50 | PMunch | KcVinu, no there aren't anything strictly like an interface in Nim. What I meant was to do it in two levels of inheritance, that's how you would usually do these things. However you can do all of this without any object inheritance at all. |
12:05:29 | PMunch | Fern (can't be arsed to type out your name), you can do varargs typed: https://play.nim-lang.org/#ix=24Rm |
12:06:01 | PMunch | bung87, do you have a specific example of what you want to import? |
12:06:27 | * | nsf quit (Quit: WeeChat 2.6) |
12:10:55 | FromGitter | <bung87> seems ,I got it work, if c using typedef just need type X โฆ = object whether it refers to a struct or point of struct |
12:13:52 | FromGitter | <bung87> `psutil_get_proc_list(struct kinfo_proc **procList, size_t *procCount) ` now Iโm struggle with `**procList` |
12:18:00 | FromGitter | <bung87> https://github.com/bung87/psutil-nim/blob/master/src/psutil/psutil_macosx.nim#L311 see if anyone interested in and could help me fix this |
12:20:18 | * | marmotini_ quit (Remote host closed the connection) |
12:22:56 | * | B_ceecbgh joined #nim |
12:28:53 | * | marmotini_ joined #nim |
12:29:55 | * | marmotini_ quit (Remote host closed the connection) |
12:30:03 | * | B_ceecbgh quit (Ping timeout: 265 seconds) |
12:33:19 | PMunch | That is a pointer to a list |
12:33:50 | PMunch | So you just create a sequence and then you pass mySeq[0].addr to procList and mySeq.len to procCount |
12:33:53 | * | marmotini_ joined #nim |
12:36:42 | PMunch | bung87 ^ |
12:36:51 | FromGitter | <bung87> but seq compatible ? |
12:37:44 | FromGitter | <bung87> araq told me seq not compatible |
12:38:38 | * | marmotini_ quit (Client Quit) |
12:39:38 | FromGitter | <bung87> and the original python c version check the address and value |
12:40:13 | PMunch | Well a seq directly isn't compatible, as it has the size and capacity stored |
12:40:37 | PMunch | But the pointer to the first element is the same as a pointer to a sequence of elements |
12:40:53 | Zevv | to an *array* of elements |
12:40:56 | Zevv | in nim-speak |
12:40:59 | FromGitter | <Willyboar> @alehander92 I create a repo. I will work on that today. |
12:41:00 | PMunch | Err, yes |
12:41:01 | PMunch | Sorry |
12:41:13 | Zevv | bung87: http://zevv.nl/nim-memory/ |
12:41:21 | FromGitter | <bung87> but it doest not has a const length |
12:41:26 | Zevv | section "how_nim_stores_data_in_memory" |
12:41:52 | PMunch | Oh cool, I have been meaning to write exactly that article |
12:42:28 | FromGitter | <alehander92> @Willyboar ok ! |
12:43:16 | Zevv | PMunch: that would be plagiarism, no? |
12:43:47 | PMunch | Haha, well maybe not that exact article :P But an article with exactly the same kind of content. But now I don't have to :) |
12:43:52 | Zevv | :) |
12:43:58 | Zevv | But wait: it is far from complete |
12:44:12 | Zevv | so if you ever find yourself bored, you might want to consider adding some missing sections |
12:44:15 | Zevv | see the bottom notes |
12:44:21 | FromGitter | <bung87> good article! |
12:44:52 | Zevv | missing is: GC alternatives, nim without GC, newruntime, closures, FFI |
12:45:24 | * | Hideki_ joined #nim |
12:46:20 | FromGitter | <bung87> oh, I forget 2 problem |
12:48:08 | FromGitter | <bung87> when import c struct do I need porting full structure? when I need cast it to ptr UnCheckedArray[structA] |
12:48:37 | FromDiscord | <mratsim> if it's always manipulated via pointers no |
12:49:24 | FromGitter | <bung87> well Iโll need dereference and access it property |
12:51:02 | PMunch | Well as long as you have the memory allignment right it doesn't matter |
12:53:46 | FromGitter | <bung87> oh I just got it work.`proclist:ref StructKinfoProc`, `proclist = new StructKinfoProc` |
12:54:37 | FromGitter | <bung87> I dont need porting exactly c logic right? |
12:55:34 | FromDiscord | <mratsim> in doubt, have tests ๐ |
12:56:07 | FromGitter | <bung87> unless the end developer turn off gc ... |
12:58:45 | FromGitter | <bung87> I ignore serveral c pointer nil check |
13:07:27 | * | marmotini_ joined #nim |
13:11:14 | * | MarderIII joined #nim |
13:17:10 | * | letto quit (Quit: Konversation terminated!) |
13:18:51 | * | MarderIII quit (Quit: Leaving) |
13:30:21 | * | letto joined #nim |
13:33:51 | * | endragor quit (Remote host closed the connection) |
13:34:10 | * | Vladar quit (Quit: Leaving) |
13:36:02 | * | marmotini_ quit (Remote host closed the connection) |
13:45:50 | * | couven92 joined #nim |
13:49:25 | * | Hideki_ quit (Ping timeout: 268 seconds) |
13:52:38 | * | marmotini_ joined #nim |
14:00:52 | * | clyybber joined #nim |
14:05:05 | couven92 | Okay, I updating my Nim code nim 0.17.1 to 1.0... First of all: strings cannot be nil as I understand, do I change my code to return an empty literal instead? |
14:05:29 | couven92 | do we have a default literal (like the defaul keyword in C#)? |
14:05:29 | disruptek | hearts and minds, people; hearts and minds! |
14:05:45 | disruptek | couven92: you can use "" or use a cstring, which can be nil. |
14:06:02 | disruptek | strings are "" by default. |
14:07:32 | FromDiscord | <Rika> if you `var x: string` its == to `""` by default |
14:12:24 | PMunch | couven92, yeah it depends on if this is a direct link with some C code or not |
14:12:51 | PMunch | But empty literal is the preferred way (unless these two things should be kept separate, in which case you should use the Option type) |
14:13:01 | couven92 | okay, next one: I have a macro returning `typed`. Nim warns that `typed` is deprecated... It says that `void` can be used instead of `typed`? |
14:13:11 | PMunch | !eval var x = default(string); echo x.len |
14:13:14 | NimBot | 0 |
14:13:17 | FromGitter | <iffy> Anyone know of a Nim package for accessing the OS keyring (for macOS/Windows/Linux)? Comparable to https://github.com/zalando/go-keyring |
14:13:46 | disruptek | couven92: try `untyped` instead. |
14:13:47 | PMunch | couven92, that sounds weird. Link? |
14:13:58 | PMunch | But yeah, untyped is more common |
14:14:29 | disruptek | void is the peeled type, but i think we're discouraged from using it in code. |
14:15:58 | couven92 | `typed` will change its meaning in future versions of Nim. `void` or no return type declaration at all has the same meaning as the current meaning of `typed` as return type declaration. [Deprecated] |
14:16:00 | couven92 | https://github.com/couven92/nim-windowssdk/blob/master/src/windowssdk/ansiwide.nim#L79-L81 |
14:16:46 | couven92 | It is a macro that invokes a proc returning a NimNode |
14:17:13 | disruptek | untyped |
14:18:47 | couven92 | ok... Why? There was a reason I didn't return `untyped` all those years ago... |
14:19:14 | disruptek | what was that reason? |
14:19:30 | * | Hideki_ joined #nim |
14:20:07 | disruptek | nim will turn the nimnode into whatever type it evaluates to, but since nimnode could be anything, `untyped`. |
14:20:51 | couven92 | I don't remember. But I think it's because I actually want to state that I return valid code... |
14:21:32 | disruptek | the compiler will verify that for ya. |
14:21:37 | disruptek | nice feature of compilers. |
14:21:51 | disruptek | well, /some/ compilers. |
14:24:06 | * | Hideki_ quit (Ping timeout: 258 seconds) |
14:24:20 | couven92 | okay, next one: `unchecked` is no longer a valid pragma to declare a type that maps to an array of any length? |
14:24:28 | couven92 | (Yes I know that is unsafe!) |
14:25:13 | couven92 | and also, pragma before generic argument list i deprecated? Put it after? |
14:25:54 | couven92 | so I have: `type AnySizeArray*[T] {.unchecked.} = array[0, T]` |
14:26:05 | couven92 | what do I write instead of `unchecked`? |
14:34:49 | solitudesf | https://nim-lang.github.io/Nim/manual.html#types-unchecked-arrays |
14:35:05 | solitudesf | use this instead of your type |
14:35:10 | couven92 | solitudesf, ah, thx! :) |
14:37:19 | FromDiscord | <Milerius> Hello, I would like to use `folly::ConcurrentHashMap` from c++ Folly library, I Successfully imported the type in my code. |
14:37:19 | FromDiscord | <Milerius> |
14:37:20 | FromDiscord | <Milerius> Now i'm asking my self how i can iterator over this collection. |
14:37:20 | FromDiscord | <Milerius> |
14:37:20 | FromDiscord | <Milerius> in c++ i have 2 ways to do it: for ranges and iterator. |
14:37:20 | FromDiscord | <Milerius> |
14:37:23 | FromDiscord | <Milerius> Let's say i want to do it with iterator, i looked at the iterator page of Nim, but there is no example for an imported type such as **std::map** for example. |
14:37:23 | FromDiscord | <Milerius> |
14:37:26 | FromDiscord | <Milerius> I know we can import iterator too, is the solution to import both const iterator from c++ and import dereference operator too and use it in a yield ? |
14:37:30 | FromDiscord | <Milerius> I must admit that i have some trouble. |
14:37:43 | * | Yardanico quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
14:41:18 | FromDiscord | <Milerius> there is the usage in c++: https://gist.github.com/Milerius/5780d7460b1926f1deb0f4c82c959cde of this specific container |
14:44:06 | * | silvernode joined #nim |
14:44:22 | silvernode | Morning all! |
14:46:58 | silvernode | what is the replacement for "isDigit()" since I get a warning that it has been deprecated since v0.20? |
14:48:53 | disruptek | iterate over the string and isDigit each character. |
14:49:06 | * | sealmove joined #nim |
14:49:45 | silvernode | disruptek: a ok, so things got switched to be a little more manual then. |
14:50:37 | disruptek | isDigit on a string was a little confusing for unexpected inputs. |
14:51:25 | * | endragor joined #nim |
14:52:23 | silvernode | disruptek: Actually now that I think of it, isDigit isn't really what I should be using for this. What I am trying to do is pretty simple. Detect non decimal characters and return an error message. With "isDigit" of course I can't put in 3.14 since the period trips it up |
14:53:01 | disruptek | the whole premise of the proc was flawed, imo. ๐ |
14:53:36 | disruptek | i'm surprised it was only deprecated in 0.20. feels like it was removed a little soon, but i guess they wanted it out for 1.0. |
14:53:46 | silvernode | I am learning how to deal with user input and it's got me going crazy lol |
14:53:56 | disruptek | users are quite inventive. |
14:54:51 | couven92 | right, I have a proc that accepts the NimNode for a type as argument. I want to default that argument with the symbol NimNode for the `bool` type, and I want it bound in the macro definition. I tried using `bindSym("bool")` but that returns a `type` and not a `NimNode`. |
14:55:08 | silvernode | I am trying to take in some decimals and integers but ignore everything else. I could go with a regex but figured there might be a quick proc that can do this for me a bit easier |
14:55:52 | disruptek | i don't know of one. |
15:01:00 | silvernode | I guess I'll have to learn regex then :) |
15:01:29 | FromGitter | <alehander92> you can try lexbase |
15:02:54 | clyybber | just iterate through the input and allow one dot? |
15:03:10 | clyybber | everything else must be isDigit |
15:03:53 | disruptek | too complicated; write a lexer-parser instead. |
15:05:01 | silvernode | clyybber: That actually sounds pretty easy. |
15:05:16 | disruptek | you can have it output msgpack and provide a separate program to render that. |
15:05:48 | silvernode | disruptek: lol |
15:06:24 | * | ng0 quit (Ping timeout: 260 seconds) |
15:06:45 | * | ng0_ joined #nim |
15:14:18 | couven92 | I have a macro the retuns `untyped`. Inside the macro I assign an AST to result. Later in the code I call `result.Add(nimNode)`. Nim complains that "typechecked nodes may not be modified". What happened here? :O |
15:16:22 | FromDiscord | <Milerius> How we import in nim a type from c++ that is non default constructible ? |
15:16:42 | * | Yardanico joined #nim |
15:18:32 | * | ng0_ is now known as ng0 |
15:21:27 | * | PMunch quit (Quit: Leaving) |
15:37:13 | FromGitter | <alehander92> what is .Add |
15:37:32 | FromGitter | <alehander92> sorry, probably a typo (but just making sure its not code) |
15:38:07 | FromGitter | <alehander92> ah, so from the compiler tests |
15:38:10 | FromGitter | <kayabaNerve> PMunch: You use obj.addr? |
15:38:30 | FromGitter | <alehander92> couven92: it seems that this is when you assign typed to untyped |
15:39:50 | couven92 | alehander92, no I found out that I needed to clone the Tree of an input parameter in order to be able to modify it. Also calling add on the result variable does not work, but if I first created a variable, and at the very end returned that variable, it works just fine |
15:39:52 | * | marmotini_ quit (Remote host closed the connection) |
15:40:07 | * | marmotini_ joined #nim |
15:40:42 | FromGitter | <alehander92> yes |
15:40:53 | FromGitter | <alehander92> well thats not really exact |
15:41:03 | FromGitter | <alehander92> you can modify input parameter |
15:41:09 | FromGitter | <alehander92> but probably not `typed` one |
15:41:25 | FromGitter | <alehander92> result.add works |
15:41:31 | * | marmotini_ quit (Remote host closed the connection) |
15:41:32 | FromGitter | <alehander92> but you need to initialize it to something |
15:47:05 | * | dddddd joined #nim |
15:47:37 | clyybber | Araq: Why does reset(x) need to be replaced with x = default(typeof(x)) ? |
15:47:57 | Araq | reset(x) calls the destructor of x |
15:48:14 | Araq | at least that's what I think it was supposed to do |
15:48:38 | Araq | before we had desturctors these things were incredibly underspecified |
15:48:44 | clyybber | I see |
15:48:53 | disruptek | hmm, that's a little surprising. |
15:48:53 | Araq | to the point that GC_unref does different things for different GCs :-( |
15:48:57 | clyybber | reset(x) calling the destructor feels kinda redundant |
15:48:57 | disruptek | naming-wise. |
15:49:54 | Araq | reset(x) was originally for case objects so that you could re-assign the field discriminator |
15:50:03 | Araq | and then people started to use it for other things |
15:50:37 | clyybber | IMO it should be an alias for default(typeof(x)) in newruntime |
15:50:39 | disruptek | i wish i'd have stuck with nim the first time i played with it. |
15:50:51 | disruptek | i'd be neat to know the history a little better. |
15:51:09 | aeverr[m] | Same |
15:51:23 | disruptek | i'm nostalgic for leaving this language but i haven't left yet. |
15:52:09 | * | marmotini_ joined #nim |
15:52:18 | Araq | leaving Nim? don't be crazy, we can setup a grant and pay you for nimph/nimble. |
15:52:39 | disruptek | are you kidding? |
15:52:50 | * | couven92 quit (Quit: Disconnecting) |
15:52:50 | Araq | no |
15:53:05 | disruptek | lol that would be amazing, thank you. |
15:53:22 | disruptek | but, nimph is almost done. ๐ข |
15:53:33 | disruptek | my children grow up so fast. |
15:54:13 | disruptek | i want two features: |
15:54:17 | clyybber | disruptek: Its done when it supports mercurial :p |
15:54:21 | disruptek | conceptual negation of requirements, |
15:54:22 | * | marmotini_ quit (Remote host closed the connection) |
15:54:38 | disruptek | and the ability to "roll 3.1" and catch a 3.1.14 version. |
15:54:48 | disruptek | so, essentially "roll to my requirement" |
15:54:50 | clyybber | nearly pi |
15:54:50 | * | marmotini_ joined #nim |
15:55:28 | disruptek | well, i want to impl distributions, too. but i'm kinda waiting to see if github packages will work for that. |
15:55:53 | FromDiscord | <Milerius> Hey, can someone guide me how to import a type that is non default constructible in c++ ? |
15:55:58 | disruptek | it's not really clear if nimph will remain platform-centric. |
15:57:06 | disruptek | clyybber: PRs welcome. ๐ |
15:57:28 | disruptek | there are, i think, a grand total of eleven (11) merc repositories in the official nimble packages database. |
15:57:41 | Araq | Milerius, I don't remember |
15:57:53 | clyybber | disruptek: mercury is lethal in low dosages |
15:57:59 | Araq | mark the imported constructors with .constructor |
15:58:07 | disruptek | apparently it's insoluble in nim, as well. |
15:58:19 | FromDiscord | <Milerius> https://gist.github.com/Milerius/4f4f889400307e16d1eb5ab80ca56311 |
15:58:23 | FromDiscord | <Milerius> @Araq |
15:58:36 | FromDiscord | <Milerius> The problem is that the function that i need to import return a implace constructible type |
15:58:37 | clyybber | Araq: Then reset wouldn't have to be magic in nrt |
15:58:41 | FromDiscord | <Milerius> and nim blame me about that. |
15:58:41 | FromGitter | <kayabaNerve> Are you trying to stop it from being constructed? |
15:58:57 | FromGitter | <kayabaNerve> Use a pointer. Pointered C++ classes don't call constructors. |
15:59:07 | FromDiscord | <Milerius> Yeah but my friend |
15:59:32 | * | marmotini_ quit (Ping timeout: 248 seconds) |
15:59:33 | FromDiscord | <Milerius> How can i import: |
15:59:33 | FromDiscord | <Milerius> |
15:59:33 | FromDiscord | <Milerius> "ConstIterator cbegin() const noexcept { |
15:59:33 | FromDiscord | <Milerius> return ConstIterator(this); |
15:59:33 | FromDiscord | <Milerius> }" |
15:59:41 | FromDiscord | <Milerius> I tried few signature |
15:59:49 | Yardanico | what's that for? |
15:59:53 | FromDiscord | <Milerius> They all try to create the ConstIterator type that is non default constructible |
16:00:21 | FromDiscord | <Milerius> I'm importing a ConcurrentHashMap From C++ which have only const iterator |
16:00:29 | Araq | clyybber: sounds like a plan |
16:00:52 | Yardanico | @milerius there are iterators in nim, but they're different from C++ |
16:00:54 | Yardanico | (simpler :P) |
16:00:59 | FromGitter | <kayabaNerve> No idea, besides importcpp and maybe pointers :P My C++ bindings never got that complicated. |
16:01:07 | clyybber | Araq: I'll pull up a PR, unless you want to do it in your misc branch |
16:01:16 | FromGitter | <kayabaNerve> I also don't even use the C++ backend anymore. It's actually a funny story. |
16:01:58 | FromGitter | <kayabaNerve> I moved to C++ for lib X, which wouldn't build under C. I then replaced lib X with lib Y, which wouldn't build under C++, but since I no longer needed C++ for X... kinda balanced itself out |
16:02:07 | FromDiscord | <Milerius> kayaba i dm you on discord now |
16:02:10 | FromDiscord | <Milerius> Short question |
16:02:45 | Yardanico | @Milerius and please, for the future - don't do multiline code pastes :) it doesn't look good for users in IRC |
16:02:50 | Yardanico | use paste services like ix.io or paste.debian.net |
16:03:05 | FromDiscord | <Milerius> I pasted a gist |
16:03:48 | Yardanico | by the way, what's its supposed to do? |
16:05:00 | * | Hideki_ joined #nim |
16:05:16 | shashlick | Araq: is there any way to get compiler flags during compile time? |
16:05:39 | shashlick | https://github.com/nimterop/nimterop/issues/153 |
16:05:40 | disbot | โฅ Ignores nimcache option |
16:06:52 | disruptek | look at the process table? |
16:07:46 | Araq | clyybber: no, PR away please |
16:08:12 | FromGitter | <juancarlospaco> Hi |
16:08:21 | disruptek | awww sup boss. |
16:08:23 | FromGitter | <juancarlospaco> I sent LearnInXminutes of Nim on Spanish, but they wont merge it yet https://github.com/adambard/learnxinyminutes-docs/pull/3786/files?short_path=b40660e#diff-b40660e06853c0c3fac52abdf33decd8 |
16:08:24 | disbot | โฅ [nim/es] Add Nim Spanish |
16:09:07 | disruptek | you would like my gully tool. |
16:09:14 | disruptek | !repo gully |
16:09:15 | disbot | https://github.com/disruptek/gully -- 9gully: 11a code comment formatter 15 1โญ 0๐ด |
16:09:47 | disruptek | like most disrupteknology, it doesn't do anything yet. |
16:11:19 | FromGitter | <bung87> a pointer char + a pointer char means what ? |
16:11:29 | Yardanico | ? |
16:11:35 | Yardanico | You mean summing two pointers? |
16:11:39 | FromGitter | <bung87> in c |
16:12:07 | FromGitter | <alehander92> i doubt its an useful operation |
16:12:15 | FromGitter | <bung87> `char *buf = NULL, *lim, *next; lim = buf + len;` |
16:12:16 | clyybber | disruptek, juancarlospaco: I think cutelog is the thing you want most :p |
16:12:18 | FromGitter | <simkimsia> Hi all Iโm here because of this tweet by Juan Carlos https://twitter.com/juancarlospaco/status/1207692210025762818?s=20 |
16:13:01 | aeverr[m] | welcome |
16:13:03 | disruptek | wow, we are on social media. |
16:13:10 | FromGitter | <bung87> I may read a book of c programing , during porting psutil to macosx |
16:13:17 | FromGitter | <alehander92> @bunbg87 sorry |
16:13:24 | FromGitter | <alehander92> so you need |
16:13:28 | FromGitter | <alehander92> i guess `len` is int |
16:13:45 | FromGitter | <alehander92> because pointer + int is basically pointer[int] |
16:13:46 | FromGitter | <bung87> size_t |
16:13:46 | FromGitter | <simkimsia> Iโm mostly a django web developer and I stumbled upon nim recently. Found a few useful articles in dev.to by Juan Carlos so was wondering if anybody here has successfully use nim to improve their productivity as a python/django web dev |
16:13:50 | FromGitter | <alehander92> thats how arrays work in c |
16:14:06 | Yardanico | Will `arc` GC eventually support async (and it also has shared GC right?) |
16:14:20 | FromGitter | <alehander92> e.g. char* a; a+ 2 should give you pointer to the values 2 bytes after a |
16:14:29 | FromGitter | <alehander92> but! if it was int64_t* a |
16:14:40 | FromGitter | <alehander92> then a + 2 => 16 bytes after a |
16:14:45 | FromGitter | <bung87> wow, I thought itโs a pointer move , or address assignment. |
16:14:47 | disruptek | simkimsia: Willyboar is a resident web dev but i dunno if he uses python. |
16:14:56 | disruptek | mostly i wanted to ping him. |
16:15:31 | FromGitter | <alehander92> a + n is basically a[n] : so you can imagine its <pointer to value of the same type after n * sizeof(type)> |
16:16:38 | FromGitter | <alehander92> @simkimsia i've used django a bit in the past |
16:16:53 | FromGitter | <alehander92> and tried to work on a toy web framework in nim |
16:17:15 | FromGitter | <alehander92> you kinda can use jester currently, but its more minimal than django |
16:17:19 | Yardanico | What's the best way to send messages between threads currently? |
16:17:20 | * | icebattle joined #nim |
16:17:21 | disruptek | simkimsia: checkout karax or figlet to get some ideas of the state of the art. |
16:17:25 | disruptek | !repo figlet |
16:17:28 | disbot | https://github.com/cmatsuoka/figlet -- 9figlet: 11Claudio's FIGlet tree 15 610โญ 66๐ด 7& 29 more... |
16:17:33 | disruptek | nope. not that one. |
16:17:34 | Yardanico | lol |
16:17:40 | disruptek | !repo treeform/figlet |
16:17:41 | disbot | no results ๐ข |
16:17:43 | FromGitter | <Willyboar> Willyboar used flask in the past |
16:17:45 | Yardanico | !repo treeform |
16:17:46 | disbot | https://github.com/Tormund/news -- 9news: 11news - nim easy web socket. Based on https://github.com/treeform/ws 15 20โญ 2๐ด |
16:17:47 | madprops | any of those support websockets? |
16:17:49 | FromGitter | <simkimsia> Thank you @alehander92 |
16:17:52 | disruptek | !repos treeform |
16:17:53 | disbot | https://github.com/Tormund/news -- 9news: 11news - nim easy web socket. Based on https://github.com/treeform/ws 15 20โญ 2๐ด |
16:17:59 | disruptek | !repos treeform/ |
16:18:02 | disbot | https://github.com/treeform/ws -- 9ws: 11Simple WebSocket library for nim. 15 61โญ 7๐ด |
16:18:02 | disbot | https://github.com/treeform/typography -- 9typography: 11Fonts, Typesetting and Rasterization. 15 72โญ 4๐ด |
16:18:04 | disbot | https://github.com/treeform/chroma -- 9chroma: 11Everything you want to do with colors, in nim. 15 28โญ 5๐ด 7& 26 more... |
16:18:08 | FromGitter | <simkimsia> And @disruptek |
16:18:08 | disruptek | well, shit. |
16:18:21 | disruptek | look at his stuff. maybe i forgot the name. |
16:18:28 | disruptek | !repo treeform gui figma |
16:18:29 | disbot | no results ๐ข |
16:18:31 | FromGitter | <Willyboar> figma |
16:18:33 | disruptek | !repo treeform/ gui figma |
16:18:35 | disbot | no results ๐ข |
16:18:36 | FromGitter | <alehander92> @simkimsia but it depends on what you want: if you want to write web apps in nim, best would be to try one of the existing web frameworks |
16:18:42 | * | disruptek gives up. |
16:18:43 | FromGitter | <Willyboar> !package figma |
16:18:44 | disbot | no packages match ๐ข |
16:18:51 | FromGitter | <Willyboar> !repo figm |
16:18:54 | disbot | https://github.com/figma/figma-api-demo -- 9figma-api-demo: 11 15 679โญ 123๐ด & 29 more... |
16:18:58 | disruptek | !repo gui figma |
16:18:59 | FromGitter | <alehander92> https://github.com/treeform/fidget |
16:19:00 | disbot | https://github.com/Metarock13/figma-style-guides -- 9figma-style-guides: 11Style Guide generator for Figma documents. 15 5โญ 0๐ด 7& 4 more... |
16:19:03 | FromGitter | <alehander92> disruptek please |
16:19:04 | disruptek | FIDGET |
16:19:08 | disruptek | that's what it was. |
16:19:21 | disruptek | my bad ๐คฃ |
16:19:21 | FromGitter | <alehander92> :D |
16:19:43 | FromGitter | <bung87> I understand itโs assignment and pointer move right? |
16:20:06 | FromGitter | <bung87> but assign to lim memory start or end ? |
16:20:07 | FromGitter | <alehander92> its assigned to lim yeah |
16:20:32 | FromGitter | <alehander92> honestly this snippet |
16:20:40 | FromGitter | <alehander92> is strange, because if buf is literally NULL |
16:20:51 | FromGitter | <alehander92> probably it doesnt make sense to add to it.. |
16:20:55 | clyybber | disruptek: With wayfire you can make a you-know-what with it |
16:21:01 | FromGitter | <alehander92> but in principle yeah its like buf[len] |
16:21:06 | FromGitter | <alehander92> lim = buf[len] * |
16:21:33 | FromGitter | <alehander92> @simkimsia if you want to just port some things, there has been some stuff like nimpy |
16:21:44 | disruptek | clyybber: a buffer overrun? |
16:21:52 | FromGitter | <alehander92> which lets you interop between python and nim |
16:22:04 | * | sschwarzer joined #nim |
16:22:26 | clyybber | disruptek: I don't want to say the word |
16:22:30 | clyybber | the f-s word |
16:22:44 | sschwarzer | clyybber: you don't have to ;-) |
16:22:49 | Yardanico | so what's the best way to send messages between threads in nim? :D |
16:22:52 | Yardanico | i asked but chat moved too fast |
16:23:02 | FromGitter | <bung87> ok ,thank you @alehander92 , Iโll check if I can make it work |
16:23:34 | disruptek | yardanico: idiomatic is channels. |
16:23:48 | Yardanico | and "best" is? :) |
16:23:51 | disruptek | the f-s word... |
16:24:08 | disruptek | well, channels aren't brilliant, but they are the best. |
16:24:11 | Araq | Yardanico: we're investigating |
16:24:21 | disruptek | a day could come when channels are revamped to work better. |
16:24:26 | FromGitter | <alehander92> shared memory? |
16:24:38 | FromGitter | <alehander92> brave wild west |
16:24:47 | sschwarzer | alehander92: *lol* |
16:24:51 | Yardanico | I'm just thinking about creating a program for bridging between different backends, and each backend runs in a separate thread |
16:24:58 | clyybber | disruptek: fidget spinner |
16:25:01 | Yardanico | I mean chat services* |
16:25:01 | clyybber | there I said it |
16:25:06 | Yardanico | oh no |
16:25:13 | disruptek | man, i never would have guessed that in a million years. |
16:25:24 | FromGitter | <alehander92> Yardanico what kind of backend |
16:25:50 | disruptek | you find yourself wasting time shaking your windows around the screen to watch them wobble? |
16:26:01 | * | Hideki_ quit (Remote host closed the connection) |
16:26:13 | Yardanico | @alehander92 for example 4 threads for 4 chat backends - discord, irc, telegram, gitter |
16:26:16 | disruptek | yardanico: i wouldn't have reservations about using channels. |
16:26:17 | aeverr[m] | We're back at the wayfire thing |
16:26:21 | clyybber | disruptek: unfortunately yes |
16:26:27 | disruptek | but, async is probably better. |
16:26:29 | Yardanico | and if a message is received in irc, it's gonna send that message to 3 other threads |
16:26:34 | Yardanico | disruptek: well I know, but it's going to be a mess |
16:26:35 | clyybber | aeverr[m]: the fire never dies |
16:26:40 | disruptek | it's an i/o-limited app. |
16:26:59 | disruptek | yardanico: nah, it won't be bad at all. |
16:27:06 | Yardanico | hmm |
16:27:10 | sschwarzer | Does anyone mind giving discussing / giving feedback on the bug mentioned at https://forum.nim-lang.org/t/5697#35421 ? The underlying code is here: https://hg.sr.ht/~sschwarzer/vppdiff/browse/default/src/vppdiff/cleanxmi.nim#L46 and the problematic condition at https://hg.sr.ht/~sschwarzer/vppdiff/browse/default/src/vppdiff/cleanxmi.nim#L80 . |
16:27:14 | disruptek | clyybber: i give you two months, max. |
16:27:18 | aeverr[m] | I still don't understand async keywords, lmao |
16:27:26 | sschwarzer | (remove the first "giving") |
16:27:29 | Yardanico | aeverr[m]: wdym? |
16:27:41 | Yardanico | you don't have to understand async to use it xD |
16:28:37 | FromGitter | <simkimsia> Iโm going to ask some really stupid questions here so do go easy on me. |
16:28:38 | disruptek | async works well enough, but ignore the manual. |
16:28:38 | clyybber | disruptek: to stop wiggling? Even if I get tired of the wiggle wayfire is fast and slick |
16:28:50 | clyybber | also, I just setup xwayland |
16:28:52 | disruptek | talk to me about slick. |
16:28:58 | FromGitter | <simkimsia> Oh btw thanks for all the repo recommended I have bookmarked them :) |
16:29:02 | aeverr[m] | Yardanico, im not a fan of using things i dont at least partially understand |
16:29:02 | disruptek | simkimsia: everyone starts off as an idiot. |
16:29:03 | clyybber | I can wiggle minecraft now, what else do you want? |
16:29:34 | * | marmotini_ joined #nim |
16:29:39 | * | Hideki_ joined #nim |
16:29:39 | aeverr[m] | simkimsia, what'cha askin? |
16:30:04 | disruptek | boys wiggle, men don't need mice. |
16:30:18 | FromGitter | <simkimsia> Iโm thinking of making it easier to have my own DSL to generate django models, drf serializers, viewsets etc |
16:30:49 | aeverr[m] | ok so |
16:30:50 | FromGitter | <simkimsia> As I was thinking abt doing this in python I saw nimlang so was wondering if nimlang might be a better fit? |
16:31:12 | aeverr[m] | most probably |
16:31:15 | aeverr[m] | most likely, rather |
16:31:15 | Yardanico | you can just call nim nim :) |
16:31:32 | aeverr[m] | nim is not a common word, unlike g- |
16:32:04 | FromGitter | <simkimsia> As in nimlang to write a DSL to generate django model, drf serializer etc |
16:32:25 | FromGitter | <alehander92> yes you can do it |
16:32:30 | FromGitter | <simkimsia> Oh okay sorry Iโll use nim |
16:32:35 | FromGitter | <alehander92> thats an interesting approach |
16:32:38 | clyybber | aeverr[m]: gimp? common? |
16:32:47 | FromGitter | <simkimsia> I mean Iโll call nim nim |
16:32:51 | FromGitter | <alehander92> basically generating other language code from nim |
16:33:04 | sschwarzer | simkimsia: of course this channel is a bit biased ;-) |
16:33:36 | clyybber | Araq: I think we can do that for the old runtime too |
16:33:41 | FromGitter | <simkimsia> I mean yes but at the same time maybe somebody has already tried this so Maybe Iโll find them here |
16:33:42 | clyybber | The tests seem to indicate such |
16:34:08 | * | Hideki_ quit (Ping timeout: 265 seconds) |
16:34:08 | sschwarzer | simkimsia: I didn't mean to say you shouldn't ask :) |
16:34:36 | FromGitter | <Willyboar> Disruptek i start wor on something |
16:34:37 | FromGitter | <Willyboar> king |
16:35:19 | FromGitter | <simkimsia> Oh no worries I didnโt take it that way. I will of course weight according to what I find here abt biases. At this point I more in discovery mode. Lots of things I dunno that I dunno |
16:37:07 | Araq | clyybber: sounds risky |
16:37:18 | clyybber | ikr, but it seems to work out |
16:37:32 | clyybber | Araq: I could also do it conditionally with nimHasDefault? |
16:37:34 | disruptek | Willyboar: what is it? |
16:38:12 | Araq | clyybber: oh whatever, just do something, it's devel, 1.1 alpha with best effort --useVersion backwards compat mode |
16:38:34 | Araq | we simply won't backport it |
16:38:37 | clyybber | yeah, I was about to say that; we can just revert if something really happens |
16:38:46 | clyybber | Araq: Yeah, I don't think we should backport that |
16:40:11 | clyybber | Araq: Can we assume hasNimDefault to be true these days? Or how does this work? |
16:40:25 | * | endragor quit (Remote host closed the connection) |
16:40:36 | FromGitter | <Willyboar> https://github.com/Willyboar/nimux |
16:41:27 | Araq | yes, defineSymbol("nimHasDefault") |
16:41:32 | Araq | in condsyms.nim |
16:41:42 | Araq | it's always true, probably since 0.20 |
16:41:55 | disruptek | Willyboar: you are off and running; good luck! |
16:42:00 | clyybber | Ok, nice, so I dont have to handle the else case.. |
16:42:25 | Araq | er ... then why even write the 'when' |
16:43:02 | clyybber | exactly |
16:43:08 | clyybber | thats why I was asking |
16:43:39 | clyybber | ah, I'll just put the old reset into the else case |
16:44:24 | FromGitter | <Willyboar> Well i will need all the help i can get |
16:44:56 | disruptek | !search github action interfacing |
16:44:58 | disbot | https://github.com/disruptek/nimph/issues/83 -- 3add some simple github action interfacing 7& 1 more... |
16:45:03 | disruptek | oh yes. |
16:45:07 | disruptek | it's coming. |
16:47:00 | disruptek | would you like a way to clone other people's branches and use them as your dependencies from inside nimph? |
16:47:13 | disruptek | not hard to achieve. |
16:49:51 | disruptek | ie. you could `nimph fork npeg clyybber:fix43` and it would take your currently-stock npeg and pull in clyybber's branch "fix43" and point at it; then you just build you app and you're running clyybber's code. |
16:51:36 | sealmove | disruptek I think it's an overkill |
16:51:51 | sealmove | branches are temporal |
16:52:04 | disruptek | of course. |
16:52:43 | FromDiscord | <KcVinu> How to create a cast statement inside a macro ? |
16:52:50 | disruptek | the alternative is that you have to go into the repo and do that stuff manually. |
16:53:02 | disruptek | wouldn't you want it automated? |
16:53:04 | sealmove | you are right, could be useful |
16:53:25 | FromDiscord | <KcVinu> result = newStmtList(nnkCast(newIdentNode(tName.treeRepr), newIdentNode(idenName.treeRepr))) |
16:53:26 | FromDiscord | <KcVinu> This is not working |
16:53:55 | sealmove | newIdentNode(idenName.treeRepr) ?? |
16:54:01 | Yardanico | wat |
16:54:14 | Yardanico | @KcVinu treeRepr is for debugging |
16:54:19 | sealmove | is idenName a string? |
16:54:33 | solitudesf | run dumpTree or dumpAstGen on whatever you want to achieve and build up to it |
16:54:36 | FromDiscord | <KcVinu> Ok, edited to only repr |
16:54:52 | FromGitter | <bung87> @alehander92 `lim = cast[int](buf) + len.int` does the same ? |
16:54:56 | FromDiscord | <KcVinu> i got this from dumbTree |
16:54:57 | FromDiscord | <KcVinu> StmtList |
16:54:57 | FromDiscord | <KcVinu> Cast |
16:54:57 | FromDiscord | <KcVinu> Ident "int" |
16:54:57 | FromDiscord | <KcVinu> Ident "abc" |
16:55:02 | Yardanico | @KcVinu, no, you shouldn't use repr at all |
16:55:06 | Yardanico | here |
16:55:26 | clyybber | disruptek: I think its a good idea |
16:55:26 | sealmove | yeah, if idenName is a string, then `indent(idenName)` suffices |
16:55:29 | sealmove | ident* |
16:55:35 | sealmove | ident is synonym with newIdentNode |
16:55:48 | clyybber | disruptek: Cloning by branch though, is not :p |
16:55:54 | FromDiscord | <KcVinu> result of dumbTree looks simple. But how to create new ast ? |
16:56:02 | disruptek | cloning by branch? |
16:56:34 | clyybber | oh |
16:56:39 | clyybber | I meant to say "my" |
16:56:53 | sealmove | KcVinu: what are you trying to do? |
16:56:53 | disruptek | oh. |
16:57:03 | FromDiscord | <KcVinu> This is the macro signature |
16:57:03 | FromDiscord | <KcVinu> macro castTo(tName : untyped, idenName : untyped): untyped = |
16:57:15 | sealmove | KcVinu: there is also dumpAstGen which shows you how to create ast |
16:57:32 | Yardanico | @KcVinu also, for some simple cases you can use quote do |
16:57:33 | FromDiscord | <KcVinu> Ok. thanks Let me try |
16:57:33 | disruptek | !issue arbitrary fork command |
16:57:34 | disbot | https://github.com/nim-lang/Nim/issues/12628 -- 3osproc: support for passing arbitrary fds to child processes 7& 4 more... |
16:57:46 | disruptek | !issue arbitrary fork command url |
16:57:47 | disbot | no results ๐ข |
16:58:01 | disruptek | disbot: is this going to be one of those days? |
16:58:03 | disbot | yep. ๐ |
16:58:07 | disruptek | shit. |
17:02:15 | * | Hideki_ joined #nim |
17:03:09 | FromDiscord | <KcVinu> dumpAstGen shows this |
17:03:09 | FromDiscord | <KcVinu> nnkStmtList.newTree( |
17:03:09 | FromDiscord | <KcVinu> nnkCast.newTree( |
17:03:10 | FromDiscord | <KcVinu> newIdentNode("int"), |
17:03:10 | FromDiscord | <KcVinu> newIdentNode("abc") |
17:03:10 | sschwarzer | Does the disbot have a help function? :) I asked "help" but it replied "Nah" :-D |
17:03:10 | FromDiscord | <KcVinu> ) |
17:03:10 | FromDiscord | <KcVinu> ) |
17:03:22 | FromDiscord | <couven92> Hmm... I was playing with the idea to get nim to produce error, warning and debug messages that are recognised by Azure Pipelines. Is there a way to hook into the compiler and intercept events during compilation. E.g. on_warning, on_error? Any other ideas on how to do something like that? |
17:03:27 | Yardanico | @KcVinu please use paste services, we don't have multiline code here in IRC :) |
17:03:27 | disruptek | yeah, !help |
17:03:30 | FromDiscord | <KcVinu> I need to replace "int" with my parameter name |
17:03:49 | disruptek | i guess disbot should respond with some help if it cannot parse your request. |
17:03:50 | FromDiscord | <KcVinu> Paste service means, pastebin.com ? |
17:04:02 | Yardanico | paste.debian.net, ix.io, etc, pastebin.com is not really a good choice :) |
17:04:03 | disruptek | i thought i implemented that but i guess not. |
17:04:12 | clyybber | !help |
17:04:17 | sschwarzer | disruptek: makes sense, I should have thought of this given your "!issue" command :) |
17:04:55 | disruptek | this is how software improves. |
17:07:52 | FromGitter | <alehander92> @bung87 not really |
17:07:57 | FromGitter | <alehander92> like, in this case maybe |
17:07:59 | FromGitter | <alehander92> it does |
17:08:19 | sschwarzer | disruptek: Also would be nice if you could get more than three results. I understand that you don't want to have the channel spammed, but I think it could make sense for private chats. |
17:08:35 | FromGitter | <alehander92> but in principle there should be a `+` for pointers |
17:08:39 | disruptek | good point. we'll limit it to 30 for private convos. |
17:09:14 | disruptek | i can always throttle it if the bot floods itself off. |
17:09:15 | FromGitter | <alehander92> @bung87 pointer + int IS NOT pointer.int + int: very important, IT IS NOT the same in principle |
17:09:24 | sschwarzer | disruptek: Is there a repo to enter an issue? I searched for disbot on Github, but get countless hits. |
17:09:45 | disruptek | nah, but i'm usually on irc. |
17:10:11 | FromDiscord | <KcVinu> Hi, finally i got the result with this code. But you said not use repr() |
17:10:11 | FromDiscord | <KcVinu> nnkStmtList.newTree(nnkCast.newTree(newIdentNode(tName.repr), newIdentNode(idenName.repr)) ) |
17:10:13 | sschwarzer | disruptek: Ok, so I guess you have the two issues (!help and more results) on your todo list now? :) |
17:10:40 | FromGitter | <alehander92> it seems there is no stdlib for that |
17:10:41 | disruptek | i impl help, just wanna do more results before i recompile. ๐ |
17:10:48 | FromDiscord | <KcVinu> If i not use repr, then it will show errors |
17:11:07 | sschwarzer | disruptek +1 ! :-) |
17:11:56 | FromGitter | <alehander92> @bung87 https://stackoverflow.com/questions/4772932/pointer-addition-and-element-size so generally you need to define something like |
17:12:27 | disruptek | sschwarzer: try now. |
17:12:29 | FromGitter | <alehander92> https://github.com/status-im/nim-stew/blob/master/stew/ranges/ptr_arith.nim |
17:12:31 | sschwarzer | Is mratsim also on IRC? |
17:12:55 | clyybber | on discord |
17:13:07 | clyybber | but its bridged |
17:13:22 | FromGitter | <alehander92> sorry actually https://github.com/status-im/nim-stew/blob/master/stew/ptrops.nim#L29 |
17:13:27 | FromDiscord | <KcVinu> Well, i can use "$" sign instead of repr |
17:13:32 | sschwarzer | disruptek: I was going to write it doesn't reply to "!help", but after a few seconds it did. |
17:13:39 | FromGitter | <alehander92> hm mozilla went to matrix/riot |
17:13:39 | FromDiscord | <KcVinu> Any problem in using dollar sign ? |
17:13:41 | FromGitter | <alehander92> after all |
17:13:42 | FromGitter | <alehander92> interesting |
17:14:15 | sschwarzer | clyybber: I guess there's no bridge to msg someone on Gitter, i. e. the bridge is "only" for this channel? |
17:14:21 | clyybber | sschwarzer: Packet transports are having a hard time in the canadian wilderness |
17:14:22 | FromGitter | <alehander92> i am on gitter |
17:14:40 | FromGitter | <alehander92> you can `@<name>` for people here, but no PM-s indeed |
17:15:05 | FromDiscord | <KcVinu> I think everybody is busy with other queries. Never mind, i am leaving it here. My head spins with this macro. |
17:15:34 | FromGitter | <alehander92> i think `repr` is fine , i am using it a lot |
17:15:42 | FromGitter | <alehander92> i think `$` is the same for idents |
17:15:58 | FromGitter | <alehander92> `repr` works for all nodes afaik |
17:15:59 | clyybber | in general $ is preferable over repr |
17:16:02 | sschwarzer | disruptek: Ok, !issues gives me more results now |
17:16:03 | FromGitter | <alehander92> `$` just for some of them |
17:16:31 | FromGitter | <alehander92> so yeah maybe `$` is good if you want to make sure you dont string some unexpected node |
17:16:32 | sschwarzer | disruptek: I'll try the >30 case by using "macro" or something :) |
17:16:32 | clyybber | repr won't work in new runtime, though in this case it shouldn't matter since afaict you do it at compile time |
17:17:03 | FromGitter | <alehander92> huh that would break some code |
17:17:18 | * | endragor joined #nim |
17:17:30 | clyybber | KcVinu: What is indenName in your code? |
17:17:32 | FromGitter | <alehander92> maybe just a "repr doesnt work here" or `$` alias might be ok |
17:17:38 | FromGitter | <alehander92> as it is used mostly for debugging out of CT |
17:17:42 | silvernode | Well I learned how to do regex in Nim and solved my "match everything except 0-9 and ." issue. Now users can't input anything but integers and floats |
17:17:42 | FromGitter | <alehander92> i hope |
17:17:49 | FromGitter | <alehander92> but people might parse it .. |
17:18:16 | FromDiscord | <KcVinu> idenName is any variabale like LRESULT, HWND etc |
17:18:29 | clyybber | variable as in its a string? |
17:18:31 | * | Hideki_ quit (Ping timeout: 258 seconds) |
17:18:33 | clyybber | or is it a sym? |
17:18:57 | clyybber | either way $ should work just fine for all sane purposes |
17:19:11 | FromDiscord | <KcVinu> Actually, i just write what dumpAstGen gave to me |
17:19:23 | * | disruptek quit (Quit: Bye) |
17:19:47 | FromDiscord | <KcVinu> But this macro and original cast statement, both are giving weird results |
17:19:47 | * | disruptek joined #nim |
17:19:57 | clyybber | disruptek: thought you were a goner here for a sec |
17:19:58 | Yardanico | can you show us what do you want to do? |
17:20:05 | Yardanico | I mean what is your expected result? |
17:20:24 | FromDiscord | <KcVinu> if i convert float 5.0 to int , i am epecting 5 |
17:20:26 | disruptek | lol |
17:20:38 | disruptek | trying to get my bouncer to let the bot spam me faster. |
17:20:44 | Yardanico | @KcVinu int(floatvar) |
17:20:54 | FromDiscord | <KcVinu> but i got 4617315517961601024 |
17:21:11 | clyybber | then the float was not a 5.0 :p |
17:21:14 | Yardanico | By the way, what happened to nim highlighting? |
17:21:15 | Yardanico | https://github.com/nim-lang/Nim/blob/devel/lib/system.nim |
17:21:18 | Yardanico | doesn't work here for me |
17:21:40 | FromDiscord | <KcVinu> Actually i just tested with int and float, in real case, i need to convert LPARAM to LPNMHDR struct |
17:21:47 | FromDiscord | <KcVinu> and stuff like that |
17:21:56 | FromDiscord | <KcVinu> Whole win api data types |
17:21:59 | * | endragor quit (Ping timeout: 265 seconds) |
17:22:16 | sschwarzer | Hm, only 11 hits for `!issues macro`? ;) For comparison, the Github search for nim-lang `is:issue is:open in:title macro` gives me 75 open tickets. |
17:22:17 | clyybber | Yardanico: Maybe due to the documentation top comments, idk if githubs highlighting thing is open source tho |
17:22:23 | Yardanico | it is |
17:22:31 | clyybber | do they use treesitter? |
17:22:38 | Yardanico | https://github.com/github/linguist |
17:22:46 | Yardanico | ah sorry wrong one |
17:23:51 | FromGitter | <bung87> @alehander92 ok, I decide read some c tutorials |
17:24:00 | Yardanico | @KcVinu so you just want to replace one type with another? |
17:24:08 | Yardanico | everywhere? |
17:24:21 | Yardanico | (everywhere inside of your macro invocation I mean) |
17:24:37 | Yardanico | clyybber: ah wait, that repo is the right one |
17:24:47 | Yardanico | https://github.com/github/linguist/blob/master/vendor/README.md this lists the repos they use for languages |
17:24:59 | Yardanico | nim one uses syntax highlighting from https://github.com/Varriount/NimLime |
17:25:04 | Yardanico | xd |
17:25:19 | * | endragor joined #nim |
17:25:31 | disruptek | sschwarzer: it's the same search, except mine looks for language:nim and doesn't care if the issue open or closed. |
17:26:58 | silvernode | I think I have a basic Nim question: How do I catch when users cancel the program with Ctrl+c , so I can give a nice message when they kill it? |
17:27:05 | Yardanico | setControlCHook |
17:27:16 | * | Vladar joined #nim |
17:27:21 | Yardanico | https://nim-lang.org/docs/system.html#setControlCHook%2Cproc%29 |
17:27:39 | sealmove | silvernode: this is not a simple question |
17:27:42 | clyybber | Yardanico: Huh, so they are able to use sublime text highlighting in their site |
17:27:44 | clyybber | interesting |
17:28:18 | * | tribly quit (Quit: WeeChat 2.7) |
17:28:31 | clyybber | its a submodule though, so to fix it NimLime has to be PRed and then githubs thing updated, unless they keep the submodules up to date themselves |
17:28:43 | disruptek | sschwarzer: if you really want more than 30 hits, i can do up to 100, but... |
17:28:53 | * | tribly joined #nim |
17:29:00 | * | Kaivo joined #nim |
17:30:00 | silvernode | sealmove: Well I guess I should be glad, I was hoping I wouldn't look dumb. :P |
17:30:24 | sschwarzer | disruptek: Not a problem, but I got only 11 instead of 30 |
17:31:46 | FromGitter | <alehander92> @bung87 good idea: pointers might be a bit tricky in the beginning, but once everything is clear on them, this helps a lot imho |
17:34:36 | FromGitter | <alehander92> clyybber i think sublime was using some kind of more general textmate thing |
17:34:38 | FromGitter | <alehander92> or supporting |
17:34:42 | FromGitter | <alehander92> but i might be confused |
17:37:17 | * | nsf joined #nim |
17:37:29 | FromGitter | <alehander92> hm https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html#[non_exhaustive]-structs,-enums,-and-variants |
17:37:33 | FromGitter | <bung87> I think I Know pointer referrence, several years ago ,when learn c++, but in this case it's specific to the language. |
17:37:34 | FromGitter | <alehander92> this is an interesting idea |
17:37:44 | FromGitter | <alehander92> @bung87 yeah its mostly pointer arithmetic |
17:38:09 | clyybber | alehander92: Ah that would make sense |
17:41:28 | clyybber | alehander92: It is an interesting idea |
17:41:40 | clyybber | but nim doesn't realy have the same problem |
17:42:04 | clyybber | well |
17:42:08 | FromGitter | <alehander92> well, you can apply it to enums |
17:42:10 | FromGitter | <bung87> I also remeber when I porting c++ project fastText, there โs no pointer move operation in nim, atleast not through just one operator |
17:42:11 | clyybber | yeah |
17:42:19 | FromGitter | <alehander92> but yeah our pattern matching (at leat my lib) |
17:42:27 | FromGitter | <alehander92> doesnt even support exhaustiveness yet iirc :D |
17:43:21 | clyybber | alehander92: Yeah I take it back, we could introduce a pragma that makes it so when you case of over an enum, you are allowed to write an else even though that else won't be reached with the current possible values of the enum |
17:44:18 | clyybber | that would be the nim equivalent of #[non-exhaustive] |
17:44:59 | clyybber | and maybe erroring when there is no else branch |
17:45:55 | FromGitter | <alehander92> yeah i guess so, more interesting is probably |
17:46:03 | FromGitter | <alehander92> how to make a macro pattern matching exhaustive |
17:46:09 | clyybber | hmm |
17:46:25 | FromGitter | <alehander92> i imagine one can analyze invariants for primitive types and do a similar logic |
17:46:28 | FromGitter | <alehander92> like the compiler does |
17:47:02 | FromGitter | <alehander92> and generalize it over PRODUCT and OR |
17:47:35 | clyybber | try it :) |
17:47:38 | FromGitter | <alehander92> actually i cant see a huge problem |
17:48:00 | FromGitter | <alehander92> but no much time |
17:48:07 | FromGitter | <alehander92> my only side project ideas these days are |
17:48:16 | FromGitter | <alehander92> to make a simple gdb-like debugger in rust |
17:48:26 | clyybber | regarding that #[non-exhaustive], maybe it isnt a good idea for rust either, I mean if you only want to handle a few specific cases you;ll have an else branch either way |
17:48:35 | FromGitter | <alehander92> and to prototype one other thing in nim :D |
17:48:46 | clyybber | and when you dont then its not a good idea to introduce enums silently |
17:48:58 | FromGitter | <alehander92> yeah, sounds reasonable |
17:49:00 | clyybber | because then the code thats supposed to handle each one individually gets forgotten |
17:49:14 | FromGitter | <alehander92> the user is expected to code for "possible future other enum" values |
17:49:19 | clyybber | yeah |
17:49:25 | FromGitter | <alehander92> which sometimes makes sense, but sometimes doesnt |
17:49:50 | FromGitter | <alehander92> but i guess here lies the lib author responsiblity |
17:50:31 | FromGitter | <alehander92> to not use it for enums which should be kinda unchanging |
17:50:41 | disruptek | thanks to sschwarzer, you can now use the bot to spam yourself with >3 results via private chat. |
17:50:43 | * | narimiran quit (Ping timeout: 258 seconds) |
17:51:14 | FromGitter | <alehander92> !disbot give me 20 results |
17:51:23 | * | leorize joined #nim |
17:51:54 | FromGitter | <alehander92> !disbot just make me eggs man |
17:52:02 | FromGitter | <alehander92> hungry |
17:52:08 | FromGitter | <alehander92> disruptek lets go for a lunch |
17:52:18 | disruptek | aight. |
17:52:46 | FromGitter | <alehander92> i figure paris might be somewhere in the middle |
17:52:53 | clyybber | Araq: #12937 its passing \o/ |
17:52:54 | disbot | https://github.com/nim-lang/Nim/pull/12937 -- 3system.reset is no longer magic |
17:52:57 | FromGitter | <alehander92> they have good bakeries |
17:53:03 | FromGitter | <Willyboar> I take dinner in a while |
17:53:07 | FromGitter | <alehander92> me too |
17:53:15 | disruptek | i used to have a french bakery across the street. |
17:53:20 | FromGitter | <alehander92> but i wanted to be us-friendly |
17:53:33 | disruptek | in nyc. unbelievable. |
17:53:43 | FromGitter | <Willyboar> Disruptek are you in us? |
17:53:47 | FromGitter | <alehander92> disruptek i imagine there are porbably 23 bulgarian restaurants |
17:53:49 | FromGitter | <alehander92> in nyuc |
17:53:56 | disruptek | yeah. |
17:53:59 | FromGitter | <alehander92> from what ive heard about the international cuisin |
17:54:06 | FromGitter | <alehander92> ok, maybe 2 |
17:54:24 | FromGitter | <alehander92> ok, there is a tasty turkish place nearby |
17:54:24 | * | vsantana joined #nim |
17:54:33 | FromGitter | <Willyboar> There are a lot of greeks there. In astoria |
17:54:34 | FromGitter | <alehander92> but i .. want something different |
17:55:28 | clyybber | alehander92: Hunger tastes.. different |
17:56:04 | * | lbart joined #nim |
18:05:03 | disruptek | how should the !forum bot command work? |
18:05:08 | disruptek | google site search of the forum? |
18:05:55 | leorize | the forum has a search function, isn't it |
18:06:20 | disruptek | so does github. |
18:06:36 | leorize | yea but there's a REST api for it, no? |
18:07:14 | disruptek | for the forum? |
18:07:48 | leorize | yea |
18:08:10 | disruptek | i dunno anything about the forum. if there's a search api, i could use that. |
18:10:47 | leorize | https://github.com/nim-lang/nimforum/blob/35baa815fdb3762f779474ff6e81ae20dec2070c/src/frontend/search.nim#L86-L87 |
18:11:01 | leorize | looks like the endpoint is /search.json |
18:11:21 | leorize | the structure is on top of the file |
18:11:39 | * | gmpreussner quit (Ping timeout: 240 seconds) |
18:12:41 | leorize | lol you can even query all post from spammers |
18:14:37 | * | marmotini_ quit (Remote host closed the connection) |
18:14:55 | * | marmotini_ joined #nim |
18:16:36 | * | marmotini_ quit (Remote host closed the connection) |
18:18:41 | * | leorize quit (Remote host closed the connection) |
18:19:03 | * | leorize joined #nim |
18:22:10 | * | marmotini_ joined #nim |
18:26:27 | * | gmpreussner joined #nim |
18:31:29 | * | zyklon joined #nim |
18:31:42 | disruptek | i guess we can limit it to posts or threads, then. we'll have !post !thread or the more general !forum. |
18:33:19 | * | uvegbot quit (Ping timeout: 265 seconds) |
18:45:26 | FromGitter | <Willyboar> dude you are on fire |
18:46:57 | FromGitter | <alehander92> boar how is the web going |
18:46:57 | FromGitter | <bung87> whatโs `atoi` in Nim? |
18:47:18 | FromGitter | <alehander92> parseInt ? |
18:48:02 | FromGitter | <bung87> the question previous, *char to int ,since `lim` represent as limit number |
18:48:31 | FromGitter | <alehander92> but what is char* then |
18:48:56 | FromGitter | <alehander92> is it something like "2" |
18:49:58 | FromGitter | <alehander92> if you want the string content itself, atoi is the thing, otherwise if you want the pointer value as int, just use (int) |
18:50:12 | FromGitter | <bung87> I dont know exactly the `buf` coming from `sysctl(mib.addr, 6, buf, len, nil, 0) ` |
18:51:27 | * | vsantana quit (Quit: leaving) |
18:51:49 | FromGitter | <alehander92> well, what does it contain |
18:52:09 | FromGitter | <alehander92> yeah, look, what are you trying to do |
18:52:13 | FromGitter | <alehander92> in the big picture |
18:53:25 | FromGitter | <bung87> https://github.com/bung87/psutil-nim/blob/master/src/psutil/psutil_macosx.nim#L690 |
18:54:18 | FromGitter | <bung87> `PRs accepted! Adding a single function to any platform is a huge help and can usually be done with less than an hour of work.` |
18:54:28 | FromGitter | <bung87> I spent much more hours... |
18:55:15 | FromGitter | <alehander92> yeah, but you might learn very important c stuff |
18:56:53 | FromGitter | <bung87> yeah , I did learned something by porting projects. |
18:57:26 | FromGitter | <alehander92> ok, so what is the original code |
18:57:45 | FromGitter | <bung87> https://github.com/hamon-in/cpslib/blob/master/pslib_osx.c#L674 |
18:58:17 | FromGitter | <bung87> and pure c version https://github.com/hamon-in/cpslib/blob/master/pslib_osx.c#L674 |
18:58:24 | FromGitter | <alehander92> ok |
18:58:25 | FromGitter | <alehander92> lim = buf + len; |
18:58:57 | FromGitter | <bung87> thatโ all? |
18:59:07 | FromGitter | <alehander92> just means var lim: ptr char ; lim = buf.pointerAdd(len) |
18:59:51 | FromGitter | <alehander92> and next < lim can be done with cast[int] i think (they're both pointers) |
19:00:03 | FromGitter | <alehander92> and next += ifm->ifm_msglen; |
19:00:27 | FromGitter | <alehander92> next = next.pointerAdd(ifm->ifm_msglen.pointerAdd) |
19:00:31 | FromGitter | <alehander92> next = next.pointerAdd(ifm->ifm_msglen) |
19:00:34 | FromGitter | <alehander92> sorry |
19:00:42 | FromGitter | <alehander92> you need to define pointerAdd mostly |
19:02:11 | FromGitter | <alehander92> for that look at https://github.com/status-im/nim-stew/blob/master/stew/ptrops.nim#L29 |
19:02:25 | FromGitter | <alehander92> its the same thing |
19:02:34 | FromGitter | <alehander92> as offset here and as `+` in c |
19:04:19 | FromGitter | <bung87> ok , let me try . |
19:04:43 | * | nsf quit (Quit: WeeChat 2.6) |
19:06:47 | clyybber | Araq: ping |
19:08:06 | FromGitter | <Willyboar> @alehander92 i made a repo and some progress. |
19:08:07 | FromGitter | <Willyboar> https://github.com/Willyboar/nimux |
19:10:14 | FromGitter | <alehander92> ok, just several suggestions |
19:10:20 | FromGitter | <alehander92> 1) looks great! |
19:11:39 | FromGitter | <alehander92> 2) i imagine a great feature would be that nim has a javascript backend: so .nim (or .js.nim) instead of .js โ 3) its easy to load karax server side views: so one can use .nim instead of .html there too (and even easily combine it as SPA) |
19:12:54 | FromGitter | <Willyboar> I am waiting @xmonader to create a jinja clone :P |
19:13:23 | FromGitter | <Willyboar> but sure i want to here all options |
19:14:15 | FromGitter | <bung87> canโt see src source files. |
19:14:15 | FromDiscord | <Milerius> is PMunch around ? |
19:14:34 | FromGitter | <alehander92> but karax already works for this |
19:14:46 | FromGitter | <Willyboar> @bung87 you mean to nimux? |
19:14:49 | FromGitter | <alehander92> and its imo even better than jinja :P as you can even reuse it |
19:14:54 | FromGitter | <alehander92> but i think |
19:14:55 | FromGitter | <Willyboar> because there isn't any |
19:14:56 | FromGitter | <bung87> for option 2, js backend not good as c backend |
19:15:17 | FromGitter | <alehander92> the best would be for you to support different template "engines" but of course this is not so critical |
19:15:27 | FromGitter | <bung87> (https://files.gitter.im/nim-lang/Nim/9ORi/Screenshot-2019-12-20-at-3.15.17-AM.png) |
19:15:31 | FromGitter | <alehander92> @bung87 i dont agree |
19:15:35 | FromGitter | <Willyboar> the goal for me is to be easy to use from a beginner to a pro |
19:15:42 | FromGitter | <alehander92> we work on a product using the javascript backend |
19:15:54 | * | Hideki_ joined #nim |
19:16:02 | FromGitter | <alehander92> and reusing stuff between the server and the client code is great |
19:16:12 | FromGitter | <alehander92> many people go thru great lenghts to do it in other languages |
19:16:21 | disruptek | this. |
19:16:26 | FromGitter | <alehander92> like node , ruby : openstack (which uses opal) |
19:16:26 | FromGitter | <alehander92> etc |
19:16:35 | FromGitter | <bung87> @alehander92 bot araq said that , when I asked him , the js backend development progress is behind c backend |
19:16:38 | FromGitter | <alehander92> clojurescript and clojure, scala.js and scala , many examples |
19:17:03 | FromGitter | <alehander92> @bung87 yeah, but i think its almost good enough for js |
19:17:41 | FromGitter | <alehander92> but this is again, just a nice thing to have |
19:17:43 | FromGitter | <bung87> I develop a tool before , itโ s pass the c tests, but not work for js backend |
19:18:02 | FromGitter | <alehander92> well, you need to be careful with some edges, but i work with the js backend for years |
19:18:11 | FromGitter | <alehander92> and i find it almost as good as typescript for my needs |
19:18:49 | FromGitter | <bung87> Iโd like to have a web framework using elm lang as template |
19:19:01 | FromGitter | <alehander92> of course nimux can support just anything that produces .js |
19:19:09 | FromGitter | <alehander92> so my point doesnt really matter |
19:19:51 | FromGitter | <Willyboar> Everything is open |
19:19:52 | FromGitter | <alehander92> @Willyboar looks great, cant wait to see more, sorry for my bikeshedding :) |
19:20:24 | * | Hideki_ quit (Ping timeout: 265 seconds) |
19:20:45 | FromGitter | <bung87> and here โs one more side to consider, the Nim community lib mostly is for c backend |
19:20:48 | FromGitter | <Willyboar> I want to be a project for everyone |
19:21:24 | FromGitter | <bung87> @Willyboar you finnally decide develop a framwork by your own? |
19:21:54 | FromGitter | <Willyboar> the doors are open to anyone who wants to join |
19:22:08 | FromGitter | <alehander92> @bung87 sorry, but i just dont agree |
19:22:25 | FromGitter | <Willyboar> to what? |
19:22:28 | FromGitter | <alehander92> many of the stdlib modules which are not supported arent really applicable in browsers |
19:22:51 | FromGitter | <alehander92> i think you shouldn compare the js backend to the c one, they are just very different |
19:22:59 | FromGitter | <alehander92> but to things like typescript or ecmascript |
19:23:21 | FromGitter | <Willyboar> I think elm is interesting like wasm |
19:23:23 | FromGitter | <bung87> I really check my tool, generated js source file. |
19:23:47 | FromGitter | <bung87> I just wrote 200 line about, it produce 6000+ line |
19:24:01 | FromGitter | <alehander92> well, thats because |
19:24:06 | FromGitter | <Willyboar> but for the start is better to concetrate to simple things |
19:24:08 | FromGitter | <alehander92> it imports much of the stdlib in one file |
19:24:23 | FromGitter | <alehander92> i guess |
19:24:28 | FromGitter | <alehander92> but i am telling you, that the nim js backend is good enough and we use it in a commercial product |
19:24:34 | FromGitter | <bung87> and the std DateTime ,dont produce a js Date type |
19:24:48 | FromGitter | <alehander92> well, that would be just wrong, as they're different types |
19:25:16 | FromGitter | <alehander92> still, if one is careful, he can reuse a huge amount of his own code |
19:25:38 | FromGitter | <alehander92> one of my plans is to actually reuse most of my UI code written in karax in a TUI app |
19:25:42 | FromGitter | <bung87> and I also using a timezones lib support more timezone, but also not support return a Date type |
19:26:52 | FromGitter | <alehander92> yeah, i agree some stdlib modules can be better in that sorry |
19:27:14 | FromGitter | <alehander92> but all in all, its a great fit for nimux |
19:28:23 | FromGitter | <bung87> and that day , I also see a RFC propsal to easy way add a backend |
19:29:30 | FromGitter | <bung87> I think it also a important thing, once done , developers from other background can add more backend to Nim |
19:33:22 | FromGitter | <alehander92> hmm, can you give me an example |
19:33:46 | FromGitter | <alehander92> like python backend? |
19:35:34 | * | sschwarzer quit (Quit: leaving) |
19:44:18 | * | Araq quit (*.net *.split) |
19:44:18 | * | acidx quit (*.net *.split) |
19:44:18 | * | gsingh93 quit (*.net *.split) |
19:44:30 | * | Araq joined #nim |
19:44:37 | * | acidx joined #nim |
19:44:58 | * | gsingh93 joined #nim |
19:46:22 | FromGitter | <bung87> no, not me |
19:47:51 | FromGitter | <bung87> I mean if there is someone interested , then someone must have good knowlage about programing , thatโs good for Nim. |
19:48:39 | disruptek | nlvm is a working demonstration of a 3rd-party backend. |
19:48:51 | disruptek | !repo nlvm |
19:48:51 | disbot | https://github.com/arnetheduck/nlvm -- 9nlvm: 11LLVM-based compiler for the Nim language 15 245โญ 18๐ด 7& 1 more... |
19:54:40 | FromGitter | <Willyboar> nice things happen in the nim world |
19:55:17 | disruptek | lotta happy people here. |
19:56:18 | FromGitter | <Willyboar> hearts and minds |
19:56:20 | FromGitter | <Willyboar> :P |
19:56:39 | disruptek | yep. |
19:56:44 | disruptek | let's do this thing. |
19:57:26 | disruptek | we had a saying in my car company: |
19:57:35 | disruptek | porsche: there is no substitute. |
19:57:40 | clyybber | I wanna buy a fine automobile |
19:57:40 | FromDiscord | <Milerius> Hello, i'm trying to use: https://github.com/PMunch/jsonschema |
19:57:40 | FromDiscord | <Milerius> |
19:57:40 | FromDiscord | <Milerius> But i'm creating a Schema inside a .nim file and i try to use it inside an unittest i got an error undeclared identifier: 'MyType' |
19:57:40 | FromDiscord | <Milerius> |
19:57:41 | FromDiscord | <Milerius> I was supposing that i have to add a * add the end of type but it's not working |
19:57:41 | FromDiscord | <Milerius> |
19:57:42 | FromDiscord | <Milerius> is it Normal ? |
19:57:50 | FromGitter | <bung87> my task done |
19:58:40 | FromDiscord | <Milerius> When i add a * i got : Error: expression expected, but found ':' |
19:59:09 | FromGitter | <bung87> you should export your type |
19:59:10 | disruptek | the * goes after the symbol name, not its type. |
19:59:32 | disruptek | type Foo*: Bar |
19:59:41 | FromDiscord | <Milerius> It's exactly what i tried |
20:00:02 | solitudesf | its = not : |
20:00:12 | FromDiscord | <Milerius> https://gist.github.com/Milerius/37c3923faa0660227fc998c18e73a07a |
20:00:21 | disruptek | right. |
20:00:33 | FromDiscord | <Milerius> (according to this library: https://github.com/PMunch/jsonschema) |
20:01:11 | FromDiscord | <Milerius> If i create a jsonSchema from this library i'm expecting to use exported type to test the schema |
20:01:13 | FromGitter | <alehander92> not sure if |
20:01:15 | FromGitter | <alehander92> a? : b |
20:01:19 | FromGitter | <alehander92> is parsed the same way as |
20:01:21 | FromGitter | <alehander92> a ?: b |
20:01:27 | FromGitter | <alehander92> maybe, but you need to check |
20:02:14 | FromDiscord | <Milerius> Yeah but this is not my problem i guess |
20:02:21 | FromDiscord | <Milerius> related to exporting type |
20:02:41 | FromDiscord | <Milerius> (it's working if i use the schema locally, i tried it) |
20:02:45 | FromDiscord | <Milerius> but i cannot export it |
20:03:11 | FromGitter | <alehander92> it seems it should be the same |
20:05:06 | * | revere quit (*.net *.split) |
20:05:06 | * | Lord_Nightmare quit (*.net *.split) |
20:05:17 | * | revere joined #nim |
20:05:19 | * | Lord_Nightmare joined #nim |
20:05:36 | * | PMunch joined #nim |
20:05:55 | FromGitter | <alehander92> i dont really think its supported maybe |
20:06:58 | FromGitter | <alehander92> so you can manually |
20:07:08 | FromGitter | <alehander92> hm, probably not |
20:07:29 | FromGitter | <alehander92> https://github.com/PMunch/jsonschema/blob/master/src/jsonschema.nim#L161 |
20:07:58 | FromGitter | <alehander92> and https://github.com/PMunch/jsonschema/blob/master/src/jsonschema.nim#L122 |
20:08:02 | FromGitter | <alehander92> need to be changed afaik |
20:08:10 | FromDiscord | <Milerius> Can i write unit test directly in the same nim file ? |
20:08:22 | FromDiscord | <Milerius> there is something like when defined(unit_test) |
20:08:25 | FromDiscord | <Milerius> ? |
20:08:28 | FromGitter | <alehander92> you can use `when isMainModule: <my tests>` |
20:08:46 | PMunch | Huh, do you have an issue with jsonschema? |
20:08:48 | FromGitter | <alehander92> and run directly your file |
20:09:15 | FromGitter | <alehander92> wow github links trigger nicks |
20:09:18 | FromGitter | <alehander92> smart |
20:09:28 | FromDiscord | <Clyybber> whats up with glibc |
20:09:34 | FromDiscord | <Clyybber> @Milerius ? |
20:09:37 | FromDiscord | <Clyybber> sorry |
20:09:39 | FromDiscord | <Clyybber> wrong tag |
20:09:41 | FromDiscord | <Clyybber> @mratsim |
20:09:49 | PMunch | Well is HexChat nicks trigger anywhere :) |
20:09:56 | FromDiscord | <Milerius> Yo PMunch |
20:10:00 | PMunch | Without any @ or anything like that |
20:10:00 | FromGitter | <alehander92> yes exactly |
20:10:04 | FromGitter | <alehander92> but its cool that |
20:10:07 | FromDiscord | <Milerius> I'm trying to use your library :p |
20:10:12 | FromGitter | <alehander92> github links techincally do have this property |
20:10:16 | FromDiscord | <mratsim> @Clyybber I uncovered a bug in glibc condition variables |
20:10:18 | FromGitter | <alehander92> that they include it |
20:10:22 | PMunch | Milerius, trying to? |
20:10:27 | FromDiscord | <Milerius> use jsonSchema |
20:10:33 | FromDiscord | <Milerius> but i'm in trouble |
20:10:36 | FromDiscord | <Milerius> tbh |
20:10:40 | * | solitudesf quit (Ping timeout: 265 seconds) |
20:10:42 | PMunch | alehander92, yeah as long as your nick is the same on IRC and GitHub |
20:10:49 | PMunch | Milerius, how so? |
20:10:52 | FromDiscord | <Milerius> I Couldn't use a jsonSchema that i have declared in a nim file in an unit test |
20:10:56 | FromDiscord | <Milerius> because type are not exported |
20:10:56 | FromDiscord | <mratsim> When I signal a condition variable, sometimes the waiting thread isn't woken up |
20:11:02 | * | luis_ joined #nim |
20:11:04 | FromDiscord | <Milerius> and i cannot export the type |
20:11:05 | FromDiscord | <mratsim> doesn't happen on OSX |
20:11:24 | * | solitudesf joined #nim |
20:12:00 | FromDiscord | <Milerius> @PMunch (file.nim -> create the json schema) (test.nim -> test the schema created in file.nim) |
20:12:06 | FromDiscord | <Milerius> Unable to test this way |
20:12:16 | * | luis_ quit (Client Quit) |
20:12:43 | * | luis_ joined #nim |
20:13:09 | FromDiscord | <Clyybber> @mratsim Ha, nice. |
20:13:09 | * | luis_ quit (Remote host closed the connection) |
20:14:02 | FromDiscord | <mratsim> not nice, either I give up on my backoff, or I implement some super complicated scheme (and any kind of loop on the signaler thread might block it which is not what I want ...) |
20:14:12 | FromDiscord | <Clyybber> Or glibc gets a fix? |
20:14:12 | FromDiscord | <mratsim> tough luck on that |
20:14:40 | FromDiscord | <mratsim> Would probably be easier to implement my own Futexes and Condition variables on top of OS syscalls |
20:15:04 | * | NimBot joined #nim |
20:15:39 | FromDiscord | <Clyybber> AFAIK yes |
20:17:09 | FromDiscord | <Milerius> Ah that's why |
20:17:20 | FromDiscord | <Milerius> Do you think it's possible to fix the export PMunch ? |
20:17:39 | FromDiscord | <Milerius> Also i may have question for the usage |
20:17:44 | PMunch | What do you mean fix, it's done that way on purpose.. |
20:18:01 | FromDiscord | <Milerius> ok, i will use include |
20:19:04 | * | leorize quit (*.net *.split) |
20:19:04 | * | ng0 quit (*.net *.split) |
20:19:26 | * | luis_ joined #nim |
20:19:36 | PMunch | But it would be possible to add a switch to jsonschema to make it export everything |
20:20:25 | FromDiscord | <mratsim> @clyyber, it doesn't happen with musl |
20:20:35 | FromDiscord | <mratsim> @Clyybber* |
20:20:40 | FromDiscord | <Milerius> Ok thanks for the info |
20:20:52 | FromDiscord | <mratsim> ah no it just did |
20:21:18 | FromDiscord | <Milerius> now i may have another question PMunch |
20:21:20 | FromDiscord | <Milerius> for the usage |
20:23:07 | PMunch | Fire away |
20:23:48 | * | luis_ quit (Remote host closed the connection) |
20:25:35 | * | luis_ joined #nim |
20:25:43 | * | luis_ quit (Remote host closed the connection) |
20:27:26 | FromDiscord | <Milerius> giving the following type: https://gist.github.com/Milerius/fdcc48767e1c54505eeb805fc6a2a7b2 |
20:27:26 | FromDiscord | <Milerius> |
20:27:26 | FromDiscord | <Milerius> Let's say i have my json, i validate my schema from the json i receive. so i have my JsonNode |
20:27:26 | FromDiscord | <Milerius> |
20:27:27 | FromDiscord | <Milerius> I validate the schema with isValid function |
20:27:27 | FromDiscord | <Milerius> |
20:27:29 | FromDiscord | <Milerius> Then i have just to unmarshall to my type, Everything will be automatic ? |
20:27:48 | shashlick | anyone have code to redirect stdout to a file in nim? |
20:28:18 | PMunch | By the way, here is an example on how to use it with import to access the types and procedures you need: http://ix.io/24T9/ |
20:29:01 | FromDiscord | <Milerius> Thank's i'm reading it |
20:31:16 | * | luis_ joined #nim |
20:33:07 | * | ng0 joined #nim |
20:33:07 | FromDiscord | <mratsim> @shashlick, I just use `tee` or `script` |
20:33:13 | PMunch | Milerius, and this is how I use it in nimlsp: http://ix.io/24Tb/ |
20:33:45 | * | luis_ quit (Client Quit) |
20:35:27 | * | luis_ joined #nim |
20:35:30 | FromDiscord | <Milerius> ok i'm trying to understand |
20:35:37 | FromDiscord | <Milerius> in fact i did The type twice |
20:35:40 | PMunch | Essentially that verifies that the passed JsonNode is of the correct schema, then it shadows the identifier I used for the JsonNode with a version cast to this distinct type. The distinct type has a `[]` which checks on compile-time if that field exists in the schema or not and throws an error if it doesn't, or returns the correct type according to the schema. |
20:36:40 | FromDiscord | <Milerius> So if i'm understanding correctly |
20:37:07 | FromDiscord | <Milerius> Let's say you receive an external Json, you parse it to a node, then you give it to whenValid? |
20:38:45 | * | luis_ quit (Remote host closed the connection) |
20:41:15 | FromDiscord | <Clyybber> @mratsim Absolutely sure that it isn't some quirky but documented behaviour? |
20:41:20 | shashlick | https://nim-lang.org/docs/io.html#reopen%2CFile%2Cstring%2CFileMode worked |
20:41:27 | FromDiscord | <Clyybber> Seems wierd that both glibc and musl have that bug |
20:41:31 | PMunch | Milerius, correct |
20:41:33 | * | luis_ joined #nim |
20:42:15 | PMunch | Something like this: https://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim#L171-L177 |
20:42:57 | FromDiscord | <Milerius> It's very nice |
20:43:19 | FromDiscord | <Milerius> And when it's valid how do you access the optional stuff ? |
20:44:05 | PMunch | Oh wait, never mind, it doesn't actually cast the type.. |
20:44:14 | PMunch | I thought I had implemented that, but apparently not |
20:44:33 | * | luis_ quit (Client Quit) |
20:44:58 | * | luis_ joined #nim |
20:45:02 | PMunch | Milerius, same way as normal, but x["myField"] will now return an `Option[JsonNode]` from the `options` module |
20:45:27 | FromDiscord | <Milerius> Hmm ok |
20:45:29 | FromDiscord | <Milerius> i think i understand |
20:46:39 | PMunch | By the way, you can pass `-d:jsonSchemaDebug` to the compiler and it will show you all the things it generates |
20:46:45 | FromDiscord | <Milerius> ๐ฎ |
20:46:47 | FromDiscord | <Milerius> i will check |
20:47:07 | PMunch | Be warned though, it's not meant to be super readable :P |
20:47:21 | * | luis_ quit (Remote host closed the connection) |
20:47:28 | FromDiscord | <Milerius> i'm a beginner but your module will probably make me save lot of time |
20:48:04 | * | voltist joined #nim |
20:48:39 | PMunch | Well, you've already spent some time learning how to use it :P |
20:49:08 | PMunch | It's meant to "just work" so maybe I should add some more documentation.. |
20:49:20 | PMunch | And possibly throw in the whenValid templates.. |
20:50:05 | FromDiscord | <mratsim> @Clyybber: https://github.com/mratsim/weave/issues/56 |
20:50:06 | * | ng0 quit (Changing host) |
20:50:06 | * | ng0 joined #nim |
20:50:06 | disbot | โฅ [Glibc] Condition variable lost wakeups |
20:50:56 | FromDiscord | <mratsim> I don't assume anything at this point |
20:51:06 | FromDiscord | <mratsim> but I have math on my side |
20:51:08 | FromDiscord | <Milerius> I will show you when i will have something that i like PMunch |
20:51:13 | FromDiscord | <Milerius> for the moment still discovering it |
20:51:30 | PMunch | Hmm, federico3 does the nimble directory not install dependencies when generating documentation? |
20:53:34 | * | NimBot joined #nim |
20:53:34 | PMunch | Hmm, just realised that this module doesn't have any documentation besides the README.. |
20:54:50 | PMunch | Milerius, you kinda jumped in the deep end when you decided to use a rather complex DSL that generates code which leverages the power of some compile-time magic and the strong type system in Nim :P |
20:55:05 | FromDiscord | <Milerius> Yeah... |
20:55:09 | FromDiscord | <Milerius> Now i'm asking my self |
20:55:15 | FromDiscord | <Milerius> how we deal properly is optional |
20:55:19 | FromDiscord | <Milerius> using isSome() each time for get |
20:55:23 | PMunch | Well.. |
20:55:35 | FromDiscord | <Milerius> I would like some kind of ignore if there is no value, but use it if it's exist |
20:55:57 | PMunch | May I reccomend https://github.com/PMunch/nim-optionsutils |
20:56:06 | PMunch | (shameless plug) |
20:56:28 | FromDiscord | <Milerius> im checking |
20:56:46 | PMunch | Now that module has proper documentation! https://nimble.directory/docs/optionsutils//optionsutils.html |
20:56:57 | FromDiscord | <Milerius> i'm on it already ๐ |
20:57:22 | FromDiscord | <Milerius> Ok 'im explaining now |
20:58:37 | FromDiscord | <Milerius> I have to create a json and send it to an RPC |
20:58:37 | FromDiscord | <Milerius> |
20:58:37 | FromDiscord | <Milerius> This json have optional value, i would like to automatically add the params to the output json if they are present. |
20:58:53 | FromDiscord | <Milerius> I have to create a json and send it to an RPC |
20:58:53 | FromDiscord | <Milerius> |
20:58:53 | FromDiscord | <Milerius> This json have optional value, i would like to automatically add the params to the output json if the optional have some value |
21:02:10 | * | krux02 joined #nim |
21:07:51 | PMunch | Milerius, just pushed a version v1.1.0 of optionsutils which means you don't need to have both a `some` and a `none` case for `withSome`. It's something that's been annoying me for a while. |
21:08:00 | * | voltist quit (Read error: Connection reset by peer) |
21:08:36 | PMunch | Oh and by the way, please don't edit your messages on Discord.. |
21:08:46 | PMunch | They come through as a duplicate on IRC |
21:09:09 | PMunch | A bit annoying: https://irclogs.nim-lang.org/19-12-2019.html#20:58:37 |
21:09:21 | FromDiscord | <Milerius> ah i'm sorry |
21:09:27 | PMunch | No problem |
21:09:31 | FromDiscord | <Milerius> By the way in the json schema |
21:09:36 | FromDiscord | <Milerius> how we define the root object |
21:09:42 | PMunch | Root object? |
21:09:55 | FromDiscord | <Milerius> the first braces |
21:10:00 | FromDiscord | <Milerius> doesn't have a name, but contains object |
21:10:00 | PMunch | Huh? |
21:10:12 | PMunch | Oh, var x = %{} |
21:10:28 | FromDiscord | <Milerius> I mean in the schema ? |
21:10:32 | FromDiscord | <Milerius> ok i send a gist |
21:10:33 | FromDiscord | <Milerius> minute |
21:11:12 | FromDiscord | <Milerius> https://gist.github.com/Milerius/ed710b577d1543d4edb764bdd26b02e5 |
21:11:24 | FromDiscord | <Milerius> the schema is at the end |
21:12:53 | PMunch | Uhm, what are you trying to do there? |
21:13:19 | * | voltist joined #nim |
21:13:25 | FromDiscord | <Milerius> Representing the schema of this json |
21:13:30 | PMunch | Oh, you're trying to define the outer object, which is an object with random keys? |
21:14:01 | FromDiscord | <Milerius> my whole json is |
21:14:02 | FromDiscord | <Milerius> tables[string, CoinConfigParams] |
21:14:05 | FromDiscord | <Milerius> something like that |
21:14:08 | PMunch | That isn't supported ("yet"). What you need to do is loop over all the keys and verify each of them |
21:14:36 | FromDiscord | <Milerius> root: Table[string, CoinConfigParams]* |
21:14:45 | FromDiscord | <Milerius> Ah ๐ข |
21:15:00 | FromDiscord | <Milerius> I was expecting to read the json file and use isValid with the schema |
21:16:12 | PMunch | I mean, you could actually make that table: var ccps: Table[string, CoinConfigParams]; for key in json.keys: let obj = json[key]; whenValid(CoinConfigParams, obj): ccps[key] = obj |
21:16:18 | PMunch | Something like that |
21:17:30 | FromDiscord | <Milerius> https://gist.github.com/Milerius/56372c2f902aa559cbfb56ecea771789 there is the final version |
21:17:34 | FromDiscord | <Milerius> that i'm trying to achieve |
21:20:09 | FromGitter | <alehander92> but PMunch i dont get it |
21:20:19 | FromGitter | <alehander92> why isnt it supposed to be imported |
21:20:26 | FromGitter | <alehander92> i think include should be rarely used |
21:21:27 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
21:22:14 | PMunch | Milerius: I'd probably do something like this: http://ix.io/24Tt/nim |
21:22:36 | PMunch | alehander92, I wanted to give the user the possibility to not export all the types |
21:22:43 | FromDiscord | <Milerius> nice idea ! |
21:23:29 | PMunch | Oh whoops, those `"key"` is obviously meant to just be `key` |
21:25:40 | * | abm joined #nim |
21:26:02 | clyybber | krux02: Sup krux, have you seen #12938? Somehow lengthOrd( ExampleArray ) is too big for an int64 |
21:26:08 | lqdev[m] | I'm trying to `getType` on a default parameter, but it doesn't seem to work https://play.nim-lang.org/#ix=24Tw |
21:26:25 | lqdev[m] | :s/getType/getTypeInst/ |
21:27:34 | FromDiscord | <Clyybber> @mratsim no comment? |
21:27:38 | FromDiscord | <Clyybber> losing sanity? |
21:27:40 | FromDiscord | <Clyybber> ๐ |
21:27:42 | FromDiscord | <mratsim> yes |
21:28:28 | lqdev[m] | `getTypeInst` seems to work on normal variables, though. |
21:28:35 | FromDiscord | <mratsim> I think I'm gonna have to either switch backoff strategy or rewrite part of pthread from scratch |
21:29:27 | lqdev[m] | ah, I see, it's `Ident "t"` instead of `Sym "t"`. is there any way I can get around this? |
21:30:06 | FromDiscord | <mratsim> use typed input |
21:30:15 | FromDiscord | <mratsim> ah |
21:30:22 | FromDiscord | <mratsim> default parameter are not typed? |
21:30:29 | FromDiscord | <mratsim> you need to bindSym them then |
21:30:34 | lqdev[m] | seems like so. |
21:30:35 | FromDiscord | <mratsim> or newLit |
21:30:42 | FromDiscord | <mratsim> but should be a bug |
21:31:02 | lqdev[m] | I just read about that .experimental: "dynamicBindSym" thing, it might help |
21:33:52 | FromDiscord | <Clyybber> @mratsim What is the crazy thing in your screenshot? That en.signaled switched to 1? |
21:34:00 | * | letto quit (Quit: Konversation terminated!) |
21:35:30 | FromDiscord | <mratsim> Worker 1, is sleeping on the condition variable for a while. I have locks and full fences everywhere. |
21:35:30 | FromDiscord | <mratsim> Worker 0 signals TWICE, and also take a lock and unlock (according to the Linux condition variable ceremony I found in some posts) |
21:35:30 | FromDiscord | <mratsim> And worker 1 still doesn't wake up |
21:35:59 | FromGitter | <alehander92> PMunch so `*` for each |
21:36:05 | FromDiscord | <mratsim> And fighting against either glibc or GCC is a pain |
21:36:05 | FromGitter | <alehander92> might be easy to implement |
21:36:19 | * | gour quit (Remote host closed the connection) |
21:36:33 | FromGitter | <alehander92> but i agree that if one wants |
21:36:39 | FromGitter | <alehander92> the importsite to control the exportees |
21:36:43 | FromGitter | <alehander92> hmm it can with except |
21:36:50 | FromGitter | <alehander92> so i think this works but it needs a patch |
21:36:54 | FromGitter | <alehander92> but its not too important |
21:37:07 | FromDiscord | <Clyybber> @mratsim Might be worth it joining glibc or musl irc and asking there? |
21:37:32 | FromDiscord | <mratsim> and losing 3 days to reproduce that in pure C? |
21:37:50 | PMunch | alehander92, well that's true.. |
21:37:56 | FromDiscord | <mratsim> I read and understand C but I'm not really a C dev |
21:38:11 | FromDiscord | <Clyybber> Yeah, maybe they know whats up right from the start? |
21:38:28 | PMunch | What happens if you have a shim module that is import somemodule except sometype; export somemodule? |
21:38:35 | FromDiscord | <Clyybber> Or they can point you to the part of musl/glibc code that explains this behaviour |
21:38:37 | PMunch | Wolud that do what you expect it to? |
21:40:05 | lqdev[m] | is it possible to `bindSym` at macro instantiation time? |
21:40:46 | FromDiscord | <mratsim> want to know a compiler bug I discovered? GCC-only. THis will crash probably by stack corruption |
21:40:46 | FromDiscord | <mratsim> https://cdn.discordapp.com/attachments/371759389889003532/657336549213732894/unknown.png |
21:41:08 | FromDiscord | <Clyybber> holy fuck |
21:41:25 | FromDiscord | <mratsim> the fix is putting arena after: https://github.com/mratsim/weave/blob/master/weave/memory/memory_pools.nim#L216 |
21:41:48 | FromDiscord | <mratsim> I lost an evening on that thing |
21:42:02 | FromDiscord | <Clyybber> hmm |
21:42:57 | lqdev[m] | @mratsim bindSym doesn't help, because it looks up symbols in the module it was called |
21:45:02 | shashlick | @ldev - your issue should be fixed |
21:45:38 | lqdev[m] | shashlick: the CI one from yesterday? |
21:46:19 | PMunch | Wait what? Why is that a bug mratsim? |
21:46:26 | lqdev[m] | I already bumped nimterop in my nimble file about an hour ago, and it works beautifully now. |
21:46:30 | PMunch | Like what causes it? |
21:46:44 | shashlick | @lqdev - neat |
21:46:48 | FromDiscord | <Milerius> PMunch i finished my first usage |
21:46:51 | FromDiscord | <Milerius> it's work like a charm |
21:46:52 | FromDiscord | <Milerius> https://github.com/KomodoPlatform/atomicDEX-QT/blob/master/atomic_dex_desktop/src/atomic_dex_desktop/coins/coins_cfg.nim |
21:46:57 | FromDiscord | <Milerius> i'm really happy :p |
21:47:40 | FromDiscord | <mratsim> that's quite concise |
21:47:53 | lqdev[m] | think I might have to ignore non-literal default parameters for the time being :/ |
21:48:30 | PMunch | Milerius, yay :) |
21:48:38 | * | ng0 joined #nim |
21:48:42 | FromDiscord | <Milerius> Thank's you for your insane help PMunch |
21:48:45 | FromDiscord | <Milerius> I appreciate a lot |
21:48:47 | FromDiscord | <Milerius> very nice community |
21:49:38 | PMunch | Thanks, we try our best :) |
21:50:20 | FromDiscord | <Milerius> How we print a type in nim ? |
21:50:25 | PMunch | Or at least I do, but in general the Nim community is very friendly |
21:50:25 | FromDiscord | <Milerius> echo typeof(T) ? |
21:50:29 | PMunch | yeah |
21:50:38 | FromDiscord | <Milerius> thanks |
21:50:43 | * | Vladar quit (Quit: Leaving) |
21:50:49 | PMunch | !eval var x: int; echo x.typeof |
21:50:51 | NimBot | int |
21:51:15 | * | letto joined #nim |
21:52:49 | FromDiscord | <Clyybber> @mratsim How is it "fixed"? |
21:52:51 | * | silvernode quit (Ping timeout: 240 seconds) |
21:52:57 | FromDiscord | <Clyybber> Fixed in gcc HEAD? |
21:53:03 | FromDiscord | <mratsim> no, in my code |
21:53:12 | FromDiscord | <mratsim> my code already has the workaround |
21:53:25 | FromDiscord | <mratsim> gcc is till broken in 9.x |
21:54:02 | FromDiscord | <Clyybber> How do you work around it? |
21:54:38 | FromDiscord | <mratsim> look the difference between the screenshot and the quoted code |
21:54:50 | FromDiscord | <mratsim> pool.last = arena place was changed |
21:55:07 | FromDiscord | <Clyybber> its gone? |
21:55:18 | FromDiscord | <mratsim> yes, if you do that gcc doesn't generates faulty code |
21:55:39 | FromDiscord | <Clyybber> interesting |
21:55:40 | FromDiscord | <mratsim> believe me, I didn't want to believe it "you won't imagine what happens next" |
21:56:26 | FromDiscord | <mratsim> it also disappears if you add an "echo" in between so annoying to debug |
21:56:38 | stefantalpalaru | Could it be a bug in the "align" pragma instead? |
21:56:55 | FromDiscord | <mratsim> it doesn't happen with clang or icc |
21:59:37 | stefantalpalaru | Are you disabling GCC's default packing of your custom aligned struct with "__attribute__((__packed__))"? |
21:59:49 | FromDiscord | <mratsim> no |
22:00:32 | FromDiscord | <mratsim> I checked the assembly, not closely but gcc and clang assembly are different |
22:00:58 | stefantalpalaru | Sounds like a disagreement about a struct member's offset between Nim and C. See if you can get a reproducible case in C, before blaming the C compiler. |
22:01:25 | FromDiscord | <mratsim> Clang doesn't crash and just moving the assignment out of the if section solves the issue |
22:01:55 | stefantalpalaru | That's not encouraging. |
22:02:27 | FromDiscord | <mratsim> well since I have an easy fix I didn't investigate further |
22:03:01 | FromDiscord | <mratsim> the condition variable not signaling properly is more of an issue currently. :/ |
22:03:18 | FromDiscord | <Clyybber> inb4 its all related |
22:03:26 | FromDiscord | <Clyybber> by some unholy magic |
22:03:37 | * | luis_ joined #nim |
22:04:33 | * | luis_ quit (Client Quit) |
22:05:03 | * | luis_ joined #nim |
22:07:41 | * | solitudesf quit (Ping timeout: 268 seconds) |
22:08:11 | voltist | I've chanced upon recordings of talks about Nim on YouTube, and one guy was wearing a Nim T-shirt. Is there a place online where I can buy these in a way that supports the project, or are they all unofficial? |
22:08:25 | FromDiscord | <mratsim> ping @dom96 |
22:08:53 | FromDiscord | <mratsim> You can get them at Fosdem, Brussels on February 1 and 2 I guess |
22:10:35 | voltist | That's a little far to fly from here in NZ for a T-shirt I think ;) |
22:11:34 | FromDiscord | <mratsim> I heard you could do quantum teleportations ๐ |
22:12:16 | FromDiscord | <Clyybber> ending up very confused on what or where you are |
22:12:20 | FromDiscord | <Clyybber> and when |
22:12:41 | clyybber | disruptek: Should we worry about c-blake? https://github.com/c-blake/cligen/commit/db80691e0a0a00e63d57b3f71f544c3611a10597 |
22:12:48 | clyybber | watch the streets fellas |
22:12:52 | * | luis_ quit (Ping timeout: 248 seconds) |
22:12:56 | disruptek | lol |
22:13:12 | voltist | Hmmmm |
22:13:32 | voltist | Oddly specific |
22:14:11 | disruptek | i've heard it's hard out there for a pimp. |
22:15:46 | * | luis_ joined #nim |
22:16:09 | * | luis_ quit (Client Quit) |
22:16:23 | FromDiscord | <mratsim> probably gonna drive far maybe in the snow for the break |
22:16:34 | FromGitter | <dumjyl> disruptek: btw `nimph tag` crashes on projects without any tags. I was to lazy to open an issue, but made a pr to bump with info. |
22:16:43 | voltist | mratsim: Well there is this, but you can't be sure where the profit is going (or how much is going anywhere considering the nature of these online marketplaces): https://teespring.com/shop/nimlang1?pid=374&cid=100046 |
22:17:02 | disruptek | dumjyl: bump or nimph? |
22:17:31 | FromGitter | <dumjyl> `nimph` crashes but the pr is to `bump` |
22:17:42 | FromDiscord | <mratsim> @voltist it certainly looks like the official one, but you would have to ping dom96 or Araq to confirm |
22:17:43 | disruptek | aha; thank you! |
22:18:41 | voltist | mratsim: will do |
22:19:38 | disruptek | dumjyl: 0.5.3 |
22:19:52 | disruptek | any other issues? |
22:24:25 | FromGitter | <dumjyl> One, i'll open an issue. |
22:24:57 | disruptek | https://github.com/disruptek/nimph/issues/88 |
22:24:59 | disbot | โฅ arbitrary commit hash requirements broken |
22:25:46 | * | narimiran joined #nim |
22:26:19 | disruptek | i'm rewriting resolution at the moment, to make it looser for matches. i think it's more important to match something than not match, especially after we have requirement negative (deficiencies). |
22:26:31 | disruptek | s/negative/negation/ |
22:32:44 | * | NimBot joined #nim |
22:32:54 | * | FromDiscord joined #nim |
22:34:23 | FromGitter | <dumjyl> Yeah, didn't see a need for it to be on nimble. |
22:34:29 | * | dom96 joined #nim |
22:34:29 | * | dom96 quit (Changing host) |
22:34:29 | * | dom96 joined #nim |
22:35:26 | disruptek | so when you just have a url, it's basically guessing the package name and stripping kebab-prefixes because they are usually like nim-foobar. |
22:35:44 | disruptek | we can just render it more verbosely here. |
22:37:26 | * | theelous3 joined #nim |
22:51:50 | * | marmotini_ quit (Remote host closed the connection) |
22:59:58 | * | PMunch quit (Remote host closed the connection) |
23:01:19 | * | actuallybatman joined #nim |
23:02:06 | FromGitter | <deech> Tall order but anyone know of a YAML parser that works at compile time? Not worried about {de}serialization, just a parse tree. |
23:02:20 | disruptek | not unless you can extend sealmove's. |
23:02:43 | FromGitter | <deech> Do you have a link I'm not familiar with them. |
23:02:52 | disruptek | !repo sealmove/ |
23:02:53 | disbot | https://github.com/sealmove/nimitai -- 9nimitai: 11A native binary data structure parser generator 15 8โญ 0๐ด 7& 3 more... |
23:02:57 | disruptek | part of that. |
23:03:17 | disruptek | i think he's only parsing a subset of yaml, though. |
23:03:43 | disruptek | if you find a solution, please lemme know. openapi just demands that you feed it json for this reason. |
23:04:32 | FromGitter | <deech> NimYAML seems good if you don't need it at compile time. |
23:05:26 | * | setenforce quit (Ping timeout: 265 seconds) |
23:06:53 | * | zedeus quit (Ping timeout: 265 seconds) |
23:07:23 | FromGitter | <deech> On that note is NimYAML pretty robust? |
23:08:23 | disruptek | i didn't mess with it. |
23:08:46 | disruptek | i'm just using yq for conversion. |
23:10:07 | FromDiscord | <mratsim> I feel like it has been mostly focused on serialization deserialization |
23:10:32 | FromDiscord | <mratsim> if I need to work on the node themselves I always transform them to json |
23:11:37 | FromDiscord | <mratsim> I terms of deserialization it's robust, in terms of serialization, the default output has too much tags and such and it's really hard to find the option to disable that and get a humane output |
23:12:48 | FromDiscord | <mratsim> If you want to see actual examples, check our test files that import yaml files in the nim-beacon-chain repo: https://github.com/status-im/nim-beacon-chain/search?q=yaml&unscoped_q=yaml |
23:16:28 | FromGitter | <deech> Thanks! |
23:22:50 | * | al_ joined #nim |
23:23:14 | * | al_ is now known as Guest94576 |
23:27:21 | * | leorize joined #nim |
23:29:40 | * | leorize quit (*.net *.split) |
23:31:27 | * | narimiran quit (Ping timeout: 260 seconds) |
23:33:24 | * | Guest94576 quit (Quit: Guest94576) |
23:33:47 | * | voltist quit (Ping timeout: 260 seconds) |
23:37:27 | * | uvegbot joined #nim |
23:37:30 | * | zyklon quit (Quit: Konversation terminated!) |
23:52:57 | * | abm quit (Quit: Leaving) |
23:53:20 | FromGitter | <Willyboar> I think thats it for tonight. Tomorrow i will start the cli part |