00:00:02 | rayman22201 | This problem does sound really familiar. I think I've experienced it as well, but I can't quite remember the details. |
00:00:47 | rayman22201 | the string interpolation in templates definitely has some limits / edge cases. |
00:01:02 | FromGitter | <zacharycarter> I was attempting to port HyperHTML to Nim |
00:01:45 | FromGitter | <zacharycarter> and that lib relies heavily on ES6 string template literals - similar to the lit-html library from google |
00:06:13 | * | zachk quit (Quit: Leaving) |
00:07:41 | FromDiscord_ | <exelotl> uhhh is this supposed to happen??? https://hastebin.com/raw/afikoyuxax |
00:09:40 | FromDiscord_ | <exelotl> very weird output lol |
00:11:03 | * | lritter joined #nim |
00:23:16 | FromGitter | <zacharycarter> exeltol: backticks in `quote do` blocks interpolate Nim variables |
00:24:11 | FromGitter | <zacharycarter> not sure why you're getting `3` - hopefully someone else can explain |
00:25:11 | FromGitter | <zacharycarter> oh - I think I know |
00:25:13 | rayman22201 | That's probably the uiqueID of varName in the macro vm |
00:25:45 | rayman22201 | quote do is the same mechanism as templates, so you have similar limitations. You are going to have to build the ast a different way. |
00:26:40 | FromGitter | <zacharycarter> yeah - I struggled quite a bit with this |
00:26:47 | FromDiscord_ | <exelotl> I've never had any issue interpolating nim nodes this way before, this is the first time it's ever given me numbers instead :') |
00:26:57 | shashlick | @zacharycarter - with soloud, which backends should i use on windows and linux |
00:28:03 | shashlick | okay winmm worked on my laptop, not on my VM which probably doesn't have an audio card |
00:28:17 | shashlick | linux i tried OSS but it doesn't load |
00:28:59 | FromGitter | <zacharycarter> maybe OpenAL? |
00:29:27 | shashlick | ultimately i want to test on travis and appveyor |
00:29:35 | FromGitter | <zacharycarter> hmm |
00:29:37 | shashlick | wonder if there's audio devices on them |
00:30:51 | FromGitter | <zacharycarter> good question... I just saw the backend description page - sounds like sdl2 / oss are recommended for linux, and it sounds like you already had issues with one |
00:32:21 | rayman22201 | @exelotl, this is ugly but works: https://hastebin.com/raw/ocijitehuw |
00:33:19 | rayman22201 | basically string building. It's crap, but the only other more correct way is to build the ast by hand I think. |
00:33:56 | FromGitter | <zacharycarter> ```code paste, see link``` ⏎ ⏎ will give you a good idea of the AST being produced by your original code [https://gitter.im/nim-lang/Nim?at=5c411ef40721b912a598c135] |
00:34:09 | rayman22201 | at least until someone comes online that has a better knowledge of how the template interpolation works internally :-P |
00:34:16 | * | leorize joined #nim |
00:34:41 | FromDiscord_ | <exelotl> ohh yeah that works, I ended up just building the ast manually lol |
00:38:01 | * | stefanos82 quit (Remote host closed the connection) |
00:38:23 | shashlick | @zacharycarter - worked on my linux machine with ALSA |
00:39:11 | FromGitter | <zacharycarter> shashlick: that sounds right - I believe I had success with that back end too when I had soloud integrated with FRAG on linux |
00:39:46 | shashlick | now to see if i can get it to run on travis and appveyor |
00:41:36 | FromGitter | <zacharycarter> :D I wish you luck - if you can't and need any testing on macOS please let me know |
00:42:16 | shashlick | yep appveyor returned 7 which means no audio |
00:42:26 | shashlick | what backend do you recommend on mac??? |
00:44:16 | FromGitter | <zacharycarter> I want to say I used SDL2 - but PortAudio may be an option |
00:47:03 | shashlick | cool - here's what a test for soloud.nim looks like |
00:47:05 | shashlick | https://github.com/genotrance/nimterop/blob/walkdir/tests/tsoloud.nim |
00:48:20 | * | abm quit (Quit: Leaving) |
00:50:46 | shashlick | meh both appveyor and travis don't have alsa |
00:52:40 | * | vlad1777d quit (Ping timeout: 272 seconds) |
00:58:05 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
01:04:59 | * | Home joined #nim |
01:05:56 | FromGitter | <zacharycarter> :/ |
01:06:08 | FromGitter | <zacharycarter> can't say I'm TOO surprised |
01:06:45 | FromGitter | <zacharycarter> shashlick: this is a problem when it comes to testing games |
01:08:15 | FromGitter | <zacharycarter> a lot of their functionality is difficult to test in a CI/CD environment |
01:44:58 | shashlick | any ideas on this? travis with its old gcc is a pain - https://travis-ci.org/genotrance/nimterop/jobs/481152438#L2047 |
01:50:11 | * | abm joined #nim |
01:51:12 | * | fredrik92 joined #nim |
01:52:56 | * | nif_ joined #nim |
01:55:07 | * | oculuxe joined #nim |
01:55:55 | * | junland_ joined #nim |
01:56:45 | * | skellock joined #nim |
01:59:13 | * | Cthalupa- joined #nim |
02:00:18 | * | oculux quit (*.net *.split) |
02:00:18 | * | couven92 quit (*.net *.split) |
02:00:18 | * | ryukoposting quit (*.net *.split) |
02:00:18 | * | Cthalupa quit (*.net *.split) |
02:00:18 | * | junland quit (*.net *.split) |
02:00:18 | * | Tanger quit (*.net *.split) |
02:00:18 | * | nif quit (*.net *.split) |
02:00:18 | * | Amun_Ra quit (*.net *.split) |
02:06:46 | * | Tanger joined #nim |
02:07:01 | * | ryukoposting joined #nim |
02:08:44 | * | Amun_Ra joined #nim |
02:09:46 | * | skellock quit (Ping timeout: 244 seconds) |
02:16:28 | * | Home quit (Quit: Leaving) |
02:17:23 | * | zachk joined #nim |
02:18:04 | * | ng0_ joined #nim |
02:20:49 | * | ng0 quit (Ping timeout: 256 seconds) |
02:21:21 | FromGitter | <zacharycarter> shashlick: sounds like the preprocessor is having issues with `__has_feature` |
02:21:25 | FromGitter | <zacharycarter> but I have no idea what that does... |
02:22:15 | FromGitter | <zacharycarter> https://stackoverflow.com/questions/16477479/compile-xbmc-for-ios-error-with-missing-binary-operator-before-token - mebbe? |
02:24:11 | FromGitter | <zacharycarter> looks like this is where that issue is occurring - https://github.com/jarikomppa/soloud/blob/973a5dc4baf42506d9929b6a4e8af0dec4164755/src/audiosource/wav/dr_flac.h#L141-L149 |
02:24:39 | shashlick | could be - i've opened an issue - https://github.com/jarikomppa/soloud/issues/206 |
02:25:42 | FromGitter | <zacharycarter> https://opensource.apple.com/source/lldb/lldb-69/llvm/tools/clang/docs/LanguageExtensions.html#__has_feature_extension |
02:25:49 | FromGitter | <zacharycarter> might be another resource to link |
02:26:15 | FromGitter | <zacharycarter> although weird - you're comping with gcc apparently |
02:26:24 | FromGitter | <zacharycarter> everything I'm finding is mentioning clang issues |
02:27:03 | FromGitter | <zacharycarter> ohh i think I get why |
02:27:12 | FromGitter | <zacharycarter> gcc probably doesn't have __has_attribute - only clang does |
02:27:22 | FromGitter | <zacharycarter> so the preprocessor is throwing up there |
02:28:05 | FromGitter | <zacharycarter> so yeah - if you put: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ above that - you should be fine [https://gitter.im/nim-lang/Nim?at=5c4139b595e17b45256bb3f3] |
02:29:17 | shashlick | what's weird is that travis has gcc 4.8.x so that __GNUC__ >= 4 should work |
02:29:18 | shashlick | no ideas |
02:29:40 | shashlick | anyway, soloud is now part of the routine testing |
02:29:55 | shashlick | i've disabled it on travis linux for now |
02:30:06 | FromGitter | <zacharycarter> sweet :D I think the Nim game dev community will be happy for that |
02:30:23 | shashlick | if you get a chance, please try adding a when defined(OSX) into tsoloud.nim 😄 |
02:31:14 | FromGitter | <zacharycarter> okay sure I can do that - after this weekend I will probably have time |
02:31:24 | FromGitter | <zacharycarter> I need to prep for this interview |
02:32:18 | FromGitter | <Varriount> shashlick: How is nimterop going? |
02:35:54 | * | zachk quit (Read error: Connection reset by peer) |
02:36:37 | * | zachk joined #nim |
02:36:41 | * | leorize quit (Ping timeout: 256 seconds) |
02:37:08 | * | zachk quit (Changing host) |
02:37:08 | * | zachk joined #nim |
02:39:01 | shashlick | no worries |
02:39:14 | shashlick | @Varriount - I'm quite happy with the progress |
02:39:22 | * | abm quit (Quit: Leaving) |
02:40:00 | shashlick | it works pretty well with C libs |
02:40:12 | * | ng0_ quit (Quit: Alexa, when is the end of world?) |
02:40:22 | shashlick | still some minor bugs and requirements remain but most stuff works with zero effort |
02:40:46 | * | leorize joined #nim |
03:00:35 | * | banc quit (Quit: Bye) |
03:03:08 | * | dddddd quit (Remote host closed the connection) |
03:04:19 | * | zachk quit (Quit: Leaving) |
03:08:09 | * | Geezus42 quit (Quit: WeeChat 2.3) |
03:16:23 | * | banc joined #nim |
03:42:28 | * | lritter quit (Ping timeout: 250 seconds) |
03:43:01 | * | lritter joined #nim |
03:58:23 | FromGitter | <gogolxdong> How to pass a `ptr cstring` parameter? |
03:58:26 | * | a_chou joined #nim |
03:59:43 | leorize | `addr cstring`? |
04:00:45 | FromGitter | <gogolxdong> also need to load something, tried var errorMsg = castptr cstring (alloc0(256)) |
04:00:51 | FromGitter | <gogolxdong> `var errorMsg = castptr cstring (alloc0(256))` |
04:02:00 | leorize | what are you trying to do? |
04:02:20 | FromGitter | <gogolxdong> var errorMsg = castptr cstring (alloc0(256)) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c414fcb20b78635b63fb7e1] |
04:03:25 | leorize | I'm pretty sure it's just cstring and not ptr cstring :/ |
04:03:36 | FromGitter | <gogolxdong> SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
04:03:59 | FromGitter | <gogolxdong> proc session_last_error*(s: Session, errormsg: ptr cstring, errmsgLen, wantBuf: int): cint {.ssh2.} |
04:04:09 | FromGitter | <gogolxdong> what do you mean |
04:05:02 | leorize | it's rare for proc to require `ptr cstring` unless they want an array or that they want to create the buffer themselves |
04:05:33 | leorize | I was correct |
04:05:40 | leorize | errmsgLen is a `ptr int` |
04:05:45 | leorize | https://www.libssh2.org/libssh2_session_last_error.html |
04:06:25 | leorize | libssh2 will allocate them for you I believe |
04:06:51 | * | skellock joined #nim |
04:08:29 | leorize | so `var err: cstring; var len: cint; session.session_last_error(addr err, addr len, 0)` |
04:08:40 | leorize | that should do |
04:12:15 | * | nsf joined #nim |
04:20:03 | * | skellock quit (Ping timeout: 245 seconds) |
04:23:02 | FromGitter | <gogolxdong> yeah, you are right. I'm trying to record the last error of channel , but I cannot get channelReadStderr to work. |
04:31:58 | * | skellock joined #nim |
04:35:58 | * | kapil____ joined #nim |
04:40:18 | leorize | my own neovim plugin testdrive :) https://asciinema.org/a/Oucw2yswd2BMeUdw3q6GvAVvj |
04:40:26 | leorize | mostly async, really fast |
04:40:47 | leorize | not fast enough though :P |
04:46:01 | leorize | I'll have to figure out a way to not redraw the entire buffer |
04:47:41 | FromGitter | <gogolxdong> I think the reason I got it work without output is out of ping -c 3, it doesn't cause error, but echo usage of ping which cannot be read from channel. |
04:50:04 | FromGitter | <gogolxdong> can I read the remote ssh stdout? |
04:58:08 | * | oculuxe is now known as oculux |
04:58:42 | * | leorize quit (Quit: bye!) |
05:02:32 | * | skellock quit (Quit: WeeChat 2.3) |
05:09:11 | * | a_chou quit (Remote host closed the connection) |
05:09:30 | * | a_chou joined #nim |
05:11:00 | * | a_chou quit (Client Quit) |
05:19:16 | * | fanta7531 joined #nim |
05:39:59 | * | jonafato quit (Quit: ZNC - http://znc.in) |
05:59:31 | * | darithorn quit (Quit: Leaving) |
06:06:26 | * | bfk888 joined #nim |
06:08:25 | * | leorize joined #nim |
06:12:05 | * | bfk888 quit (Ping timeout: 256 seconds) |
06:17:28 | * | narimiran joined #nim |
06:20:49 | FromDiscord_ | <Haͥcͣkͫerͣ> anyone had anyluck getting dashing on 0.19.2 |
06:22:32 | * | memeboi joined #nim |
06:22:52 | memeboi | hi all |
06:23:06 | FromDiscord_ | <Haͥcͣkͫerͣ> hi |
07:13:12 | * | BigEpsilon joined #nim |
07:13:22 | * | krux02 joined #nim |
07:20:50 | * | absolutejam joined #nim |
07:29:33 | FromDiscord_ | <Avatarfighter> Is there an equivalent of getattr from python in nim? What I'm trying to do is get a type's field with a string version of the fields name but i'm having trouble actually using the string to get anything from the type. |
07:31:02 | FromGitter | <gogolxdong> nimterop build failed ⏎ Error: Build failed for package: nimterop ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4180b695e17b45256d40aa] |
07:35:21 | FromGitter | <alehander42> Avatarfighter: are you trying to do this in a macro? |
07:35:46 | FromGitter | <alehander42> or do you mean the field of an object in normal code |
07:40:57 | * | absolutejam quit (Ping timeout: 244 seconds) |
07:43:01 | FromDiscord_ | <Avatarfighter> Im trying to do this in a macro, but im unsure of how to approach this |
07:44:35 | leorize | treeRepr is your friend when writing macro |
07:44:49 | FromDiscord_ | <Avatarfighter> Yeah its been a life saver atm |
07:45:15 | leorize | can you determine what you'd want from the tree using it? |
07:45:17 | FromDiscord_ | <Avatarfighter> What i'm doing is im trying to call functions based on the declared type of fields in another type |
07:46:11 | leorize | can we get an example of how you'd want it to be? |
07:46:16 | leorize | a code snippet perhaps? |
07:46:17 | FromDiscord_ | <Avatarfighter> an example is this type |
07:46:17 | FromDiscord_ | <Avatarfighter> ```nim |
07:46:17 | FromDiscord_ | <Avatarfighter> type |
07:46:17 | FromDiscord_ | <Avatarfighter> Person = object |
07:46:17 | FromDiscord_ | <Avatarfighter> Age: int |
07:46:17 | FromDiscord_ | <Avatarfighter> Name: string``` |
07:46:18 | FromDiscord_ | <Avatarfighter> |
07:46:20 | FromDiscord_ | <Avatarfighter> I'm trying to get the `int` or `string` part and call a function from that |
07:46:32 | leorize | (please don't paste) |
07:47:06 | leorize | next time please put it in a pastebin :P |
07:47:07 | FromDiscord_ | <Avatarfighter> I'll make a hastebin of what i've got atm |
07:47:10 | FromDiscord_ | <Avatarfighter> oh |
07:47:12 | FromDiscord_ | <Avatarfighter> Sorry |
07:47:37 | FromDiscord_ | <Avatarfighter> oh i see what it did |
07:48:16 | leorize | I still can't understand how this works, can you give an example with some placeholder procs? |
07:48:29 | FromDiscord_ | <Avatarfighter> sure |
07:48:30 | FromDiscord_ | <Avatarfighter> https://hastebin.com/cavodopubo.php |
07:48:39 | FromDiscord_ | <Avatarfighter> Here is my test macro(?) |
07:48:46 | FromGitter | <alehander42> typically you can iterate on the type NimNode that e.g. getType |
07:48:50 | FromGitter | <alehander42> returns |
07:49:25 | FromGitter | <alehander42> ah you're doing this |
07:49:30 | FromDiscord_ | <Avatarfighter> Yeahhh |
07:49:43 | FromGitter | <alehander42> but can you give example usage please |
07:50:01 | FromDiscord_ | <Avatarfighter> Sure, let me link the lib that has "Packet" |
07:50:16 | FromDiscord_ | <Avatarfighter> https://github.com/Riderfighter/binio/blob/master/src/binio.nim |
07:50:45 | FromDiscord_ | <Avatarfighter> the idea is that the packet holds data in a packed format and that macro would hopefully unpack the data into a type |
07:51:33 | FromDiscord_ | <Avatarfighter> allow me to make a paste of example usage |
07:51:41 | FromGitter | <alehander42> ok |
07:52:51 | * | jonafato joined #nim |
07:53:08 | leorize | compiler crashing snippet: `nim check compiler/semstmts.nim` <- assuming that you're in the Nim source folder |
07:53:34 | FromDiscord_ | <Avatarfighter> https://hastebin.com/uwucabizew.php |
07:55:15 | leorize | on an unrelated note, have you seen https://xomachine.gitlab.io/NESM/ ? |
07:55:41 | FromDiscord_ | <Avatarfighter> I definitely have not |
07:57:17 | FromDiscord_ | <Avatarfighter> Seems interesting, im trying to find an example of its usage xd |
07:57:20 | FromGitter | <alehander42> Avatarfighter |
07:57:32 | FromGitter | <alehander42> you can also just skip this macro |
07:57:35 | FromGitter | <alehander42> by using generics |
07:57:40 | FromGitter | <alehander42> for example |
07:58:02 | FromGitter | <alehander42> instead of all `read<Type>` |
07:58:36 | FromDiscord_ | <Avatarfighter> What are generics? I'm pretty new with this language, I only started around 5ish days ago? |
07:58:40 | FromDiscord_ | <Avatarfighter> What are generics? I'm pretty new with this language, I only started around 5ish days ago |
07:58:42 | FromDiscord_ | <Avatarfighter> What are generics? I'm pretty new with this language, I only started around 5ish days ago. |
07:58:48 | FromGitter | <alehander42> you can name them all `fromPacket` and make them take `p: Packet, value: var T` |
07:58:59 | FromGitter | <alehander42> and instead of return |
07:59:03 | FromGitter | <alehander42> make `value = ..` |
07:59:19 | FromGitter | <alehander42> this way your fromPacket will work with all supported types directly by function definition |
07:59:26 | FromGitter | <alehander42> well, what other languages have you used |
07:59:45 | FromDiscord_ | <Avatarfighter> Python, Go and Java mostly |
07:59:59 | FromDiscord_ | <Avatarfighter> Is a generic an overloaded function? |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:00:19 | FromDiscord_ | <Avatarfighter> Is a generic an overloaded method? |
08:00:26 | FromGitter | <alehander42> so in this case you're right, you actually dont need necesarrily generics |
08:00:30 | FromGitter | <alehander42> just overloaded proc-s |
08:00:38 | FromGitter | <alehander42> yeah |
08:01:56 | FromGitter | <alehander42> in general generics are just something like type "variables" : e.g. proc reprT (value: T): string makes something with value for every possible T type |
08:02:12 | FromGitter | <alehander42> in your case i meant you can do e.g. |
08:02:39 | FromDiscord_ | <Avatarfighter> oh wow |
08:02:59 | FromDiscord_ | <Avatarfighter> I didn't realized that the "T" was a generic parameter |
08:03:33 | FromDiscord_ | <Avatarfighter> Or rather that it becomes a generic parameter in a generic |
08:03:48 | FromGitter | <alehander42> proc fromPacket*(p: Packet, i: var uint64) = ⏎ i = ⏎ proc fromPacket*(p: Packet, i: var int64) = ⏎ i = ⏎ etc [https://gitter.im/nim-lang/Nim?at=5c418863dab15872ceb1fa0e] |
08:04:14 | FromGitter | <alehander42> not specially `T`, just the thing that you put in [] |
08:04:18 | FromDiscord_ | <Avatarfighter> ok |
08:04:22 | FromDiscord_ | <Avatarfighter> That's cool |
08:04:45 | * | gmpreussner joined #nim |
08:05:09 | FromGitter | <alehander42> but again, you're right, here you can just change your functions to be overloads of the same |
08:05:25 | FromGitter | <alehander42> writeX => pack and read => fromPacket functions |
08:05:57 | FromGitter | <alehander42> i think that's what a lot of nim serialization dsls do, e.g. in json you overload `%` etc |
08:06:31 | FromDiscord_ | <Avatarfighter> I'm unsure how I would approach what i'm doing |
08:07:21 | FromDiscord_ | <Avatarfighter> im trying to iterate over the fields in a type, then get the types of the fields which I'll then call functions to dynamically unpack the packed data |
08:07:21 | FromGitter | <alehander42> you just need to refactor your functions (and dont use a macro) |
08:07:31 | FromGitter | <alehander42> no, no, that's what i meant |
08:07:36 | FromGitter | <alehander42> aaah |
08:07:36 | FromDiscord_ | <Avatarfighter> ohhh |
08:07:40 | FromGitter | <alehander42> so you mean that you want |
08:07:45 | FromGitter | <alehander42> to lift the fromPacket |
08:07:50 | FromGitter | <alehander42> for objects automatically? |
08:08:14 | FromDiscord_ | <Avatarfighter> I'm not sure if "serialize" is the right word but yeah i'm doing what you said |
08:09:24 | FromDiscord_ | <Avatarfighter> yeah, i'm trying to lift fromPacket for objects automatically |
08:10:42 | FromGitter | <alehander42> aah i see, so yeah you still need to get `var Packet` in fromPacket too, sorry |
08:10:59 | FromDiscord_ | <Avatarfighter> no worries, I should've explained myself better 😛 |
08:11:16 | FromDiscord_ | <Avatarfighter> The reason why I was using macros is because to my knowledge it seems like the only way to iterate over the fields in a type |
08:12:14 | FromGitter | <alehander42> yeah |
08:12:20 | FromGitter | <alehander42> but i think you can still skip them |
08:15:20 | * | jonafato quit (Quit: ZNC - http://znc.in) |
08:15:27 | FromDiscord_ | <Avatarfighter> ooo I think I got how I can iterate over fields without macros |
08:15:46 | FromDiscord_ | <Avatarfighter> typeinfo comes with a handy iterator called "fields" |
08:15:56 | FromGitter | <alehander42> ok |
08:16:12 | FromGitter | <alehander42> yes, exactly |
08:16:16 | FromGitter | <alehander42> this or fieldPairs |
08:16:55 | FromDiscord_ | <Avatarfighter> what library is fieldPairs in? |
08:17:20 | FromDiscord_ | <Avatarfighter> its in system lul |
08:20:05 | FromGitter | <alehander42> yeah, the problem is i cant seem to mutate the field like that |
08:20:11 | FromGitter | <alehander42> but probably i am missing something |
08:20:34 | * | absolutejam joined #nim |
08:21:26 | FromDiscord_ | <Avatarfighter> What I can probably do is use a for loop and a case to unpack the data as it loops through the fields |
08:21:33 | FromDiscord_ | <Avatarfighter> I think that is all I need actually 😄 |
08:22:01 | FromGitter | <alehander42> my idea was |
08:22:06 | FromGitter | <alehander42> that you can directly do simpler |
08:22:37 | FromDiscord_ | <Avatarfighter> oo |
08:22:41 | FromDiscord_ | <Avatarfighter> I'm all ears 😛 |
08:27:27 | FromGitter | <alehander42> https://hastebin.com/gukujomabi.cs |
08:27:39 | FromGitter | <alehander42> 1) the other overloads for basic types |
08:27:53 | FromGitter | <alehander42> serialize should be fromPacket * |
08:28:59 | FromDiscord_ | <Avatarfighter> Wait so I replace the serialize part with a proc name "fromPacket*"? |
08:29:22 | FromGitter | <alehander42> yeah i mean all the calls shoyuld've been |
08:29:23 | FromGitter | <alehander42> fromPacket |
08:29:27 | FromGitter | <alehander42> just a typo |
08:29:49 | FromGitter | <alehander42> https://hastebin.com/laxizaseha.cs |
08:30:22 | FromGitter | <alehander42> and it shoud be a template and it works |
08:30:26 | FromGitter | <alehander42> just a final second |
08:30:33 | FromGitter | <alehander42> https://hastebin.com/anevezekiy.cs |
08:31:13 | * | jonafato joined #nim |
08:31:24 | FromGitter | <alehander42> #replace e = p etc with your read<X> code for int and refactor the other read<X> to be fromPacket |
08:31:34 | FromDiscord_ | <Avatarfighter> ohhh |
08:31:38 | FromDiscord_ | <Avatarfighter> ok |
08:31:46 | FromDiscord_ | <Avatarfighter> This is actually really cool |
08:32:07 | FromGitter | <alehander42> yeah, i always forget about fields/fieldPairs |
08:32:12 | FromGitter | <alehander42> you can also just use fields |
08:32:22 | FromDiscord_ | <Avatarfighter> may I ask why you specify `var object | tuple` in the template of fromPacket? |
08:32:29 | FromGitter | <alehander42> but make sure you dont import it from typeinfo, but use the builtin one |
08:32:33 | FromGitter | <alehander42> because fieldPairs works for tuples too |
08:32:38 | FromGitter | <alehander42> so you can just support them too |
08:32:43 | FromGitter | <alehander42> if you dont need them, you can skip that |
08:32:48 | FromDiscord_ | <Avatarfighter> oh ok |
08:33:40 | FromDiscord_ | <Avatarfighter> Thank you for your help, it has truly been a learning experience for me haha |
08:34:09 | FromGitter | <alehander42> yeah, for me too haha, i was unaware of some fieldPairs stuff |
08:34:26 | FromDiscord_ | <Avatarfighter> I have another question tho |
08:34:28 | FromDiscord_ | <Avatarfighter> I have another question though |
08:34:42 | FromGitter | <alehander42> ! |
08:34:51 | FromGitter | <gogolxdong> any idea nimble install nimterop failed? |
08:34:57 | FromDiscord_ | <Avatarfighter> If lets say one of the fields is another type how would I support that? |
08:35:03 | leorize | shashlick: ^ |
08:35:21 | FromGitter | <alehander42> Avatarfighter: this version just works for that case |
08:35:33 | FromGitter | <alehander42> its a template |
08:35:51 | * | NimBot joined #nim |
08:36:09 | FromDiscord_ | <Avatarfighter> oh |
08:36:38 | FromDiscord_ | <Avatarfighter> So a field of "PlayerLocation: PlayerPosition" would be understood as a grouping of value : key on the AST? |
08:36:55 | FromDiscord_ | <Avatarfighter> not the AST, I meant the template |
08:37:20 | FromGitter | <alehander42> in this case this is fieldPairs/fields-specific |
08:37:31 | FromGitter | <alehander42> you can read the fieldPairs doc |
08:37:34 | FromGitter | <alehander42> it explains it better |
08:38:17 | * | rokups joined #nim |
08:38:28 | FromDiscord_ | <Avatarfighter> Ok I will, thank you so much for your help, I feel like i've got a better grasp on this 😄 |
08:38:46 | FromGitter | <alehander42> the field<X> stuff just unrolls the loop and generates the body for each field |
08:38:55 | FromGitter | <alehander42> so in this case it doesnt matter that types are different |
08:39:01 | FromGitter | <alehander42> because you use overloading after that |
08:39:04 | FromGitter | <alehander42> which can handle it |
08:39:17 | FromGitter | <alehander42> np |
08:39:31 | FromGitter | <alehander42> i should also take a look at how is implemented |
08:44:50 | FromDiscord_ | <Avatarfighter> Wow that's nuts how it works |
08:44:57 | FromDiscord_ | <Avatarfighter> You're actually godsent btw |
08:48:49 | FromGitter | <alehander42> ah no |
08:48:54 | FromGitter | <alehander42> what are you buildint tho |
08:49:29 | * | LargeEpsilon joined #nim |
08:53:24 | * | Vladar joined #nim |
08:55:36 | FromDiscord_ | <Avatarfighter> So you know that library that I linked |
08:55:38 | FromDiscord_ | <Avatarfighter> binio? |
08:56:52 | FromDiscord_ | <Avatarfighter> I'm working on improving that atm and I found it painful to pack and unpack the packets with how it was implemented and I thought to myself wouldn't it be cool if there was a handy proc/macro/etc that could pack and unpack based on a type's field type |
08:57:07 | * | absolutejam quit (Quit: WeeChat 1.9.1) |
09:02:15 | FromGitter | <alehander42> nice |
09:02:21 | FromGitter | <alehander42> are you building a game otherwise |
09:03:15 | * | floppydh joined #nim |
09:03:39 | FromDiscord_ | <Avatarfighter> Not exactly |
09:03:55 | FromDiscord_ | <Avatarfighter> So the protocol of binio is AMF3 |
09:04:39 | FromDiscord_ | <Avatarfighter> and I reversed the protocol of the flash game "Realm of the Mad God" so what i'm going to do is build a bot with nim 😛 |
09:06:03 | FromDiscord_ | <Avatarfighter> Hopefully this will allow me to structure packets much more rapidly than my python implementation of binio haha |
09:06:18 | FromGitter | <alehander42> yeah, it should be faster |
09:06:18 | FromGitter | <alehander42> :D |
09:07:00 | FromDiscord_ | <Avatarfighter> Im so excited oml |
09:08:08 | * | absolutejam joined #nim |
09:10:06 | FromDiscord_ | <Avatarfighter> Thanks again alehander42! Goodnight/good morning everyone |
09:14:09 | FromGitter | <alehander42> good morning :D |
09:21:36 | memeboi | anyone here mess with dashing https://github.com/FedericoCeratto/nim-dashing ? ive tried a few of the forks with no success |
09:24:11 | narimiran | ping federico3 ^ |
09:26:11 | memeboi | fredrik92: ping |
09:42:08 | * | TongirMan quit (Ping timeout: 250 seconds) |
09:43:09 | Araq | hi memeboi |
09:45:55 | * | TongirMan joined #nim |
09:51:38 | leorize | Araq: the compiler crashes if you run `nim check compiler/semstmt.nim` |
09:54:06 | * | hwallann quit (Quit: Leaving) |
09:57:58 | Araq | fix it |
10:03:08 | absolutejam | Can a type field hold a type? |
10:03:20 | absolutejam | as in the actual typedesc |
10:08:33 | * | cspar joined #nim |
10:10:31 | FromGitter | <alehander42> i doubt you would need that: as it can hold a value of this type/or hold it as a generic arg and usually one can base his logic on that |
10:10:39 | FromGitter | <alehander42> what is your usecase |
10:13:14 | absolutejam | a shell experience wherein you descend into a category, eg. users, items then interact with objects |
10:13:29 | absolutejam | so 'mycmd users get name="james"' |
10:13:39 | fredrik92 | memeboi, yes? sorry just came into the office... :O |
10:13:51 | absolutejam | and I'm using a generic proc (if that's the right term), to filter the different object types |
10:14:24 | FromGitter | <alehander42> absolutejam so why do you need the type on runtime |
10:14:29 | absolutejam | because a user is a User, item is a Item, etc. Using proc[objectType](...): seq[objectType] I've been able to filter them |
10:14:45 | absolutejam | to pass to the generic proc...I think |
10:14:59 | FromGitter | <alehander42> oh, are they inherited |
10:15:08 | absolutejam | basically, each ccategory of the shell will have an associated type that will be returned, filtered and interacted with |
10:15:20 | absolutejam | yeah, they all inherit from LairObj |
10:15:30 | FromGitter | <alehander42> well, you can always use `of`, right |
10:15:59 | absolutejam | what do you mean sorry? |
10:16:07 | FromGitter | <alehander42> to check the exact type |
10:16:45 | * | fredrik92 is now known as couven92 |
10:19:42 | absolutejam | I have a global object that contains a seq of all objects of differing times, eg. myGlobalThing.items (seq[Item]), myGlobalThing.users (seq[User]) |
10:20:15 | absolutejam | but I _think_ I need a way of getting the type of one of those objects to pass to myGenericProc[T], don't I? |
10:20:35 | absolutejam | if I want to pass a User or an Item to myGenericProc[T] I have to insert the type into [T] when calling it? |
10:21:06 | absolutejam | or are you saying to juse use a case and of User: myGenericProc[User] etc. ?/ |
10:21:40 | absolutejam | I have a bag of coffee on my desk and I keep thinking it's a bag of cookies :[ |
10:22:08 | * | zachcarter quit (Ping timeout: 245 seconds) |
10:23:18 | FromGitter | <alehander42> you can use `of` (but i am not sure if it works with case : i know you can do `if element of T`) |
10:23:38 | FromGitter | <alehander42> bu tis this generic function |
10:23:44 | FromGitter | <alehander42> that function that filters them? |
10:24:11 | FromGitter | <alehander42> i am not sure why wouldn't it be called explicitly in this case (e.g. you want the users, so you call myUser (..) anyway) |
10:24:13 | absolutejam | yeah, it filters them based on key=val that the user supplies and iterates the fieldPairs |
10:24:29 | FromGitter | <alehander42> ah, so it's a dynamic value |
10:25:38 | absolutejam | it's to be used like an interactive shell, so it could be 'myapp items get name=*fork* size=large' |
10:25:43 | FromGitter | <alehander42> yeah, not sure, an if list with `of` checks should work |
10:25:46 | FromGitter | <alehander42> i think |
10:26:20 | FromGitter | <alehander42> overally i usually use case objects for this kind of thing and there it's normal to do similar thing (branching based on the `kind`) |
10:27:01 | absolutejam | the different categories (eg. user, item) are all stored in a seq of 'Node' type, so I was hoping I could just add in an objectType field |
10:27:04 | absolutejam | then it could be more dynamic |
10:27:32 | FromGitter | <alehander42> but why |
10:27:42 | FromGitter | <alehander42> you can already check the types |
10:27:50 | FromGitter | <alehander42> if they inherit from the same base |
10:28:42 | FromGitter | <alehander42> you want to `obj.objectType == <Class>`, but you can `obj of <Class>` |
10:35:40 | FromGitter | <alehander42> hm, people seem to adore the new `dbg!` in rust |
10:35:49 | FromGitter | <alehander42> it's nothing more than our `dump` |
10:35:58 | FromGitter | <alehander42> but it adds the path:line which is cool |
10:36:35 | FromGitter | <alehander42> (very often it's annoying to look where did a debug output actually came from) |
10:37:14 | FromGitter | <alehander42> and it also returns its arg, which makes sense |
10:38:57 | FromGitter | <alehander42> would it make sense to add a richer version (e.g. `dumpv` for verbose, or `dbg` or similar) to sugar |
10:43:42 | FromGitter | <timotheecour> I’ve been wanting to add `echoLoc` which would be like: `echo args = echo file:line:col args` (i’m using it a lot in my own projects, a bit more featureful version though); @araq can I add it to stdlib? it’s a common use case |
10:44:14 | FromGitter | <timotheecour> (somewhat related to what @alehander42 said) |
10:44:39 | FromGitter | <timotheecour> avoids having to track down where ur echo came from |
10:45:03 | FromGitter | <mratsim> this should be called `batSense`instead of `echoLoc`;) |
10:45:14 | FromGitter | <timotheecour> Haha :) |
10:45:26 | FromGitter | <timotheecour> french humor ;-) |
10:45:52 | FromGitter | <timotheecour> maybe `db` ? |
10:45:53 | FromGitter | <alehander42> @timotheecour returning your arg is very useful too: because you can do stuff like ⏎ if a.e: # => ⏎ if a.e.dbg: # debug echo & keep working |
10:45:58 | FromGitter | <timotheecour> `dbg` |
10:47:14 | FromGitter | <timotheecour> that’s `tap` and it’s a very useful but orthogonal feature |
10:47:18 | FromGitter | <alehander42> this is especially useful if you call a proc which can have side effects |
10:47:26 | FromGitter | <alehander42> you cant really do this with dump |
10:47:36 | FromGitter | <timotheecour> it’s completely orthogonal (yet useful) |
10:47:57 | FromGitter | <alehander42> it is, but it makes sense to be included in the most common helper |
10:48:38 | FromGitter | <timotheecour> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c41af06dab15872ceb2e5a0] |
10:49:21 | FromGitter | <timotheecour> (also using it a lot) |
10:49:42 | FromGitter | <alehander42> you can have dbg = tap(echo) & dbgLoc = tap(echoLoc) |
10:49:53 | FromGitter | <alehander42> but thats not so important i guess |
10:50:20 | FromGitter | <timotheecour> well we need a `std/debug` module w all those goodies |
10:51:00 | FromGitter | <timotheecour> if it’s not gonna be rejected in the egg, happy to start PR that adds `dbg/echoLoc` and we can add more later |
10:51:02 | FromGitter | <alehander42> i'd hesitate in calling it `debug` |
10:51:11 | FromGitter | <timotheecour> `debugutils` |
10:52:14 | FromGitter | <alehander42> it can be interpreted as some kind of thing related to the actual debugger support |
10:52:53 | FromGitter | <alehander42> why not keeping it in sugar for now? is `std/<x>` imported with system |
10:52:56 | FromGitter | <timotheecour> Meh; then suggest another name; but it clears out once u just see it once |
10:53:10 | FromGitter | <couven92> I have used the new Azure DevOps Build pipelines a lot recently for a couple of projects. It's free and integrates really well into GitHub and IMHO it's better structured than AppVeyor of Travis CI... @Araq is that something we could think about using for Nim? |
10:54:18 | FromGitter | <couven92> It would give us the possibility to run all platforms and archs in one service, instead of juggling to separate build-definitions for appveyor and travis |
10:54:52 | FromGitter | <timotheecour> @couven92 the good news is now travis/appveyor have most of its logic moved to nim so it’d be a PR away from you, and would be very welcome if it can speedup CI |
10:55:36 | FromGitter | <timotheecour> can u setup the equivalent of existing travis and see how long it takes to run? |
10:56:19 | FromGitter | <timotheecour> waiting for CI to build is a constant pain so any improvement here is welcome |
10:57:42 | FromGitter | <couven92> yeah... I could do that... What do you guys think about adding NUnit or JUnit style output for testament? Azure DevOps makes REALLY nice graphs if you throw Test Runner files at it that it understands... |
10:58:27 | FromGitter | <timotheecour> do u have a screenshot/link |
10:58:36 | * | abm joined #nim |
10:58:49 | FromGitter | <alehander42> eh it does have junit support |
10:58:54 | FromGitter | <alehander42> ah wait |
10:58:57 | FromGitter | <alehander42> this is unittest |
10:59:01 | FromGitter | <alehander42> testament doesnt use it |
10:59:31 | FromGitter | <timotheecour> ya doing that for testament would be a lot of work, probably not worth it, or at least low priority compared to other aspect: faster CU |
10:59:34 | FromGitter | <timotheecour> *CI |
11:00:23 | FromGitter | <timotheecour> case in point: this PR runs out of memory on travis: https://github.com/nim-lang/Nim/pull/10355 |
11:01:29 | FromGitter | <couven92> @timotheecour https://dev.azure.com/thnetii/dotnet-common/_build/results?buildId=448&view=ms.vss-test-web.test-result-details (it's a C# project, but if you produce XUnit, JUnit or NUnit test result files that does not matter for Azure |
11:02:24 | FromGitter | <couven92> My graph is a little boring, because all the tests pass here... :P |
11:05:13 | FromGitter | <timotheecour> actually all (almost… cf megatest) tests in testament pass through some common proc (eg the one that shows PASS/FAIL/JOINED) so that proc could do the needed transformation on the fly to a junit format etc; one more tricky point is it’s run in multiple processes so a server would likely be needed to collect answers from each process; nothing that can’t be done; but highest priority is : can azure help us run |
11:05:13 | FromGitter | ... CI faster? (more parallel builds or more memory or longer timeout etc) |
11:05:55 | FromGitter | <couven92> @timotheecour yeah, I have worked with testament before, I designed its HTML output a few years ago |
11:06:23 | FromGitter | <timotheecour> ah i see cool; btw how did u collect outputs from different processes |
11:07:52 | FromGitter | <couven92> in testament? uhm... IIRC I capture ALL output from the invoked Nim process... |
11:07:56 | enow | what's the state of the art online / web chat these thays |
11:08:07 | FromGitter | <couven92> but it's been a while... I'm not really sure anymore |
11:08:47 | FromGitter | <timotheecour> what would be very useful too is generating test output in a db, from that, we can do arbitrary stuff eg: ⏎ ⏎ 1) find when did a test (with allowed failure) start failing for 1st time? ⏎ 2) sort tests by time it takes to run [https://gitter.im/nim-lang/Nim?at=5c41b3bf95e17b45256e87b4] |
11:08:49 | enow | is it matrix or what? |
11:09:01 | FromGitter | <couven92> @timotheecour yeah we do that |
11:09:37 | FromGitter | <couven92> originally we wrote a JSON file, but I think I moved it in memory for some complex reason... |
11:09:56 | FromGitter | <timotheecour> @couven92 that’d be actually most useful for https://github.com/nim-lang/Nim/pull/10247 (nimble wide CI) where tests ARE expected to fail a lot more, and these questions matter more there |
11:11:11 | FromGitter | <timotheecour> do u have a hello world equivalent of .travis.yml so i can play w it? |
11:11:28 | FromGitter | <timotheecour> (for azure), which integrates w github |
11:11:54 | FromGitter | <couven92> @timotheecour this looks like we actually DO write a JSON file: https://github.com/nim-lang/Nim/blob/devel/testament/htmlgen.nim#L72 |
11:14:08 | FromGitter | <couven92> @timotheecour what do you mean a hello world of .travis.yml? You mean how an `azure-pipelines.yml` would look like? |
11:14:24 | * | banc quit (Quit: Bye) |
11:15:45 | FromGitter | <timotheecour> > this looks like we actually DO write a JSON file ⏎ ⏎ ok so i guess it works through files instead of requiring a server; that works |
11:16:19 | FromGitter | <couven92> @timotheecour yes, and the HTML gen actually just transforms the JSON into nice-ish HTML |
11:17:38 | FromGitter | <couven92> I have a somewhat realitic, but still fairly simple `azure-pipelines.yml` that I did yesterday for a pet project here at the University... It's a CI for building a Vue.js web application. https://github.com/Pwntus/dust-webapp/pull/14 |
11:19:26 | FromGitter | <timotheecour> Cool; thx; now, trying to find one that’d work for osx/mac |
11:19:42 | FromGitter | <timotheecour> (urs is windows it seems) |
11:19:50 | FromGitter | <couven92> @timotheecour Azure DevOps works out of the box for MacOSX as well |
11:20:45 | FromGitter | <couven92> see here: https://dev.azure.com/thnetii/dotnet-common/_build/results?buildId=446 |
11:20:48 | * | banc joined #nim |
11:24:07 | FromGitter | <couven92> @Araq is it possible to write a plugin for Nim to hook compiler error or warning messages to allow for custom formatting of the message? |
11:24:22 | FromGitter | <timotheecour> ya Im just trying to find a simple posix (linux or mac) template to build from, so we could port existing travis.yml and experiment w it |
11:25:45 | * | synthmeat left #nim ("WeeChat 2.3") |
11:25:47 | FromGitter | <couven92> Well since we use koch and nim which are platform agnostic, the pipeline would look pretty much the same with just different parameters. ⏎ That's what I do for my C# builds. I just run the same pipeline three times (one each for Windows, Ubuntu and macOS) |
11:26:13 | FromGitter | <timotheecour> @couven92 regarding plugins i think that’s very possible, see how’s it done in nimfind: `graph.onDefinition = writeUsage` which is a user-settable callback |
11:27:34 | * | platoff joined #nim |
11:27:34 | FromGitter | <couven92> it's basically: ⏎ clone csources, run build script, run `nim c koch`, run `koch boot` |
11:28:21 | FromGitter | <timotheecour> btw nimsuggest does exactly that IIRC: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c41b85535350772cf4e5148] |
11:28:44 | FromGitter | <couven92> cool, makes life much easier :) |
11:31:46 | * | cspar quit (Ping timeout: 250 seconds) |
11:34:59 | * | cspar joined #nim |
11:46:40 | FromGitter | <timotheecour> Yay! hello world seems to work :) |
11:46:47 | FromGitter | <timotheecour> https://github.com/timotheecour/Nim/pull/3 |
11:47:46 | FromGitter | <couven92> OH! That was what you meant with hello world???? :O It doesn't do anything with Nim though... |
11:48:12 | FromGitter | <timotheecour> Yaya but u gotta start small :) |
11:48:25 | FromGitter | <couven92> fair enough |
11:55:08 | FromGitter | <timotheecour> well it does now :) it’s running `./koch runCI` |
11:57:08 | * | lritter quit (Ping timeout: 245 seconds) |
11:58:34 | FromGitter | <couven92> BTW, for Azure DevOps. The task for scripts that is guaranteed to work on any of the Azure DevOps build agents is actually PowerShell! :D |
11:58:54 | FromGitter | <couven92> PowerShell core FTW! :) |
11:59:29 | FromGitter | <timotheecour> but that doesn’t help for bash scripts does it |
11:59:41 | FromGitter | <couven92> no, it doesn't -.- |
12:00:13 | FromGitter | <timotheecour> well the aim is to have almost everything in nim so shdn’t matter too much hopefully |
12:00:19 | FromGitter | <couven92> heck... if I find the time, I could emit powershell build scripts next to the bat and sh file :D |
12:00:50 | FromGitter | <timotheecour> i’m in good shape to port travis.yml to azure, do u wanna take a shot at converting appveyor to azure? |
12:01:41 | FromGitter | <timotheecour> (since i get a headache everytime i touch anything resembling a windows batch file) |
12:02:53 | FromGitter | <couven92> I still think that it would be the same steps regardless... But I'll look into it, maybe over the weekend... But I'll look into generating a common testresult file out of testament and getting nim to emit ##vso[task.logissue] messages during build |
12:07:06 | FromGitter | <timotheecour> would that be available in near real time or require testament to collect test results after all tests complete |
12:08:46 | Zevv | timotheecour: how should nimterop cope with opaque struct types? For example I have "typedef struct _modbus modbus_t;". The type itself is never used, only ``modbus_t *``, but the generated "type modbus_t* = modbus" of course fails. |
12:08:48 | FromGitter | <couven92> well in general the way it works (in any CI) is that you upload a parsable test result file to the CI orchestrator and it displays the test results in a nice way |
12:09:29 | FromGitter | <couven92> that means test results will only ever be availble when a test run has completed |
12:12:06 | FromGitter | <timotheecour> @Zevv could this work: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c41c29595e17b45256ee3a2] |
12:14:44 | FromGitter | <timotheecour> @couven92 but in the specific case of testament: will we have near real time feedback as soon as an individual test completes (eg: `tests/macros/tcollect.nim`) or will we have to wait till all tests completes for results to be displayed |
12:15:32 | FromGitter | <couven92> yeah, we'll still log it as usual, but a summary of the build (which the test results are part of) can only be made when the build is done |
12:15:44 | Zevv | timotheecour: I can just declare an empty object instead, with or without {.incompleteStruct.}, so I guess nimterop could do that instead |
12:15:57 | FromGitter | <timotheecour> ya |
12:16:37 | Zevv | all in all I am *very* impressed. Most headers I try just pass for 99% |
12:17:08 | FromGitter | <timotheecour> @zevv cool but r they correct? |
12:17:15 | Zevv | No idea :) |
12:17:31 | Zevv | if it compiles, ship it |
12:18:34 | FromGitter | <timotheecour> here’s smthg we could try: mylib.h => nimterop => mylib.nim => nim => foo/mylib.h and then recompile a project using the new `foo/mylib.h` ; that may be too naive though |
12:19:13 | Zevv | I've tried some things by hand, Lua api, libmodbus, and there everything I touched was ok. |
12:19:31 | FromGitter | <timotheecour> well can we kill c2nim then ? |
12:19:53 | Zevv | that's doms work, right? |
12:19:59 | federico3 | why? |
12:20:43 | FromGitter | <timotheecour> or rather, make a nimterop wrapper binary that exposes same c2nim interface so clients dont’ have to upgrade their code |
12:21:41 | FromGitter | <timotheecour> nimterop is supposed to be more robust as it delegates the job of parsing C (and C++, WIP) to another library so we don’t have to do that hard part |
12:23:11 | * | gangstacat quit (Quit: Ĝis!) |
12:23:25 | federico3 | can you generate a wrapper with nimterop? |
12:23:35 | FromGitter | <timotheecour> ya |
12:24:05 | FromGitter | <timotheecour> it just calls `parseStmt ( generateNim(…))` |
12:24:11 | Zevv | or you can just make it happen "under the hood". You include C headers in nim, draw a pentagram on the floor, light some candles and your code compiles |
12:24:41 | FromGitter | <timotheecour> Right; the point is u get both options. |
12:24:47 | FromGitter | <timotheecour> at CT |
12:26:06 | Zevv | I should have said "wave with your fairy wand", that sounds a bit more friendly, I guess |
12:26:31 | * | nsf quit (Quit: WeeChat 2.3) |
12:30:46 | Zevv | but c2nim is more than this - it's also able to translate a fair amount of C code to Nim, not only headers and definitions |
12:31:00 | Zevv | is that a future goal of nimterop as well? |
12:34:49 | FromGitter | <timotheecour> treesitter outputs AST of not just header, but also any sources; and not just C but also many other lang (eg python etc…) ; so the end goal is much broader in terns of interop it can hope to offer down the line. |
12:35:56 | FromGitter | <timotheecour> the 1st part of parsing source language is being taken care of, nimterop takes as input a language agnostic (YMMV) AST that is then converted to nim. |
12:36:21 | FromGitter | <timotheecour> so i’d say, ya that shd be a future goal for nimterop that’d be hard to match by c2nim |
12:36:23 | Zevv | so taking that and generating code would be a logical next step |
12:36:49 | FromGitter | <timotheecour> ya; and that’s required for C++ because c++ headers contain well… code |
12:36:53 | FromGitter | <timotheecour> in tempaltes |
12:36:57 | Zevv | has the same been done for other language targets yet? |
12:38:19 | FromGitter | <timotheecour> in nimterop no, the immediate goal is to nail down C first, before going to c++ and then maybe python |
12:38:48 | Zevv | I mean the other way, C to another language then Nim, using treesitter. I wasn't able to find any |
12:38:50 | FromGitter | <timotheecour> but treesitter already handles parsing lots of languages, see https://github.com/tree-sitter |
12:39:40 | FromGitter | <timotheecour> ah good question |
12:40:11 | FromGitter | <timotheecour> using clang is definitely more common |
12:40:15 | FromGitter | <timotheecour> *libclang |
12:40:18 | Zevv | googleing "Treesitter" "language" "convert" shows Nimterop as first hit (after a few music videos, of course) |
12:40:33 | Zevv | yeah but clang is such a heavy dependency |
12:41:11 | Araq | aww no love for poor c2nim |
12:41:14 | Araq | ;-) |
12:41:29 | Araq | we need an online c2nim |
12:41:49 | Araq | it would be awesome for tinkering and maybe even learning Nim for C programmers |
12:41:52 | FromGitter | <timotheecour> @zevv ya but I strongly suspect treesitter not be to as accurate as libclang though; https://github.com/Syniurge/Calypso is the original motivating example for all this; it handles c++ seamlessly wo `embed` hacks |
12:44:23 | FromGitter | <timotheecour> well we can prob expose same interface as c2nim from a nimterop wrapper |
12:45:10 | leorize | timotheecour: you can't really compile the correctness of a gcc-replacement compiler and a new library designed for syntax highlighting :p |
12:45:17 | leorize | compare* |
12:45:22 | Zevv | Araq: is there an online nim sandbox somewhere, for running snippets in the browser? |
12:46:04 | leorize | playground.nim-lang.org |
12:46:09 | leorize | dunno if still up-to-date |
12:46:15 | Zevv | dead it seems |
12:46:20 | leorize | play.nim-lang.org |
12:46:29 | Zevv | ah thanks |
12:46:43 | leorize | updated to 0.19.0 :) |
12:46:55 | leorize | now someone has to push 0.19.2 there before 0.19.4 is released :P |
12:49:01 | FromGitter | <timotheecour> @leorize I know, this is tracked here https://github.com/genotrance/nimterop/issues/28 (closed for now, but may be reopened if we hit serious limitations w nimterop when dealing w C++ interop) |
12:50:23 | FromGitter | <timotheecour> but it may be good enough for C and a other languages less complex than C++, which has benefit of providing language agnostic AST for consumption by nimterop |
12:51:00 | leorize | for lightweight usage tree-sitter is definitely better |
12:51:06 | leorize | clang is quite a beast imo |
12:51:33 | Zevv | I think I just kiled the nim playground :/ |
12:51:35 | leorize | not to mention their API breaks every release |
12:51:41 | * | dddddd joined #nim |
12:51:43 | leorize | Zevv: what did you do? |
12:51:50 | Zevv | while true: discard fork() |
12:52:05 | Zevv | Oh its back |
12:52:14 | Zevv | I was wondering, it can't run on the server side, right? |
12:52:20 | leorize | you can even try to !eval it here :P |
12:52:23 | Zevv | albeit: a readfile("/etc/passwd") does show |
12:52:33 | Zevv | !eval import posix; while true: discard fork() |
12:52:45 | leorize | !eval echo readFile "/etc/passwd" |
12:52:48 | FromGitter | <timotheecour> but we’d be able to use clang via its binary inteface instead of as a library (libclang), since we shd be able to leverage AST output (see https://github.com/genotrance/nimterop/issues/28) , so that significantly lowers barrier to get `clang` binary (instead of clang library), should the need come (and i suspect it will for serious c++ interop) |
12:53:39 | leorize | it's great the the clang binary can output the AST, that definitely lower the hassle |
12:53:53 | NimBot | Compile failed: <no output> |
12:53:53 | NimBot | Compile failed: <no output> |
12:54:24 | leorize | !eval echo "hello, world" |
12:54:24 | NimBot | Compile failed: <no output> |
12:54:39 | leorize | Zevv: I think you killed NimBot |
12:54:56 | Zevv | \o/ |
12:55:05 | FromGitter | <timotheecour> ya, and it may not be super hard (ymmv) to plug into nimterop as a replacement; it’s just a different AST format |
12:55:06 | Zevv | playground also did not recover |
12:55:33 | leorize | fork bombs are deadly :P |
12:55:46 | Zevv | sandboxing is hard |
12:56:28 | Zevv | actually I did not expect this to work, my guess was that the target was JS and it was run on the client side |
12:57:30 | FromGitter | <alehander42> probably something preventing many syscalls for the runned snippet can be an easy fix |
12:58:04 | FromGitter | <alehander42> even if its running in a container, there are other syscalls which dont need to be supported |
12:58:11 | FromGitter | <alehander42> for online snippets |
12:58:48 | Zevv | Who's maintaining the bot and playground? |
13:04:36 | * | kobi7 joined #nim |
13:06:42 | kobi7 | Hi guys, I updated today, and there seems to be a problem |
13:06:55 | leorize | dom96 is behind the bot IIRC |
13:06:59 | kobi7 | I get |
13:06:59 | kobi7 | ../../../apps/Nim/lib/pure/parseutils.nim(274, 54) Error: can raise an unlisted exception: ValueError |
13:07:42 | leorize | it's due to this: https://github.com/nim-lang/Nim/commit/1d7e3a84fd8ebaf183a231c9f8e0159f243ee25a |
13:08:18 | leorize | it now raises ValueError on overflow instead of OverflowError |
13:08:27 | * | oculux quit (Ping timeout: 268 seconds) |
13:08:37 | FromGitter | <timotheecour> @kobi7 u can fix it using smthg similar to https://github.com/nitely/nim-regex/pull/34 where i fixed a regression caused by that in nim-regex |
13:09:04 | kobi7 | yeah, it comes from the regex pkg |
13:09:34 | kobi7 | timotheecour: ../../../.nimble/pkgs/regex-0.10.0/regex.nim(2838, 45) template/generic instantiation from here |
13:09:36 | FromGitter | <timotheecour> then just ask nitely to bump tag |
13:09:39 | kobi7 | so shouldn't the error point to there? |
13:10:11 | kobi7 | thanks, I just stumbled upon it - and didn't know how to continue coding with the compiler ""broken"" like that |
13:10:38 | FromGitter | <timotheecour> just git clone nim-regex and `nimble develop` and everything will work |
13:10:46 | kobi7 | does the continuous integration (travis) checks the nimble packages as well? |
13:11:01 | leorize | or nimble install nim-regex@#head |
13:11:03 | kobi7 | I'll try nimble install regex@#head |
13:11:10 | kobi7 | right :) |
13:11:31 | leorize | you shouldn't use devel if you wanted stability :p |
13:11:50 | FromGitter | <timotheecour> > does the continuous integration (travis) checks the nimble packages as well? ⏎ ⏎ that’s pending https://github.com/nim-lang/Nim/pull/10247 |
13:12:20 | kobi7 | now I get cannot open file queues, from yaml package. I saw it was removed in favour of deques :-) |
13:12:41 | FromGitter | <timotheecour> check graveyard |
13:13:07 | kobi7 | of course compiler development shouldn't be stopped because of libraries, but maybe an obsolete pragma is a better choice? |
13:13:35 | FromGitter | <timotheecour> not sure what u’re suggesting |
13:13:39 | FromGitter | <alehander42> queues was deprecated for years |
13:13:41 | FromGitter | <alehander42> afaik |
13:13:45 | leorize | well, queues was deprecated for 2yrs according to that commit msg :P |
13:14:00 | narimiran | i'm the one who deleted it :D |
13:14:06 | Araq | well tbh |
13:14:16 | narimiran | i was deprecated since v0.16 |
13:14:19 | Araq | I stop using deprecated features when they're removed :P |
13:14:28 | narimiran | and it would be removed sooner or later |
13:14:28 | kobi7 | hehe |
13:14:36 | narimiran | and IMO, the sooner the better |
13:15:13 | narimiran | and if you depend on stuff deprecated in 0.18 or newer — start migrating to non-deprecated stuff, for your own sake |
13:15:32 | kobi7 | narimiran: How do I know which is deprecated? |
13:15:49 | leorize | the compiler will spit out a lot of warnings in that case |
13:15:55 | leorize | it's omitted for packages however |
13:15:56 | narimiran | kobi7: compiler will tell you |
13:16:19 | narimiran | well, then package maintainer has to do his job |
13:16:21 | kobi7 | I mean, if I just have a yaml file, and want to make a simple "script"-like app. Should I bug the author to update his code? |
13:16:26 | narimiran | yes |
13:16:48 | kobi7 | yes, it is reasonable what you're saying |
13:16:57 | narimiran | if you don't, then we will have a lots of "package X is broken in Nim 1.0, but it worked before" |
13:18:10 | kobi7 | I have a question about exceptions |
13:18:57 | Araq | sometimes I wonder if this deprecation process isn't something for losers. Every "real" API I use is so full of cruft that it's not funny (Win API, Posix, browser JS APIs) |
13:19:15 | FromGitter | <timotheecour> i’m all for deprecations but tha’ts what graveyard is for isnt’ it |
13:19:24 | narimiran | no |
13:19:28 | narimiran | see my reply there |
13:19:44 | narimiran | we had some stuff deprecated in v0.8 |
13:19:49 | narimiran | (that's not a typo) |
13:20:08 | narimiran | should we continue to maintain it? (just in a different repo) god no. |
13:20:44 | narimiran | it's not like we removed something that was deprecated 2 months ago. |
13:21:02 | narimiran | reminds me of python2 cries |
13:21:07 | kobi7 | I guess some code can be made, that checks the packaged libraries, and if they depend on a feature that was removed, notify or even file an issue automatically. |
13:21:41 | dom96 | graveyard is for modules that are NOT deprecated but which we don't think belong in the stdlib |
13:21:49 | FromGitter | <alehander42> kobi7: that's what @timotheecour is doing |
13:21:57 | narimiran | if package maintainer didn't fix the deprecation since v0.16, why do you think he will do it now? |
13:21:58 | FromGitter | <alehander42> ci running for nimble packages |
13:21:58 | kobi7 | cool |
13:22:38 | kobi7 | narimiran: u know, it's opensource, you can't really blame someone for not wanting to be a maintainer. |
13:22:43 | narimiran | @timotheecour re your reply in graveyard repo: please, don't give us unnecessary work |
13:22:58 | * | Vladar quit (Remote host closed the connection) |
13:23:14 | narimiran | dom already told you what goes in graveyard |
13:23:23 | dom96 | timotheecour: Please please please start to consider our time when creating issues, dealing with all these notifications takes time. You could have discussed this here very easily and saved many people a lot of time. |
13:23:40 | narimiran | this ^ |
13:24:11 | narimiran | i know you're doing this in good faith, but it is counterproductive |
13:25:08 | kobi7 | timotheecour: Are you working on Nim full time? |
13:25:19 | narimiran | kobi7: it sure seems like that :D :D |
13:25:47 | FromGitter | <timotheecour> @dom96 my point still holds: the readme in https://github.com/nim-lang/graveyard/blob/master/README.md doesn’t reflect the reality you’re saying above |
13:26:15 | kobi7 | amazing work |
13:26:19 | narimiran | where does it say that graveyard is for long-deprecated stuff?? |
13:26:32 | narimiran | "Packages from Nim stdlib that are no longer in use" |
13:26:49 | Araq | yeah... why is queues not in graveyard? |
13:26:57 | dom96 | omg |
13:27:03 | Araq | it belongs to the graveyard, right? |
13:27:14 | FromGitter | <alehander42> it doesnt seem obvious at all from the readme |
13:27:16 | narimiran | because dom96 and i agreed that graveyard is not for that |
13:27:16 | FromGitter | <timotheecour> well @araq see https://github.com/nim-lang/graveyard/issues/8 |
13:27:24 | dom96 | Araq: queues has been deprecated |
13:27:33 | dom96 | For a LONG time |
13:27:42 | dom96 | So it gets removed into the void |
13:27:55 | FromGitter | <timotheecour> that’s why i’m suggesting to simply update the README to reflect a bit more preciselt what you guys intend it to be |
13:27:58 | Araq | well graveyard also has obsolete stuff |
13:27:59 | narimiran | graveyard is for stuff removed (recently!) from stdlib, not for stuff deprecated who-knows-when |
13:28:05 | dom96 | Araq: Like what? |
13:28:24 | FromGitter | <couven92> well since its on git, we can always bring it back if removing it into the void proves to be a bad idea |
13:28:38 | Araq | it seems to fit but ok whatever |
13:28:41 | dom96 | Sure, we can improve the readme and make this more explicit |
13:28:42 | FromGitter | <alehander42> well, the problem is that things in graveyard naturally become obsolete |
13:28:45 | narimiran | it is the least problem to add queues to graveyard, but then you'll have the situation where somebody wants some bug to be fixed, etc |
13:29:02 | FromGitter | <alehander42> if they are used, somebody will maintain them and they'll become a normal nimble package |
13:29:03 | dom96 | Araq: I guess we should add `sockets` into graveyard too then? |
13:29:07 | dom96 | and asyncio |
13:29:08 | dom96 | ? |
13:29:13 | Araq | sure why not? |
13:29:20 | Zevv | nooooooo |
13:29:23 | Araq | why have the graveyard if not for these? |
13:29:50 | Araq | but it's ok, I don't care too much |
13:30:03 | dom96 | To be fair, I don't see how `scgi` can work |
13:30:10 | FromGitter | <timotheecour> well i’m glad i wasn’t the only one confused by what graveyard was about |
13:30:13 | narimiran | Araq: for packages which are removed from stdlib because we want to make stdlib smaller. not for deprecated packages which are superseded by stuff in stdlib |
13:30:30 | Araq | ok ok, no worries |
13:30:37 | dom96 | Since scgi depends on asyncio/sockets |
13:30:56 | narimiran | "oh my queues don't work" -> use deques |
13:31:09 | Araq | my only concern is system.nim anyway. it needs to die |
13:31:09 | dom96 | But yes, for queues that is clear |
13:31:12 | FromGitter | <alehander42> why is scgi in the stdlib |
13:31:14 | FromGitter | <alehander42> at all |
13:31:26 | dom96 | alehander42: it's not there any longer |
13:31:52 | FromGitter | <alehander42> hm, i need to update my repo |
13:32:08 | narimiran | @alehander42 https://github.com/nim-lang/Nim/commit/8d9b093440939a890d9f7df1ffe037e90f6d7a6c |
13:32:26 | FromGitter | <alehander42> yeah sorry |
13:32:29 | dom96 | So the only question is how do we solve the `scgi` issue? |
13:32:44 | FromGitter | <alehander42> but is scgi now in graveyard |
13:32:45 | dom96 | As it stands right now it won't compile |
13:32:47 | Araq | move it and its dependencies to graveyard |
13:33:14 | Araq | or create a scgi nimble package and add its dependencies to it too |
13:33:26 | dom96 | Okay. So the asyncio and sockets modules should be put under the `scgi` directory |
13:33:47 | dom96 | narimiran: can you do that? |
13:34:06 | narimiran | btw, i didn't yet remove asyncio and sockets because there are other libraries/tests depending on them |
13:34:33 | dom96 | I see |
13:35:12 | narimiran | but stuff like that should be dealt before v0.20, IMO |
13:35:33 | dom96 | yep |
13:35:46 | * | dom96 updates the graveyard readme |
13:36:07 | * | wildlander quit (Ping timeout: 240 seconds) |
13:36:34 | narimiran | weee, now everybody is happy :D |
13:37:19 | kobi7 | :-) |
13:37:21 | narimiran | if only people cared so much about the current packages.... |
13:38:10 | * | theelous3 joined #nim |
13:38:14 | narimiran | plenty of work here for all of you with some free time on your hands: https://github.com/nim-lang/Nim/issues/10330 |
13:38:46 | kobi7 | narimiran: I think it's actually nice. think larger scale, with many packages that want to enjoy the latest compiler features. it's a good thing to notify them or even semi-automatically show them how to fix every deprecated proc. |
13:38:54 | Zevv | Just asking, becaused I missed the conclusions here: is asyncio and sockets getting dropped from the stdlib then? |
13:38:59 | Araq | we could think about Nim "distributions", ship Nim with all Nimble packages that work |
13:39:15 | narimiran | Zevv: they are already deprecated |
13:39:27 | kobi7 | narimiran: it allows for a more streamlined flow, and less burden on maintainers |
13:39:28 | narimiran | "**Warning:** This module is deprecated since version 0.10.2." |
13:39:50 | narimiran | it is not like it is a sudden change |
13:40:01 | Zevv | no, cool with that, I always found it confusing to have these around |
13:40:21 | kobi7 | narimiran: for example, replacing queues with deques, you can tell it which proc to use instead of the deprecated ones. (but can scan nimble packages to see what they actually used). Well maybe it's too big of a project this idea, don't know |
13:40:29 | FromGitter | <alehander42> @narimiran i ticked myself for jsffi docs, as we talked |
13:40:45 | narimiran | @alehander42 i'll put that on the list, i forgot |
13:40:57 | FromGitter | <alehander42> i actually added myself to the list |
13:40:58 | dom96 | Araq: huh? |
13:41:04 | FromGitter | <alehander42> i am not sure why github let me do it |
13:41:10 | FromGitter | <alehander42> if this is not ok, i'll revert it |
13:41:15 | narimiran | k |
13:42:13 | Araq | dom96, if we split up the library into ever more Nimble packages, the doc search suffers |
13:42:44 | kobi7 | maybe nimble can do that - lookup the dependencies and warn when one of the dependencies is deprecated. then some tag will be added to the package or something. |
13:42:45 | dom96 | We're only removing the "shitty" modules :P |
13:43:03 | dom96 | At least we should be, which is why I was so annoyed to see smtp being removed |
13:43:19 | Araq | dom96, for now. But time as moves on, more and more stuff will get moved |
13:43:35 | Araq | we have an HTML parser in the stdlib? |
13:43:43 | Araq | and an SQL parser?! |
13:43:52 | FromGitter | <couven92> wft??? |
13:44:02 | Araq | and 2 regex modules |
13:44:07 | dom96 | Sure, move those |
13:44:20 | dom96 | IMO HTML parser should in fact be put in a non-graveyard repo |
13:44:22 | narimiran | and those are the things that should go to graveyard |
13:44:26 | Araq | ok then our docs cover less and less |
13:44:34 | narimiran | not the deprecated stuff |
13:44:38 | dom96 | Because it's a great module and we should maintain it |
13:44:45 | FromGitter | <mratsim> People are often asking about SQL though |
13:44:46 | dom96 | and promote it |
13:44:51 | Araq | we need to integrate official/good Nimble packages into our documentation |
13:45:09 | kobi7 | it doesn't have to be put in graveyard - just as a separate package, and run the docs for it. |
13:45:12 | Araq | I'm not against HTML and SQL, I wrote these modules and I do maintain them as far as I can |
13:45:16 | narimiran | Araq: we should put search or link to nimble.directory, where you can search for nimble packages |
13:45:18 | dom96 | Yes, we do. But this can be done via packages.directory |
13:45:21 | FromGitter | <alehander42> @dom96 yeah, good modules should directly go as an independent package |
13:45:27 | dom96 | er, nimble.directory, yeah, that :P |
13:45:33 | FromGitter | <mratsim> we need a good docgen package. |
13:45:58 | Araq | the docgen is getting better, but it lacks completely the notion of "this package over there" |
13:46:10 | FromGitter | <mratsim> my docgen for Arraymancer is completely hacky |
13:46:32 | FromGitter | <mratsim> or at least something that we can plug to Sphinx since sphinx is using rst |
13:46:37 | dom96 | Indeed. Perhaps we should turn the stdlib into a proper "std" package |
13:46:54 | kobi7 | now you're going too far ;-) |
13:47:05 | dom96 | The docgen should in any case have some sort of package switcher at the top of each page |
13:47:52 | kobi7 | "package switcher" ? a link? |
13:48:40 | * | Snircle joined #nim |
13:48:41 | dom96 | To be honest, our docgen doesn't really need to care about it |
13:48:49 | dom96 | It should be the package directories job |
13:49:01 | dom96 | See for example how docs.rs works https://docs.rs/skeletal_animation/0.28.1/skeletal_animation/ |
13:50:18 | * | gangstacat joined #nim |
13:50:28 | * | absolutejam quit (Ping timeout: 245 seconds) |
13:50:28 | dom96 | nimble.directory is great but it's still really unreliable, I can't view docs for jester for example https://nimble.directory/pkg/jester |
13:51:38 | Araq | I think we need an URL scheme so that I can refer to a precise overloaded proc somehow |
13:51:51 | dom96 | Don't we have that already? |
13:52:07 | Araq | it doesn't produce URLs I can remember, I want |
13:52:17 | dom96 | https://nim-lang.org/docs/strutils.html#toUpperAscii%2Cchar |
13:52:26 | * | wildlander joined #nim |
13:52:52 | Araq | `proc foo(arg: int; argb: string)`_ links |
13:53:11 | dom96 | oh, yes. |
13:53:15 | Araq | what's the %2C doing there, how am I supposed to know it |
13:53:15 | narimiran | oh, no |
13:53:30 | dom96 | The docgen needs much richer cross-referencing support |
13:53:30 | narimiran | oh, i misunderstood |
13:53:59 | dom96 | But then how do I reference an overloaded proc in another module? ;) |
13:54:13 | * | absolutejam joined #nim |
13:54:26 | narimiran | you want that you can copy-paste proc declaration between ` and `_, and that would create a link to `#foo,int,string` |
13:54:55 | kobi7 | Question: if I compile with -d:ssl the raises pragma needs ref SslError. But when I add it to the pragma, and import net, it is still unrecognized. What do I need to do? |
13:55:04 | dom96 | I still want admonitions in our docgen as well |
13:55:17 | dom96 | Being able to show rich warnings and things can come in handy |
13:55:27 | Araq | dom96, `proc othermodule.foo(...)` ? |
13:55:38 | kobi7 | the playground (play.nim-lang.org) is down |
13:55:47 | Araq | we have the code to compute a stable hash from a proc signature |
13:55:59 | Araq | but we don't use it in the docgen :P |
13:56:14 | * | banc quit (Quit: Bye) |
13:56:20 | dom96 | Araq: That's because we want friendly anchors |
13:56:29 | dom96 | gradha IIRC did an awesome job, please don't remove these |
13:56:56 | kobi7 | weird, it now imports it properly. sorry about that. |
13:57:39 | Araq | dom96, they are not friendly to me and his code is wrong |
13:58:06 | dom96 | also, you'll break tons of links if you change them now |
13:58:10 | dom96 | fix the code then |
13:58:30 | Araq | it's unfixable, it assumes I cannot have my own 'int' type |
13:58:41 | Araq | well... maybe it is fixable |
13:59:01 | kobi7 | dom96: why will it break if the docs are generated? |
13:59:25 | dom96 | kobi7: because tons of articles/documents link to the docs |
13:59:28 | narimiran | kobi7: because i manually added lots of links to procs recently |
13:59:29 | dom96 | This includes my book |
14:00:15 | Araq | ok the better, I won't do anything then |
14:01:44 | narimiran | in other news: CI throws "Error: invalid indentation", and i cannot reproduce that locally :/ |
14:04:19 | narimiran | Araq: "Warning: pragma before generic parameter list is deprecated " what is the new way? put it in after generic parameter? |
14:04:26 | dom96 | Araq: Do fix the issues |
14:06:04 | Araq | narimiran, yes |
14:09:45 | * | nc-x joined #nim |
14:18:06 | * | banc joined #nim |
14:19:27 | FromGitter | <dandevelo> Where can one start in order to fix https://github.com/nim-lang/Nim/issues/10263 ? |
14:19:54 | Araq | is it really OSX specific? |
14:20:06 | FromGitter | <dandevelo> I've only noticed it on osx |
14:20:07 | Araq | why does it produce empty // lines? |
14:20:22 | FromGitter | <dandevelo> That is the question to be answered :) |
14:21:24 | FromGitter | <dandevelo> And yes, it is strange that I only saw this on osx |
14:21:31 | Araq | I searched for "// (quote included) in cgen.nim and found the one place where it's generated |
14:23:21 | FromGitter | <dandevelo> Looks like this sourceLine(p.config, t.info) is not working properly |
14:23:34 | * | stefanos82 joined #nim |
14:23:35 | Araq | then you jump to sourceLine's declaration |
14:23:37 | Araq | in msgs.nim |
14:23:50 | Araq | and see that it swallows IOError etc |
14:24:10 | Araq | you patch the file and run 'koch temp c myfailingexampleprogram.nim' |
14:25:24 | Araq | bbl |
14:27:09 | FromGitter | <dandevelo> Not sure what the patch would be for that file |
14:29:41 | Zevv | dandevelo: also reproduces on linux |
14:30:09 | FromGitter | <dandevelo> Thanks @Zevv that is good to know |
14:30:12 | nc-x | and windows |
14:30:50 | FromGitter | <dandevelo> Hmm...so it looks like a general thing. I'll have to check my Windows machine, maybe I have an older Nim there |
14:32:02 | * | cspar quit (Ping timeout: 250 seconds) |
14:33:18 | nc-x | Due to this commit most probably https://github.com/nim-lang/Nim/commit/c640bd2d1bb283bcbd87da11d6b16e5f9bd39bdc |
14:34:06 | Zevv | seems that in conf.m.fileInfos all lines[] are empty |
14:37:12 | * | cspar joined #nim |
14:38:27 | FromGitter | <dandevelo> @Zevv how did you debug that? |
14:38:32 | FromGitter | <sclee15> Can I ask something regarding Jester? I would like to use nimongo async client along with Jester. I think AsyncMongo provides connection pooling, so I placed an instance of AsyncMongo as a global variable and referenced it from routes clauses and compiler spits a “not gc-safe error”. ⏎ I understand use of a global variable is not good for gc-safety but I don’t know what to do… does anybody can show me how to |
14:38:32 | FromGitter | ... use nimongo and jester properly while threads:on |
14:38:48 | Zevv | not optPreserveOrigSource(conf) |
14:39:23 | Zevv | dandevelo: read code, add echo's, compile, inspect output, repeat ad infinitum. I'm not spart enough for debuggers |
14:40:42 | Zevv | s/spart/smart/ |
14:42:42 | * | fvs joined #nim |
14:43:06 | Zevv | fix PR is on the way |
14:43:28 | FromGitter | <dandevelo> @Zevv that's great! |
14:44:45 | Zevv | Can you try if this makes sense: https://github.com/nim-lang/Nim/pull/10368 |
14:47:12 | narimiran | @alehander42 i'm not sure we understood each other about runnable docs and empty lines |
14:48:01 | FromGitter | <dandevelo> @Zevv that works! |
14:48:22 | * | floppydh quit (Quit: WeeChat 2.3) |
14:51:06 | FromGitter | <dandevelo> Thanks a lot! |
14:51:11 | narimiran | @alehander42 see here: http://ix.io/1yBh/ |
14:58:35 | FromGitter | <alehander42> yes, the first one seems a lot clearer to me |
14:59:08 | FromGitter | <alehander42> i can visually see [docs & examples] and [code] |
15:01:34 | FromGitter | <kaushalmodi> +1 for 2-space indentation and blank line between example and actual code |
15:01:43 | narimiran | eh, to me the first one has the code "somewhere in between" |
15:02:02 | narimiran | it is the same distance from its scope and the other function |
15:02:15 | narimiran | like it isn't part of the `foo` |
15:02:52 | * | TongirMan quit (Ping timeout: 246 seconds) |
15:03:22 | narimiran | but i agree that second one is not ideal, and it is hard to distinguish between docs and code |
15:03:24 | shashlick | @gogolxdong - can you please provide additional details on the nimble install failure for nimterop - open an issue perhaps |
15:03:50 | Zevv | IMHO the doAsserts add a lot of noise to the runnable examples |
15:03:56 | shashlick | Saw the discussion on nimterop earlier - busy day eh |
15:04:28 | dom96 | sclee15: you need to use a {.threadvar.} and create an accessor for your global var, checking whether it's initialised. If it's not, initialise it and return it, otherwise just return it |
15:05:38 | dom96 | Does anyone know if we have an issue for this? We should be able to just init a threadvar and the compiler should automagically init it in each new thread for us |
15:05:44 | FromGitter | <alehander42> @narimiran well it's subjective, it's good to hear other opinions too, but i still feel the upper newline is more important: `proc <..>` is more easily recognized as a limit, so the distance to the next block being one line isn't such a problem |
15:06:09 | shashlick | Just some comments - my goal is to wrap, not to outright translate. I think that's too ambitious, even if just for C. Verifying accuracy is too much work and not worth it especially when you can simply run gcc. |
15:06:14 | Zevv | would it make sense to rewrite the doAsserts in runnableexamples to something like this: http://paste.debian.net/plain/1061264 |
15:06:46 | narimiran | Zevv: why would you want to do that? |
15:06:48 | dom96 | Zevv: I don't think so |
15:07:00 | dom96 | It's better not to hide these things from programmer's |
15:07:12 | narimiran | this way you can copy-paste the example and work from there |
15:07:15 | dom96 | I know that it might not be as readable but I don't think transforming it is the way to go |
15:07:16 | FromGitter | <Vindaar> @narimiran For a proc with only 1 loc I might agree. But for longer procs the benefits of having that line of space exceeds imo |
15:07:16 | Zevv | it feels noisy. doAssert() on each and every line |
15:07:24 | * | fvs left #nim ("ERC (IRC client for Emacs 26.1)") |
15:07:45 | narimiran | @Vindaar yeah, my point was just for oneliners |
15:07:55 | FromGitter | <Vindaar> oh I see |
15:08:15 | narimiran | Zevv: copy-pasting your example would just produce warning/errors |
15:08:29 | FromGitter | <Vindaar> but I guess we should stick to one style no matter how long the proc, no? |
15:08:52 | narimiran | well, we can have one rule, covering two cases :D |
15:08:53 | Zevv | narimiran: true |
15:09:42 | FromGitter | <Vindaar> that'd be the goal :D |
15:09:58 | narimiran | Zevv: doAssert might not be pretty, but it serves the purpose of testing and ensuring that the documentation is correct. (and, as i said, the examples work when you copy-paste them) |
15:10:21 | narimiran | i would rather see `assert` there, but nobody asked me :P |
15:10:47 | FromGitter | <kaushalmodi> I'm with @Vindaar on consistency |
15:10:52 | Zevv | that might lessen the visual clutter a bit |
15:11:33 | FromGitter | <kaushalmodi> Tomorrow if the proc becomes two or more lines, someone has to remember to add that blank line? |
15:12:04 | Zevv | also, look at the current examples strutils.split(), that's a bit of a mess |
15:12:12 | FromGitter | <alehander42> no, I think specifically oneliners need the empty line a lot |
15:12:24 | Zevv | I tried to add white space, but the I guess the output is AST generated and not copied verbatim? |
15:12:44 | FromGitter | <kaushalmodi> Zevv: visual clutter in editor? |
15:13:24 | Zevv | sorry, mixing up discussions: this was about layouting of the runnableExamples in the documentation |
15:13:44 | narimiran | it is all the same discussion — about bikeshedding :D |
15:13:51 | FromGitter | <alehander42> overally i think an empty line is equally fine for <n> lines of code |
15:14:21 | Zevv | narimiran: it is a bit more then that: first impression on the docs makes a hell of a difference for new users |
15:14:25 | FromGitter | <alehander42> i would put the docs + examples on top of the header if i could :D but too late fot that |
15:14:29 | FromGitter | <kaushalmodi> I was just telling that that visual clutter can be taken care of in editors if needed |
15:14:57 | narimiran | Zevv: and the current initial impression is: the documentation is poor and there are no examples in it |
15:15:05 | FromGitter | <kaushalmodi> Emacs can overlay repeated stuff that you like with whatever you |
15:15:08 | narimiran | so let us all work on that ;) |
15:15:11 | FromGitter | <kaushalmodi> want |
15:15:13 | Zevv | narimiran: point taken |
15:15:35 | narimiran | :) |
15:16:10 | FromGitter | <gogolxdong> I removed nimble and build_all, failure gone. |
15:16:20 | FromGitter | <alehander42> i think `<assert> ..` is fine |
15:16:28 | FromGitter | <alehander42> but i am not sure why is it `doAssert` |
15:16:36 | FromGitter | <alehander42> instead of just assert |
15:16:44 | FromGitter | <alehander42> but yeah, too late for that :D |
15:16:49 | Zevv | why too late? |
15:16:55 | narimiran | no, really, look at some modules listed here: https://github.com/nim-lang/Nim/issues/10330 — the doAssert noise or an empty line is really the least of our concerns |
15:17:13 | narimiran | not that it shouldn't be discussed, but.... you get my point |
15:17:56 | FromGitter | <kaushalmodi> @alehander42 asserts can be disabled |
15:18:01 | Zevv | I'll try to pick up a few |
15:18:10 | FromGitter | <kaushalmodi> doAsserts cannot be disabled |
15:18:15 | narimiran | yes, but are they disabled when creating docs? |
15:18:16 | FromGitter | <kaushalmodi> Maybe that's why |
15:18:33 | narimiran | if they aren't, then we can use assert, and make documentation prettier :) |
15:18:49 | FromGitter | <kaushalmodi> May be just a foolproof way to always have the checks on |
15:19:38 | narimiran | i understand using doAssert inside of your code, when you really really want that to be checked in release mode, but for docs? |
15:19:55 | narimiran | does `nim doc -d:release foo` even exist? |
15:20:29 | FromGitter | <kaushalmodi> I like the idea of using assert instead of doAssert |
15:20:34 | FromGitter | <kaushalmodi> Araq? |
15:20:46 | FromGitter | <gogolxdong> but test failed ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c41eecedab15872ceb49527] |
15:20:53 | narimiran | ok, i've tried putting `assert 5 == 9` in runnable example, and it has been caught |
15:21:18 | FromGitter | <kaushalmodi> @timotheecour ? (About using assert in above discussion) |
15:21:50 | narimiran | dom96: ^ ? |
15:22:58 | narimiran | currently, all of us here are in favour of assert (over doAssert) for docs, from what i can tell. anybody against it? |
15:23:06 | dom96 | doAssert is more about teaching the programmer |
15:23:12 | dom96 | I'm against it :P |
15:23:18 | FromGitter | <alehander42> doAssert just seems hacky |
15:23:25 | narimiran | ...and ugly |
15:23:30 | dom96 | doAssert is a stronger form of assert |
15:23:34 | narimiran | dom96: see the above discussion |
15:23:41 | dom96 | I did see the discussion |
15:23:45 | FromGitter | <alehander42> it doesn't matter: you're a new user , you open the docs |
15:23:48 | narimiran | is it really needed for some basic examples in the documentation? |
15:23:51 | FromGitter | <alehander42> "why cant it be just assert" |
15:24:02 | FromGitter | <alehander42> "whats wrong with assert in this language" |
15:24:04 | FromGitter | <kaushalmodi> Maybe we should have `assert` and `assertMaybe` |
15:24:20 | FromGitter | <timotheecour> FWIW D calls `doAssert` as `enforce`, and allows custom Exceptions, not just `AssertError` |
15:24:20 | narimiran | "why does nim use this ugly doAssert, and not the usual assert" |
15:24:44 | dom96 | yes, and they will learn something about the language |
15:25:00 | narimiran | :'( |
15:25:04 | dom96 | There are bound to be cases where `assert` will make more sense |
15:25:10 | Zevv | I'm sick of this lesson for each and every part of the docs I read |
15:25:17 | FromGitter | <kaushalmodi> dom96: I don't get the point about learning about the language |
15:25:21 | narimiran | and these cases are: documentation! :D |
15:25:27 | * | enow quit (Remote host closed the connection) |
15:25:30 | dom96 | for example, something might behave differently based on `debug` vs. `release` mode |
15:25:45 | FromGitter | <kaushalmodi> But in docs? |
15:25:47 | dom96 | but meh, I'm not that strongly opposed to it to be honest |
15:25:50 | FromGitter | <alehander42> @dom96 this doesn't mean every doc example has to pay the price |
15:26:02 | Zevv | pulling legs, eh |
15:26:06 | FromGitter | <alehander42> for such a small knowledge thingy |
15:26:14 | narimiran | but, we're speaking about documentation, where we use `let a = @[1]; doAssert len(a) == 1` |
15:26:23 | dom96 | IMO a RFC should be made for this |
15:26:26 | FromGitter | <timotheecour> this can be easily solved via tooling btw, where nim doc can filter/rename doAssert wo changing the nim sources |
15:26:37 | narimiran | most of the time `doAssert` is there instead of an echo, just to show (and check) the result |
15:27:02 | FromGitter | <timotheecour> ya doAssert is clearer in docs |
15:27:10 | FromGitter | <timotheecour> echo is vague and not enforced |
15:27:16 | narimiran | in the documentation, you want to see the result of applying some proc |
15:27:17 | Zevv | Thus my proposal " |
15:27:18 | Zevv | normalize("Foo_bar") # -> "foobar" |
15:27:21 | Zevv | but that's indeed not runnable |
15:27:25 | FromGitter | <timotheecour> I like asserttions in docs (D does same) |
15:27:26 | FromGitter | <alehander42> no, this is too much |
15:27:37 | narimiran | @timotheecour the discussion is doAssert vs assert, not doAssert vs echo |
15:27:40 | FromGitter | <alehander42> and too magical @Zevv |
15:27:55 | FromGitter | <alehander42> imo |
15:28:09 | FromGitter | <timotheecour> than that can be done by nim doc tooling that xforms doAssert to assert, but shouldnt’ change sources |
15:28:17 | narimiran | Zevv: we had before the same style like you propose, just `echo` in front |
15:28:53 | FromGitter | <timotheecour> btw: tests (including runnableExamples) should use doAssert, otherwise the tests don’t test anything in release mode (they’d be disabled) |
15:28:58 | narimiran | can please somebody answer me why doAssert is needed in **docs**? |
15:29:21 | * | nc-x quit (Quit: Page closed) |
15:29:26 | Zevv | timotheecour: docs are not run in release mode |
15:29:27 | FromGitter | <timotheecour> what do u mean by docs; do u mean runnableExamples? |
15:29:32 | FromGitter | <alehander42> @timotheecour but why can't the compiler just ignore release for runnableExamples |
15:29:40 | FromGitter | <alehander42> there is no point in honoring it there |
15:29:45 | narimiran | even if you run `nim doc -d:release foo.nim`, that will catch an error in plain old `assert` |
15:29:48 | FromGitter | <alehander42> at least for assert |
15:29:55 | FromGitter | <alehander42> ignore it for assert* |
15:29:59 | narimiran | yes, we're talking about runnableExamples here |
15:30:17 | FromGitter | <alehander42> ha, so it already does |
15:30:23 | narimiran | it already does |
15:30:37 | FromGitter | <timotheecour> ok, then just add a post-processing filter that renames, if u really want, but don’t change sources |
15:30:53 | narimiran | if you run `nim c`, it ignores docs. and if you do `nim doc`, plain `assert` is catchable, can't be avoided |
15:30:57 | Zevv | and keep using doAssert() in future docs then, for consistency |
15:31:59 | narimiran | Zevv: it is still early enough to change it, and use `assert` consistently in the future. and even some doAssert here, and some assert there, really doesn't make a difference |
15:32:20 | narimiran | "oh, they are using two things in their documentation, 0/10, totally unreadable, i quit nim" |
15:32:31 | FromGitter | <alehander42> btw it seems to me `assert` is already used in system.nim docs anyway |
15:32:44 | FromGitter | <alehander42> hm this is in code-blocks |
15:32:56 | narimiran | that's even worse |
15:33:36 | narimiran | we now have code-blocks which are not run at all, and we're discussing some theoretical cases where runnableExamples might not check assert (which they always do) |
15:33:55 | FromGitter | <alehander42> btw do the runnable examples in when defined js run .. under node? i really doubt that |
15:34:10 | FromGitter | <timotheecour> `-d:release` should be made honorable by `nim doc`, even if not already case today: `nim doc` calls `nim c ` on runnableExamples, so if you u have `assert` inside, it’ll just disable them => bad |
15:34:29 | narimiran | @timotheecour i tried it. it won't |
15:34:34 | FromGitter | <alehander42> @timotheecour it should *not* honor -d:release for assert |
15:34:36 | FromGitter | <timotheecour> so we can run `nim doc` faster by honoring `-d:release` |
15:34:54 | narimiran | jesus christ what are we talking about here |
15:35:28 | narimiran | nobody convinced me that using assert in docs is bad. from now on i'm using that. |
15:35:56 | * | aguspiza joined #nim |
15:36:01 | narimiran | if you want to use doAssert: be faster than me and write docs with doAssert before i do it with assert |
15:36:29 | narimiran | currently we only have lots of people discussing what should be done, and nobody doing anything |
15:36:31 | FromGitter | <alehander42> and then search&replace is a minute away :P |
15:36:33 | FromGitter | <timotheecour> perfect world: ⏎ ⏎ 1) nim doc honors `-d:release` if it’s passed (passed thru runnableExamples) ⏎ 2) runnableExamples use doAssert ⏎ 3) (if really needed) docs transform doAssert into assert for cosmetics ... [https://gitter.im/nim-lang/Nim?at=5c41f281ba355012a45c1102] |
15:36:54 | narimiran | nim doc is fast already |
15:37:03 | narimiran | don't create new problems, please and thank you |
15:37:09 | FromGitter | <alehander42> @timotheecour a way simpler solution is for nim doc to honor -d:release, but for assert to not honor it when compiling in runnableExamples context |
15:38:13 | FromGitter | <alehander42> transforming doAssert into assert would be confusing and a gotcha for new users writing docs |
15:40:13 | * | cspar_ joined #nim |
15:40:57 | narimiran | @alehander42 i'm starting to use assert, and while i do that, i'll introduce some space between the examples and code |
15:41:28 | FromGitter | <alehander42> ok, sounds great! |
15:41:58 | * | cspar quit (Ping timeout: 244 seconds) |
15:42:26 | Zevv | congrats on the consensus :) |
15:43:06 | narimiran | Zevv: all we had to do, just not to use your proposition :P |
15:43:28 | narimiran | Zevv: but now you'll have less noise, as you wanted in the first place |
15:44:13 | Zevv | \o/ |
15:58:19 | * | aguspiza quit (Ping timeout: 250 seconds) |
15:59:37 | * | darithorn joined #nim |
16:03:32 | narimiran | so now that we figured that out, let's hear who will write some documentation? (you can even choose if you want to use doAssert or assert :)) |
16:06:30 | FromGitter | <kaushalmodi> narimiran: this would need to be updated too: https://github.com/nim-lang/Nim/blob/devel/doc/contributing.rst |
16:06:41 | FromGitter | <kaushalmodi> (about using `assert` and blank line between example and code) |
16:09:41 | narimiran | ok, if that's stopping the contributions.... ;) |
16:11:25 | * | absolutejam quit (Ping timeout: 244 seconds) |
16:39:03 | * | platoff quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:03:22 | * | ng0 joined #nim |
17:05:43 | * | platoff joined #nim |
17:23:43 | * | aguspiza joined #nim |
18:07:36 | * | nsf joined #nim |
18:07:51 | * | platoff quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:08:26 | narimiran | dom96: can you ban people from telegram chat? |
18:09:27 | rayman22201 | Soo.. Good morning (from my part of the globe) everyone. On the topic of documentation. I was starting to work on fixing the fuzzy search again. Is that still cool? I could write docs instead... I just wanted to finish what I started first. |
18:09:47 | * | platoff joined #nim |
18:20:30 | narimiran | rayman22201: nice to hear you would be up to writing some docs! :) but if you can improve the search, go for it — it's not like there won't be anything left to do docs-wise :) |
18:21:26 | rayman22201 | Lol. Fair point |
18:25:14 | * | Vladar joined #nim |
18:35:18 | * | vlad1777d joined #nim |
18:41:10 | * | dom96_w joined #nim |
18:43:05 | * | fanta7531 quit (Quit: ...) |
18:44:33 | * | kapil____ quit (Quit: Connection closed for inactivity) |
18:47:52 | * | Geezus42 joined #nim |
18:56:31 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:57:17 | * | cspar_ quit (Ping timeout: 250 seconds) |
19:06:08 | leorize | anyone has any macro-heavy codebase around? |
19:06:24 | leorize | I'd like to test nimsuggest highlighting :) |
19:12:16 | * | cspar_ joined #nim |
19:16:18 | * | theelous3 quit (Ping timeout: 250 seconds) |
19:20:34 | FromGitter | <kaushalmodi> How do I define a 1-bit int type (not boolean) |
19:21:09 | Araq | impossible, type Bit = range[0..1] takes up more than that |
19:23:11 | FromGitter | <kaushalmodi> that worked! |
19:23:16 | FromGitter | <kaushalmodi> at least for what I am trying to do |
19:23:30 | leorize | it's not 1 bit, certainly |
19:23:40 | FromGitter | <kaushalmodi> but SystemVerilog likes it |
19:23:49 | FromGitter | <kaushalmodi> *anybody familiar with that lang here?* |
19:24:03 | leorize | `ord true/false` should also work, no? |
19:24:16 | FromGitter | <kaushalmodi> in systemverilog: https://ptpb.pw/OCpW |
19:24:18 | Araq | not really, but iirc it's close to Ada |
19:24:30 | FromGitter | <kaushalmodi> In Nim: https://ptpb.pw/CdD3/nim |
19:24:51 | FromGitter | <kaushalmodi> SystemVerilog has DPI-C feature that allows mapping C functions to SystemVerilog |
19:25:11 | FromGitter | <kaushalmodi> I am trying to create a template of Nim functions that I think could map to SV datatypes |
19:27:20 | Araq | compile Nim to hardware, the ultimate goal in life |
19:27:36 | FromGitter | <kaushalmodi> :) I am more on the hardware verification side |
19:27:59 | FromGitter | <kaushalmodi> so trying to work out a verification environment where Nim and SV talk to each other |
19:28:29 | FromGitter | <kaushalmodi> need to figure out if mapping the SV `logic` type is even possible |
19:28:51 | FromGitter | <kaushalmodi> logic is a 4-state var where the value could be 1, 0, x (undefined), z (unconnected) |
19:28:59 | * | BigEpsilon quit (Quit: WeeChat 2.3) |
19:29:23 | FromGitter | <kaushalmodi> that depends on if the SV DPI-C feature supports transferring 4-state vars .. reading up on that |
19:36:40 | * | LargeEpsilon quit (Ping timeout: 250 seconds) |
19:37:21 | * | Tyresc joined #nim |
19:37:27 | * | nsf quit (Quit: WeeChat 2.3) |
19:37:53 | shashlick | by the way, choosenim #head now supports windows binary installs - https://github.com/dom96/choosenim/pull/102 cc @zetashift |
19:40:18 | narimiran | nice job! |
19:44:38 | * | cspar_ quit (Ping timeout: 245 seconds) |
19:52:00 | memeboi | <fredrik92> : what is required to use dashing w/ latest nim? |
19:52:01 | shashlick | and for those of you who hate having to uninstall each nimble child dependency, there's a new -i / --inclDeps flag that uninstall a package and all packages that depend on it in one shot |
19:52:30 | FromGitter | <zetashift> @shashlick awesome work! I' been using your |
19:52:33 | * | krux02 quit (Remote host closed the connection) |
20:06:52 | * | dom96_w joined #nim |
20:07:32 | FromGitter | <zetashift> First branch anyway for awhile now* :P |
20:07:57 | * | rokups quit (Quit: Connection closed for inactivity) |
20:31:49 | * | PMunch joined #nim |
20:36:28 | * | cag joined #nim |
20:43:51 | FromGitter | <Varriount> shashlick: What would be the best way to go about testing nimterop? |
20:44:01 | FromGitter | <Varriount> I'd like to try it out. :D |
20:54:01 | * | zachk joined #nim |
20:54:54 | shashlick | nifty |
20:55:06 | shashlick | on paper, nimble install nimterop should now work |
20:55:29 | shashlick | you can use the cimport method to make it seamless |
20:55:50 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:56:08 | shashlick | next you can refer to the tsoloud test to see how to use cimport https://github.com/genotrance/nimterop/blob/master/tests/tsoloud.nim |
20:56:19 | * | dom96_w joined #nim |
20:56:21 | * | dom96_w quit (Client Quit) |
20:56:33 | shashlick | alternative is to use the toast command line tool and run it on a header and pipe the output to a file |
20:56:52 | shashlick | that would be the c2nim style of wrapping |
21:10:38 | FromGitter | <iffy> What do I make of this? Am I calling repr on something that's nil? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4240ce83189945240fa5e7] |
21:20:07 | * | narimiran quit (Ping timeout: 240 seconds) |
21:23:55 | * | cspar_ joined #nim |
21:31:15 | * | Perkol joined #nim |
21:32:56 | * | zachk quit (Changing host) |
21:32:56 | * | zachk joined #nim |
21:50:29 | * | cspar_ quit (Ping timeout: 246 seconds) |
21:55:14 | * | Perkol quit (Remote host closed the connection) |
22:34:07 | cag | how do i initialize an empty dictionary i can fill with keys and values downstream? |
22:34:47 | * | platoff quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:35:13 | * | platoff joined #nim |
22:35:20 | * | platoff quit (Client Quit) |
22:35:55 | cag | nevermind its var dict = initTable[string, int]() |
22:42:50 | FromGitter | <Bennyelg> hey all |
22:43:12 | FromGitter | <Bennyelg> ```code paste, see link``` ⏎ ⏎ Its a bug? what am i doing wrong ⏎ nim -v 0.19.2 [https://gitter.im/nim-lang/Nim?at=5c42567fba355012a45ec49b] |
22:44:26 | cag | how do you return a table? |
22:46:02 | FromGitter | <iffy> @Bennyelg change it to `{"id": 10}` |
22:46:37 | FromGitter | <iffy> (no quotes on the 10) |
22:46:46 | FromGitter | <Bennyelg> thanks |
22:49:58 | cag | using the auto keyword works, but not sure what the actual type is |
22:50:10 | cag | needed to return a table of {string, seq[string]} |
22:52:41 | cag | nevermind its Table[value, value] |
22:58:16 | * | dom96_w joined #nim |
22:59:02 | cag | how do you write to a file? |
22:59:38 | FromGitter | <iffy> cag: https://nim-lang.org/docs/system.html#writeFile%2Cstring%2Cstring is one way |
23:00:26 | FromGitter | <sclee15> @dom96 thanks |
23:02:22 | * | sotrhraven joined #nim |
23:02:41 | sotrhraven | o/ |
23:04:39 | FromGitter | <kaushalmodi> how do I return pointer of a global object? |
23:04:46 | FromGitter | <kaushalmodi> tried ⏎ ⏎ ```const foo = [1, 2, 3, 4] ⏎ proc ret_fooPtr(): ptr {.exportc.} = ⏎ ptr foo``` [https://gitter.im/nim-lang/Nim?at=5c425b8ecb47ec300066577d] |
23:05:21 | FromGitter | <kaushalmodi> I'm just playing with compiling of various data types from Nim to a .so |
23:07:33 | * | Vladar quit (Remote host closed the connection) |
23:08:47 | shashlick | not sure you can get the addr of a const but you'd return addr foo, and return type will be ptr seq[int] i think |
23:10:50 | FromGitter | <kaushalmodi> hmm, I get *Error: expression has no address; maybe use 'unsafeAddr'* even when I use `unsafeAddr foo` |
23:11:03 | Zevv | it's a const |
23:11:05 | FromGitter | <kaushalmodi> I am trying to return a pointer to something, it does not have to be a const |
23:11:37 | FromGitter | <kaushalmodi> on the other end, in the foreign lang that's reading the .so, I am just checking if the pointer received is null or not |
23:11:38 | Zevv | make it a var instead, vars live in memory |
23:12:44 | FromGitter | <kaushalmodi> this seems to have worked: ⏎ ⏎ ```var ⏎ foo = @[1, 2, 3, 4] ⏎ proc ret_fooPtr(): ptr seq[int] {.exportc.} = ⏎ addr foo``` [https://gitter.im/nim-lang/Nim?at=5c425d6c95e17b452572f931] |
23:13:12 | FromGitter | <kaushalmodi> .. because it is compiling. Now I am trying to understand if it actually working using code on the other side |
23:13:14 | FromGitter | <kaushalmodi> thanks guys |
23:13:18 | FromDiscord_ | <exelotl> I've battled with this a lot recently... I *need* constant data because my target platform has just 32kb ram, but I still need to be able to address it |
23:14:33 | Zevv | look up the difference between const and let |
23:14:58 | FromGitter | <kaushalmodi> Zevv: I know the functional difference, but I don't know the low level stuff |
23:16:05 | Zevv | Best to look into the generated C file to see what is happening under the hood |
23:18:20 | Zevv | I see your problem - I was falsly assuming that 'let' would end up in the .data segment, but it actually goes into the .bss and the value is initalized at runtime by code |
23:19:01 | Zevv | you can get an address, but on an typical small embedded target it's not in your read only memory |
23:21:43 | FromDiscord_ | <exelotl> yeahh, I do have a solution but it's super dangerous :') |
23:21:56 | FromDiscord_ | <exelotl> ``` proc `&`[T](x:T):ptr T {.importc:"&", nodecl.} ``` |
23:22:24 | Zevv | what do you take the address of then? |
23:22:36 | Zevv | consts? |
23:22:42 | federico3 | are there any working examples of printing colored unicode charaters in a portable way? |
23:23:27 | FromDiscord_ | <exelotl> Zevv: yep, but it only works under the assumption that the const is addressable in the generated C code |
23:23:40 | Zevv | of course |
23:23:42 | FromDiscord_ | <exelotl> which happens to be the case for const objects |
23:24:21 | Zevv | :3 |
23:24:27 | Zevv | oops |
23:25:13 | Zevv | that's pretty nasty what you did there |
23:25:33 | FromDiscord_ | <exelotl> yes it's horrible xD |
23:25:46 | FromDiscord_ | <exelotl> I really think Nim needs a better way to do this... something like ```const foo {.addressable.} = 123``` |
23:26:27 | Zevv | that does make sense, afaik there is no explicit way to request somethin to go into a C const |
23:26:41 | Zevv | what is your target arch/platform? |
23:27:02 | ryukoposting | (hey sorry to drop in here, but how do people feel about Nim for embedded, I'm a big embedded guy and I want to get my ARM dev boards up and running on Nim) |
23:27:21 | FromDiscord_ | <exelotl> game boy advance / ARM |
23:27:31 | Zevv | exelotl: fun! |
23:27:48 | Zevv | ryukoposting: I did some ARM cortext M0/M3, mipsel and some atmega |
23:28:00 | Zevv | but nothing much more then playing around yet |
23:28:26 | FromDiscord_ | <exelotl> Here's what I've managed so far! (see "examples/move_sprite") https://github.com/exelotl/nim-tonc |
23:28:29 | ryukoposting | I'm pretty experienced with the ARMv7-M family, so Cortex-M0/0+/1/3/4/7 |
23:29:13 | Zevv | its pretty straightforward. Configure your cross compiler and go |
23:29:13 | ryukoposting | If there's a good way to switch nim over to the arm-none-eabi toolchain, I can whip up a port of CMSIS |
23:29:38 | shashlick | Zevv - i'm looking at your nimterop issues now - any priorities? |
23:29:50 | ryukoposting | I would wonder if c2nim could handle porting things like that, though. Awful lot of preprocessor shenanigans |
23:30:00 | Zevv | shashlick: none yet, but I was about to try it on CMSIS :) |
23:30:08 | FromDiscord_ | <exelotl> ryukoposting: I've had success so far with the following config: https://github.com/exelotl/nim-tonc/blob/master/examples/move_sprite/nim.cfg |
23:30:35 | Zevv | but seriously, no priorities. I just happened to file issues for things I ran into, but I have no plans for real use at the short term. |
23:30:41 | ryukoposting | im pretty new to nim, compileOnly presumably only does the C codegen? |
23:30:47 | * | cag quit (Ping timeout: 256 seconds) |
23:30:58 | Zevv | I feel the case collisions might be a good one to find a solution for though |
23:31:22 | Zevv | ryukoposting: yes, code ends up in ~/.cache/nim, or you specify where to put it on the cmdline |
23:32:08 | ryukoposting | nice |
23:32:09 | FromDiscord_ | <exelotl> yeah, then I'm using devkitARM makefiles to actually compile the C code.. but I think you could probably omit that and it would compile fine as long as the arm.standalone.gcc fields are setup correctly |
23:32:14 | Zevv | ryukoposting: look at nimterop instead of c2nim, it does a pretty good job. It was able to generate a lot of usable stuff from AVR libc |
23:32:42 | ryukoposting | does it spit out debug symbols? Tools like JLink and OpenOCD are really important |
23:32:45 | * | sotrhraven quit (Quit: -a- IRC for Android 2.1.47) |
23:32:54 | Zevv | it's just C under the hood |
23:33:12 | ryukoposting | ooooh yeah |
23:33:24 | Zevv | you can preserve lineinfo to the nim source, and apart from symbol mangling its pretty standard |
23:33:32 | shashlick | Zevv: the case collision needs some thought to figure out |
23:33:37 | ryukoposting | so there's probably not a good way to insert debug symbols into the code without just packing it with comments |
23:33:42 | Zevv | shashlick: indeed, there is no obvious solution here |
23:33:42 | shashlick | probably will need Araq's input as well |
23:34:04 | ryukoposting | Thanks for the link exelotl |
23:34:26 | FromDiscord_ | <exelotl> np |
23:34:39 | FromDiscord_ | <exelotl> The one problem is that --os:standalone means you're missing much of the standard library, but none of the other os options are really suitable for bare metal, from what I've found |
23:34:46 | Zevv | shashlick: there is probably no single good way to do it. I guess there should be some kind of convention to add postfixes to resolve collisions |
23:35:18 | ryukoposting | exelotl yeah there's really nothing you can do about that, short of implementing the better part of an OS lol |
23:36:40 | dom96_w | If you guys have a second, answer this survey and make sure to answer "Nim" for all relevant questions: https://www.jetbrains.com/research/devecosystem-2019/ :) |
23:36:55 | ryukoposting | based |
23:37:00 | FromDiscord_ | <exelotl> there's some stuff that really *should* work (especially at compile time) but some random error in the unicode module causes them to... not |
23:37:22 | FromDiscord_ | <exelotl> so I can't use strformat, tables, etc. even if I'm not using them at runtime |
23:37:50 | ryukoposting | exelotl coming from long, arduous battles with Rust's libcore, it's amazing how many weird things can start depending on dynamic memory allocation or system calls if you aren't careful |
23:38:23 | ryukoposting | especially when it's a language that was designed with those things in mind |
23:39:12 | ryukoposting | strformat kinda makes sense, that probably needs some dynamic memory management, which is probably trying to call sbrk, which then gets angry |
23:40:05 | dom96_w | ugh, they've got Crystal as an option in there but no Nim :( |
23:40:23 | ryukoposting | reeee |
23:43:04 | dom96_w | All I can do is this https://twitter.com/d0m96/status/1086408122749448192 |
23:43:35 | Zevv | dom96_w: you can even enter "nimble" as your favorite build system! \o/ |
23:43:43 | dom96_w | hah |
23:43:47 | ryukoposting | at least D didn't make the cut, that would have just been insulting |
23:43:53 | dom96_w | Now I expect you all to write Nimble in there ;) |
23:44:59 | Zevv | I put nimble in twice: also my favorite dependency manager |
23:45:22 | Zevv | All done. so, how much did you say you'd pay for this? |
23:46:44 | FromDiscord_ | <exelotl> I believe the deal was battle royale mode for Nimble |
23:46:48 | * | oculux joined #nim |
23:46:51 | Zevv | ghehe |
23:47:06 | dom96_w | Nothing, but you'll give me the prize if you win it ;) |
23:47:39 | shashlick | dom96_w: done |
23:47:51 | Zevv | they got me here - "Which of the following JetBrains products have you already tried". What is jetbrains? |
23:48:00 | ryukoposting | why is "I don't use programming languages" even an option lol |
23:51:31 | ryukoposting | tfw kate isn't on the list of text editors but gedit is, this whole thing is a sham man i swear |
23:53:45 | memeboi | me and frederico3 came accross something, if anyone has ideas or such https://github.com/nim-lang/Nim/issues/2982 |
23:54:38 | * | Tyresc quit (Ping timeout: 245 seconds) |
23:56:43 | * | stefanos82 quit (Remote host closed the connection) |