00:29:48 | * | tiorock joined #nim |
00:29:48 | * | tiorock quit (Changing host) |
00:29:48 | * | tiorock joined #nim |
00:29:48 | * | rockcavera quit (Killed (adams.freenode.net (Nickname regained by services))) |
00:29:48 | * | tiorock is now known as rockcavera |
00:59:07 | * | gangstacat quit (Quit: Ĝis!) |
01:00:59 | * | rockcavera quit (Remote host closed the connection) |
01:01:54 | * | rockcavera joined #nim |
01:05:20 | * | gangstacat joined #nim |
01:49:23 | * | arthurz joined #nim |
02:01:12 | * | S1tiSchu joined #nim |
02:05:14 | * | SitiSchu quit (Ping timeout: 268 seconds) |
02:10:33 | * | brainproxy quit (Ping timeout: 264 seconds) |
02:15:19 | * | noonien quit (Quit: Connection closed for inactivity) |
02:42:07 | * | brainproxy joined #nim |
02:52:19 | * | endragor joined #nim |
02:59:45 | * | S1t1Schu joined #nim |
03:03:57 | * | S1tiSchu quit (Ping timeout: 264 seconds) |
03:14:03 | * | brainproxy quit (Ping timeout: 256 seconds) |
03:20:59 | FromGitter | <zacharycarter> @Varriount - quick question if you're around - I'm playing with the sample AWS stuff you posted and now messing around with parsing boto schemas - what is up with the staticMain macro you posted in the one example file schema.nim? How does that work exactly / how is it invoked? |
03:24:12 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:24:37 | * | brainproxy joined #nim |
03:31:43 | FromGitter | <zacharycarter> ah I think I remember - you were trying to get this working at compile time |
03:47:21 | * | arthurz quit (Quit: Leaving) |
03:52:16 | FromGitter | <zacharycarter> hrm - so optional fields for marshaling json - is there any way to achieve this now or does anyone have a decent idea about how one might implement this idiomatically? |
03:57:21 | * | brainproxy quit (Ping timeout: 246 seconds) |
03:58:13 | * | dddddd quit (Remote host closed the connection) |
04:01:01 | * | user1101 joined #nim |
04:01:21 | * | brainproxy joined #nim |
04:01:30 | FromGitter | <cavariux> Hi, what would you call to be the most complete gui library in nim? |
04:03:58 | FromGitter | <zacharycarter> for doing what? |
04:04:05 | FromGitter | <zacharycarter> and what kind of gui? |
04:08:00 | FromGitter | <cavariux> a gui that I can use the widgets and later integrate an opengl context if posible, because I don't want to do a lot of guis in opengl haha |
04:08:03 | FromGitter | <cavariux> hi btw |
04:14:48 | FromGitter | <zacharycarter> hi :) |
04:15:11 | FromGitter | <zacharycarter> well if you're talking about for games - I guess your only real options are nimx and nuklear - or wrapping some other library |
04:15:38 | FromGitter | <zacharycarter> w/ nuklear you can write additional backends - I think I've provided a GLFW / OpenGL3 one and frag has one for bgfx |
04:15:47 | FromGitter | <zacharycarter> but you could write one for sdl2 or sfml or whatever you want |
04:16:03 | FromGitter | <zacharycarter> nimx is probably easier to get going with |
04:16:15 | FromGitter | <zacharycarter> I know there are tests that come with it - kinda like a little showcase - not sure about docs etdc |
04:16:15 | FromGitter | <cavariux> oh no, I was thinking more something like wxWidgets that you can later add an opengl context, but for like an editor |
04:16:43 | FromGitter | <zacharycarter> oh... I think PMunch has a project (I may be getting the person wrong) that has a macro for generating easy GUI code |
04:17:04 | FromGitter | <zacharycarter> there's also NiGUI which I think might be dead? not sure |
04:17:16 | FromGitter | <zacharycarter> I'd still check out NimX |
04:17:32 | FromGitter | <cavariux> nimx looks promising |
04:17:40 | FromGitter | <cavariux> nigui last commit 11hrs ago |
04:18:14 | FromGitter | <zacharycarter> I guess it is still being worked on |
04:18:34 | FromGitter | <cavariux> thnxs, will check nimx out |
04:20:13 | FromGitter | <zacharycarter> sure thing |
04:22:02 | FromGitter | <zacharycarter> nevermind about my json marshaling question - I'm just tired |
04:33:57 | * | brainproxy quit (Ping timeout: 240 seconds) |
04:37:23 | * | brainproxy joined #nim |
04:40:07 | FromGitter | <Varriount> @zacharycarter You still up? |
04:44:10 | FromGitter | <Varriount> @zacharycarter staticMain is the main macro entry point. It's supposed to load the json and emit all the wrapper code. |
05:10:13 | * | brainproxy quit (Ping timeout: 256 seconds) |
05:11:59 | * | SenasOzys quit (Ping timeout: 260 seconds) |
05:13:12 | * | brainproxy joined #nim |
05:44:50 | * | user1101 quit (Remote host closed the connection) |
05:45:21 | * | user1101 joined #nim |
05:46:29 | * | brainproxy quit (Ping timeout: 256 seconds) |
05:56:12 | * | brainproxy joined #nim |
06:07:41 | * | leorize joined #nim |
06:20:32 | * | nsf joined #nim |
06:28:57 | * | brainproxy quit (Ping timeout: 240 seconds) |
06:37:55 | * | brainproxy joined #nim |
06:38:19 | * | rauss quit (Ping timeout: 260 seconds) |
06:40:29 | * | S1t1Schu quit (Read error: Connection reset by peer) |
06:40:46 | * | S1t1Schu joined #nim |
06:44:07 | * | yglukhov quit (Remote host closed the connection) |
06:55:05 | FromGitter | <mratsim> @miran ellipsis is used like this a[2, 0..1, `…`] which would mean a[2, 0..1, _, _] for a 4d tensor for example or a[2, 0..1, _, _, _] for a 5d |
06:55:28 | FromGitter | <mratsim> this is equivalent to Numpy a[2, 0:2, …] |
07:01:30 | * | Vladar joined #nim |
07:03:29 | user1101 | In Go, there |
07:03:39 | user1101 | is a golang plugin system, https://medium.com/learning-the-go-programming-language/writing-modular-go-programs-with-plugins-ec46381ee1a9 |
07:03:57 | user1101 | This is used to write modular software applications |
07:04:05 | user1101 | Anything similar in Nim? |
07:04:47 | FromGitter | <mratsim> a shared lib? |
07:05:05 | user1101 | simply put, yes |
07:06:16 | FromGitter | <mratsim> --app:console|gui|lib|staticlib |
07:08:12 | FromGitter | <mratsim> I don’t know how nim libraries work with generics though |
07:09:21 | FromGitter | <mratsim> if we could generate foo_int64, foo_int32, …. with a pragma that would be awesome |
07:11:46 | * | brainproxy quit (Ping timeout: 264 seconds) |
07:16:33 | * | rockcavera quit (Ping timeout: 240 seconds) |
07:18:30 | * | brainproxy joined #nim |
07:24:38 | FromGitter | <narimiran> > @miran ellipsis is used like this a[2, 0..1, `…`] which would mean a[2, 0..1, _, _] for a 4d tensor for example or a[2, 0..1, _, _, _] for a 5d ⏎ ⏎ @mratsim ok, you're looking to replace numpy's `...` with something more "nim-like", and to be not-so-similar to the existing `..` in nim |
07:25:10 | FromGitter | <mratsim> actually no, the issue is that I’m limited to Nim “identifiers" |
07:25:25 | FromGitter | <mratsim> so, a-zA-z0-1 and ___ |
07:25:40 | FromGitter | <mratsim> every special symbol needs quotation to be an identifier |
07:25:52 | FromGitter | <mratsim> 0-9* |
07:26:00 | FromGitter | <narimiran> neo uses `All`, can you maybe use that? |
07:26:02 | FromGitter | <mratsim> so maybe ___ is the best |
07:26:23 | FromGitter | <mratsim> I think neo “All” is equivalent to _ |
07:26:29 | FromGitter | <narimiran> but now that i think, neo's `All` might be yours `_` |
07:26:31 | FromGitter | <mratsim> but maybe I can use Rest |
07:27:19 | FromGitter | <narimiran> what about `:`? too confusing? |
07:27:34 | FromGitter | <mratsim> can’t, not a Nim identifier and not allowed in quote |
07:28:32 | FromGitter | <mratsim> or “ellipsis” in plain text mmm |
07:28:49 | FromGitter | <narimiran> > so maybe ___ is the best ⏎ ⏎ well, if you're limited only to alphanumerics and underscores, this might be the way to go.... |
07:28:59 | FromGitter | <narimiran> > or “ellipsis” in plain text mmm ⏎ ⏎ `etc`? |
07:29:11 | FromGitter | <mratsim> interesting |
07:30:04 | FromGitter | <mratsim> maybe Etc so that it’s not confused with a variable |
07:30:31 | FromGitter | <narimiran> or can your `All`, in contrast to neo, mean "all the other axes"? (as you have `_` to mean "all elements of that axis") |
07:31:16 | FromGitter | <mratsim> I think it’s a bad idea for people converting to/from each library |
07:31:24 | * | r3d9u11 joined #nim |
07:31:35 | FromGitter | <narimiran> true |
07:33:59 | FromGitter | <narimiran> well, neo is only 2d (correct me if i'm wrong), arraymancer is multidimensional - `All` could be interpreted "all the rest" in both cases - in neo's case that's only one dimension, and in AM's case it might be more than one dimension :) |
07:34:51 | FromGitter | <narimiran> (it's 8 am here, better ideas might come up as i'm more awake than i'm now :)) |
07:37:08 | FromGitter | <mratsim> I’ll open a RFC later |
07:38:14 | FromGitter | <narimiran> i did propose `Etc` but now i'm thinking if that's correct choice, because `a[5..7, Etc]` might be interpreted as `a[5..7, 5..7, 5..7, ...]`(from wikipedia: "[etc} is a Latin expression that is used in English to mean "and other similar things", or "and so forth"") |
07:39:48 | FromGitter | <narimiran> on the other hand `All` cannot be interpreted as `5..7` |
07:51:26 | * | brainproxy quit (Ping timeout: 245 seconds) |
07:59:11 | * | yglukhov joined #nim |
08:00:46 | * | yglukhov quit (Read error: Connection reset by peer) |
08:01:00 | * | brainproxy joined #nim |
08:01:22 | * | yglukhov joined #nim |
08:22:15 | * | r3d9u11 quit (Remote host closed the connection) |
08:23:44 | * | PMunch joined #nim |
08:23:59 | * | jjido joined #nim |
08:34:13 | * | brainproxy quit (Ping timeout: 240 seconds) |
08:34:47 | * | rokups joined #nim |
08:38:35 | * | brainproxy joined #nim |
08:42:11 | * | smt joined #nim |
08:46:09 | * | arecaceae quit (Remote host closed the connection) |
08:46:32 | * | arecaceae joined #nim |
08:53:42 | * | xkapastel quit (Quit: Connection closed for inactivity) |
08:57:12 | FromGitter | <abijahm> hello guys is this supposed to behave this way ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ab21e6827c509a77488c4c9] |
08:58:05 | leorize | abijahm: file a bug for it. |
09:03:01 | euantor | @abijahm: Make `lib` a `const` |
09:11:37 | * | brainproxy quit (Ping timeout: 256 seconds) |
09:15:16 | * | brainproxy joined #nim |
09:24:26 | FromGitter | <abijahm> @euantor i want to load it conditionaly at run time ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ab224cabb1018b37a0b5cf3] |
09:26:53 | euantor | @abijahm Ok, you'll need to use the `dynlib` module then: https://nim-lang.org/docs/dynlib.html |
09:27:49 | euantor | You first load the DLL with `loadLib`, then use `symAddr` to get the address for a function and cast that to the function signature you need |
09:28:27 | euantor | You can only use the `dynlib` pragma with a compile time constant as it generates the code you need at compile time (as far as I understand) |
09:29:08 | FromGitter | <mratsim> @miran maybe ___ is enough for ellipsis |
09:36:50 | * | hoijui joined #nim |
09:49:38 | FromGitter | <abijahm> @euantor thanks ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ab22ab2bb1018b37a0b7a17] |
09:50:48 | FromGitter | <narimiran> @mratsim well, `___` will go nicely with the current `_` |
09:54:35 | * | yglukhov quit (Remote host closed the connection) |
09:55:09 | * | yglukhov joined #nim |
09:59:46 | * | yglukhov quit (Ping timeout: 264 seconds) |
10:04:35 | * | floppydh quit (Read error: Connection reset by peer) |
10:05:04 | FromGitter | <Araq> we actually had some support for runtime 'dynlib' pragma but it rotted |
10:05:24 | * | floppydh joined #nim |
10:07:25 | * | yglukhov joined #nim |
10:14:24 | * | leorize quit (Remote host closed the connection) |
10:14:56 | FromGitter | <euantorano> Interesting @Araq, how on earth did that work? |
10:15:36 | FromGitter | <euantorano> I'm going to add some documentation to the `dynlib` module to basically show what @abijahm ended up doing, as it may not be clear for newcomers |
10:16:42 | FromGitter | <Araq> some codegen hack I don't remember |
10:20:07 | FromGitter | <wu-lee> Greetings. Can anyone provide any alternative answers to my Nim question here? https://stackoverflow.com/questions/49396029 |
10:24:11 | * | hoijui quit (Quit: Leaving) |
10:26:45 | FromGitter | <mratsim> template pos() = game.ball[ix].pos |
10:31:41 | FromGitter | <wu-lee> @mratsim interesting... I will go and read up on that, but perhaps you could elaborate? |
10:32:32 | FromGitter | <Araq> template pos(): untyped = game.ball[ix].pos |
10:33:10 | PMunch | euantorano, I was considering to write a macro to more easily do dynlib loading. |
10:33:40 | euantor | @PMunch That might be nice, it's fairly common |
10:33:47 | PMunch | And look at what a Nim host and Nim dynlib system would look like |
10:34:21 | PMunch | euantor, yeah. And the regular loading dance is a bit tedious. Would be nice to have something simpler |
10:36:44 | FromGitter | <coffeepots> @wu-lee templates are inserted at the call site, so if you can replace long sections of repeated code with a template and it will act as if you typed all the code |
10:38:09 | FromGitter | <wu-lee> @Araq, @mratsim - just to be clear, `template pos()`creates a literal substituting alias for the expression `game.ball[ix].pos`, and so I infer that the look-up/indexing/whatever is therefore still performed on each usage, unlike a let* alias? |
10:38:57 | FromGitter | <Araq> yes. usually compilers have CSE though. |
10:39:24 | FromGitter | <Araq> (Nim doesn't but the C compiler does) |
10:46:33 | FromGitter | <wu-lee> Ok (had to look up "common subexpression elimination"). Is the `ptr` solution suggested in the answer on SO a safe alternative or best avoided? |
10:47:10 | FromGitter | <Araq> better avoid it. |
10:47:11 | PMunch | Generally ptr should be avoided |
10:47:19 | FromGitter | <coffeepots> @wu-lee you can even set up a template that makes a template so you can access stuff ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5ab238375f188ccc15ddc644] |
10:48:46 | FromGitter | <wu-lee> @coffeepots Cool. I'll post these answers on SO, assuming no-one prefers to do it themselves? |
10:49:02 | PMunch | I'm writing up a more in-depth answer right now wu-lee :) |
10:49:26 | FromGitter | <wu-lee> Thanks :) |
10:49:26 | PMunch | Trying to get some good quality answers on SO so that people will have an easier time learning Nim :) |
10:49:44 | PMunch | I even subscribed to the #nim tag so I get daily e-mails about questions |
10:50:22 | FromGitter | <wu-lee> Is there a way to make the ptr solution safe through templates? |
10:55:46 | FromGitter | <Araq> I think it requires a macro |
10:55:56 | FromGitter | <Araq> I made a youtube video about it iirc |
10:56:34 | FromGitter | <Araq> the trick is not directly expose the 'pos' alias so it can't escape accidentically |
10:56:52 | FromGitter | <Araq> something like |
10:57:13 | FromGitter | <Araq> alias game.renderer.ball[ix].pos: |
10:57:20 | FromGitter | <Araq> @x = 45 |
10:57:25 | FromGitter | <Araq> @y = 4 |
10:58:10 | FromGitter | <Araq> so you can access fields but not the whole object |
10:59:16 | FromGitter | <wu-lee> I suppose a macro could create an anonymous function binding too (although I can see problems with that) |
11:03:22 | * | Snircle joined #nim |
11:03:42 | * | floppydh_ quit (Ping timeout: 256 seconds) |
11:04:37 | Yardanico | I wonder when VSCode devs will fix this one - https://github.com/Microsoft/vscode/issues/36630 ( someone made an issue about it again - https://github.com/nim-lang/Nim/issues/7389 ) |
11:05:30 | Yardanico | ah lol, it's a win10 bug |
11:06:39 | FromGitter | <mratsim> You can use a template o do that: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ab23cbf26a769820b2af137] |
11:07:02 | dom96 | Wow, a Windows bug |
11:07:03 | dom96 | Nice |
11:07:21 | FromGitter | <mratsim> use ⏎ ⏎ ```withAlias pos, game.renderer.ball[ix].pos: ⏎ coolStuffHappebHere(pos)``` [https://gitter.im/nim-lang/Nim?at=5ab23ce92dfcfffd2b2bac0d] |
11:07:58 | * | dddddd joined #nim |
11:08:27 | * | SenasOzys joined #nim |
11:14:57 | FromGitter | <alehander42> yeah, I found I can often map python's context managers to simple macros/templates |
11:17:27 | dom96 | PMunch: beautiful answer |
11:17:36 | PMunch | dom96, thanks :) |
11:17:44 | dom96 | Perhaps we should add that 'alias' template into the stdlib? :) |
11:19:12 | FromGitter | <Araq> not unless you rename 'future.nim' into 'sugar.nim' |
11:20:08 | FromGitter | <mratsim> ^ +1 |
11:20:41 | FromGitter | <alehander42> I'd love sugar.nim, no sarcasm |
11:22:46 | PMunch | Same, seems a lot less "beware, here be dragons" than future. |
11:22:58 | PMunch | Speaking of adding things to the standard library: https://github.com/nim-lang/Nim/issues/7369#issuecomment-374390030 |
11:25:18 | FromGitter | <coffeepots> @PMunch it'd be nice to have a few more debugging nicities in Nim, maybe in a separate module specifically for debugging |
11:25:34 | FromGitter | <coffeepots> I would put dump in there too |
11:25:54 | * | jjido quit (Ping timeout: 260 seconds) |
11:26:09 | PMunch | coffeepots, yeah maybe that would be a way to do it |
11:26:11 | PMunch | dump? |
11:26:32 | FromGitter | <coffeepots> https://nim-lang.org/docs/future.html#dump.m,typed |
11:27:00 | FromGitter | <coffeepots> could even have a version that outputs line number too |
11:27:03 | PMunch | Huh, that's pretty neat |
11:28:06 | FromGitter | <coffeepots> yeah it's really useful! Not sure on the name 'dump' lol, but it's way better than ⏎ ⏎ ```echo "this is mah outputs: ", x``` [https://gitter.im/nim-lang/Nim?at=5ab241c65f188ccc15ddf3b4] |
11:36:15 | FromGitter | <wu-lee> @araq or anyone who knows, got the link to the video writing an alias macro? Also for posting on SO. |
11:46:02 | * | gokr joined #nim |
11:51:43 | FromGitter | <Araq> https://www.youtube.com/watch?v=EC9zCXlvY2k |
11:58:04 | * | leorize joined #nim |
11:59:46 | * | floppydh_ joined #nim |
12:02:45 | * | arnetheduck joined #nim |
12:11:38 | * | floppydh_ quit (Quit: WeeChat 2.0.1) |
12:23:22 | * | floppydh_ joined #nim |
12:34:01 | * | gokr left #nim (#nim) |
12:34:05 | * | athenot joined #nim |
12:39:59 | * | vlad1777d quit (Ping timeout: 260 seconds) |
12:42:50 | * | nsf quit (Quit: WeeChat 2.0.1) |
13:08:04 | * | sz0 joined #nim |
13:11:27 | shashlick | is it possible to identify all procs and their parameters in an imported module during compile time? |
13:25:58 | * | athenot quit (Remote host closed the connection) |
13:26:43 | * | athenot joined #nim |
13:28:53 | * | arnetheduck quit (Ping timeout: 256 seconds) |
13:33:23 | PMunch | shashlick, very good question |
13:52:49 | * | endragor quit (Remote host closed the connection) |
13:53:17 | * | endragor joined #nim |
13:55:10 | * | endragor_ joined #nim |
13:55:25 | * | leorize quit (Remote host closed the connection) |
13:57:47 | * | rockcavera joined #nim |
13:57:57 | * | endragor quit (Ping timeout: 264 seconds) |
13:58:15 | FromGitter | <zacharycarter> if I have a proc that takes a vararg[int] as a parameter and I want to call it - but I want to pass let's say a range of ints from 7 to 12 |
13:58:33 | FromGitter | <zacharycarter> is there any easier / shorter way to call the proc than proc(7, 8, 9, 10, 11, 12) |
13:58:35 | FromGitter | <zacharycarter> ? |
13:59:48 | * | endragor_ quit (Ping timeout: 256 seconds) |
14:01:27 | FromGitter | <Araq> only a macro can do that |
14:01:49 | FromGitter | <zacharycarter> okay - thanks |
14:02:41 | FromGitter | <alehander42> isn't there something like an `apply` macro in stdlib |
14:02:55 | FromGitter | <alehander42> I think it's popular in functional langs |
14:08:04 | * | endragor joined #nim |
14:08:05 | * | solitudesf quit (Ping timeout: 248 seconds) |
14:09:41 | * | xet7 quit (Quit: Leaving) |
14:10:14 | * | solitudesf joined #nim |
14:10:31 | FromGitter | <Araq> macros.unpackVarargs ? |
14:10:59 | FromGitter | <Araq> but that doesn't unpack 7..12 |
14:12:13 | * | endragor quit (Ping timeout: 240 seconds) |
14:12:59 | PMunch | Hmm, maybe varargs should accept iterators as well |
14:13:03 | PMunch | That would be cool |
14:14:32 | PMunch | So a "proc hello(x: varargs[char])" could be called with 'hello("test".items)' |
14:14:43 | PMunch | Well, if strings have an items iterator |
14:14:44 | * | leorize joined #nim |
14:14:59 | PMunch | Ah it does |
14:16:55 | * | nsf joined #nim |
14:19:46 | * | girvo quit (Ping timeout: 245 seconds) |
14:20:55 | * | girvo joined #nim |
14:30:47 | * | skelett joined #nim |
14:32:02 | * | skelett quit (Client Quit) |
14:32:36 | * | skelett joined #nim |
14:37:18 | * | sendell joined #nim |
14:42:15 | * | jjido joined #nim |
14:42:52 | * | birdspider joined #nim |
14:48:19 | * | tiorock joined #nim |
14:48:19 | * | rockcavera is now known as Guest35778 |
14:48:19 | * | tiorock is now known as rockcavera |
14:51:13 | * | Guest35778 quit (Ping timeout: 240 seconds) |
14:53:22 | * | gokr joined #nim |
14:54:13 | * | rbrt joined #nim |
14:57:01 | * | rbrt quit (Client Quit) |
14:59:54 | * | gokr quit (Quit: Leaving.) |
15:00:32 | skelett | Hi, is there a way to have a garbage collected value stored inside a runtime constant (file) global variable in a gcsafe way? Something like `let foo = "foo"` |
15:02:50 | PMunch | It sounds like you're trying to solve a problem the wrong way |
15:02:54 | PMunch | What do you want to do? |
15:05:51 | * | leorize quit (Ping timeout: 246 seconds) |
15:06:01 | skelett | I'm building a large string from various sources including environment variables (so compiletime is not workung unfortunately) which will be used by a couple of functions. So I thought that it might be cheaper to store that string in a file local variable and access it from the functions. |
15:06:45 | skelett | And because it is never changed after creation I wanted to have it constant. |
15:07:33 | * | rbrt joined #nim |
15:07:53 | FromGitter | <Araq> let foo = "..." |
15:08:01 | skelett | and making it a threadvar will prevent me from making it constant and duplicate it for every heap (?) |
15:08:04 | FromGitter | <Araq> proc read() = |
15:08:11 | FromGitter | <Araq> {.gcsafe.}: |
15:08:27 | FromGitter | <Araq> echo unsafeAddr(foo)[] |
15:09:33 | dom96 | It'd sure be nice if a constant threadvar was supported |
15:09:45 | dom96 | Is there a reason this isn't supported? |
15:10:25 | * | dddddd quit (Ping timeout: 248 seconds) |
15:10:28 | FromGitter | <Araq> certainly. The GC doesn't care about constantness. Thread unsafe write barriers would introduce races |
15:11:08 | FromGitter | <Araq> oh I misread. that was the reply to sharing constants. |
15:11:33 | dom96 | I don't see the issue with implicitly initialising the variable in each thread |
15:11:38 | FromGitter | <Araq> constant threadvars are not vars, so I'm not sure what you mean |
15:12:49 | skelett | I think he's talking about sth like this: `let foo {.threadvar.} = "asdf" instad of `var foo {.threadvar.}: string; foo = "asdf"` |
15:13:07 | * | rbrt quit (Quit: Oíche mhaith) |
15:14:24 | skelett | Araq: is there a reason for this `unsafeAddr()[]`? The warning about gc safety already disappears when i put the read inside the gcsafe block |
15:14:49 | skelett | s/is there a/what is the/ |
15:15:47 | FromGitter | <Araq> I wrote this to teach you more features |
15:15:49 | FromGitter | <Araq> ;-) |
15:16:15 | FromGitter | <Araq> sometimes you need this to avoid the copies |
15:17:01 | * | sz0 quit (Quit: Connection closed for inactivity) |
15:17:10 | skelett | > I wrote this to teach you more features |
15:17:14 | skelett | Always appreciated! |
15:17:20 | skelett | Thanks! |
15:17:48 | FromGitter | <Araq> let foo {.threadvar.} = "foo" would require more compiler support for threading. previous attempst to introduce this produced bad soluitons inviting racy code |
15:18:22 | FromGitter | <Araq> but it's something to consider. in principle it seems sound. |
15:18:45 | dom96 | good :) |
15:19:15 | FromGitter | <Araq> so ... everybody happy with the future->sugar rename? |
15:22:42 | FromGitter | <narimiran> makes sense :) |
15:23:13 | FromGitter | <alehander42> future->sugar is good, does it mean it will be open for new candies? |
15:23:22 | FromGitter | <Araq> exactly |
15:23:58 | FromGitter | <Araq> but 'lc' should be deprecated, right? it's just too alien |
15:24:05 | * | dddddd joined #nim |
15:24:44 | dom96 | but will => still make it into system? |
15:24:46 | PMunch | What? What's wrong with list comprehension? |
15:24:52 | FromGitter | <narimiran> `lc` as it is, is ugly :) |
15:25:33 | FromGitter | <Araq> @dom96: I'm not sure if system.nim can import macros |
15:25:41 | FromGitter | <Araq> and I don't want more stuff in system anyway |
15:25:41 | FromGitter | <narimiran> +1 to make `=> ` a standard syntax, if possible |
15:25:51 | FromGitter | <Araq> plus I don't like it :P |
15:26:14 | FromGitter | <cabhishek> future->sugar rename will be backwards compatible? |
15:26:24 | FromGitter | <Araq> future.nim: |
15:26:28 | FromGitter | <Araq> include sugar |
15:26:35 | FromGitter | <Araq> {.deprecated.} |
15:26:40 | PMunch | Yeah |
15:27:14 | FromGitter | <alehander42> I never used `lc` but it looks interesting, do people use it? |
15:27:34 | PMunch | What about the debug stuff me and coffeepots was talking about? Any chance of a debug module in the stdlib? Or debuginfo or any other applicable name |
15:27:40 | FromGitter | <alehander42> it would be cool to have some kind of tool that checks how much a type/method/macro is used in github nim libs :D |
15:28:00 | FromGitter | <Araq> I'm sure 'lc' is used |
15:28:08 | FromGitter | <narimiran> @alehander42 i have used in the first weeks of my nim journey, as i wanted to have more or less 1:1 translation of my python code |
15:28:16 | FromGitter | <Araq> it's the closest thing we have to Python's list comprehensions |
15:28:18 | FromGitter | <narimiran> after that, i stopped using it :) |
15:28:24 | * | xet7 joined #nim |
15:28:53 | dom96 | Araq: meh alright. |
15:28:57 | FromGitter | <alehander42> I find mapIt & filterIt better, but I preferred ruby's enumerable compared to Python's comprehensions too :D |
15:29:31 | FromGitter | <narimiran> @alehander42 yeah, `mapIt` is much nicer |
15:35:25 | * | nsf quit (Quit: WeeChat 2.0.1) |
15:42:52 | * | xkapastel joined #nim |
15:44:25 | FromGitter | <Araq> can we get some feedback on https://github.com/nim-lang/Nim/pull/7367 ? I don't know much about the android target |
15:45:47 | * | floppydh quit (Remote host closed the connection) |
15:46:14 | skelett | I always get a "shadowed identifier: 'result'" when using one of the *It templates |
15:46:36 | * | floppydh joined #nim |
15:48:13 | shashlick | dom96: I see you have a copy of setupVM() in nimble - I'm looking at adding the rest of the os module procs into nimscript - will I have to port it into nimble as well? |
15:53:13 | dom96 | It would be nicer to reuse the Nim code |
15:53:17 | dom96 | Not sure why setupVM was copied |
15:53:49 | dom96 | This comment explains it a little: https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/nimscriptsupport.nim#L79 |
15:54:29 | * | dom96 wonders why these "callbacks" are registered as `stdlib.system` and not `stdlib.os` |
15:55:25 | FromGitter | <Araq> because they are not in os, but in nimscript which is an include file for system |
15:55:47 | FromGitter | <Araq> it's not about where it "comes from", but where to "inject" into |
16:00:14 | shashlick | that's why I asked this question: is it possible to identify all procs and their parameters in an imported module during compile time? |
16:00:44 | shashlick | that way, we can have a generic macro that can import in stuff into the VM from any module |
16:00:49 | FromGitter | <Araq> by design Nim's compile-time mechanisms don't allow access to the symbol table |
16:01:01 | shashlick | it could solve the FFI limitation as well |
16:01:14 | FromGitter | <Araq> you can do parseStmt(slurp"lib/pure/os.nim") |
16:01:36 | FromGitter | <Araq> but I'm not a fan of this :P |
16:02:00 | FromGitter | <Araq> note that we allow getHomeDir() at compile-time and it produced bugs |
16:02:05 | * | rauss joined #nim |
16:02:14 | FromGitter | <Araq> producing binaries that only run on one machine |
16:02:50 | shashlick | that's what I'm thinking - instead of adding each function, just to load up the file, evaluate what procs are in it along with the data types and create corresponding procs in the VM |
16:03:36 | FromGitter | <Araq> note that I wrote the VM's support for the FFI twice. |
16:04:03 | FromGitter | <Araq> it always "Kind of works" until it doesn't. |
16:05:51 | shashlick | so with this parseStmt() method above, you still need to inspect the AST and generate corresponding code for the VM right? |
16:05:57 | * | miran joined #nim |
16:06:21 | FromGitter | <Araq> and Nim has too many of these semi-broken features, sometimes "we don't support it" is better than "er, there are dragons here" |
16:06:43 | FromGitter | <Araq> yes for your question. |
16:07:26 | shashlick | so I feel we could get by with just adding some more procs from OS for now and deal with https://gist.github.com/genotrance/cc575b760428289586e141f2ef64c3ba |
16:07:44 | shashlick | that will add a bunch of supported functionality into the VM |
16:08:16 | shashlick | but i'm wondering if this should be done dynamically - i'm lazy that way |
16:08:48 | FromGitter | <Araq> it's not clear to me what you are doing. I thought you only wanted to document what already works :P |
16:09:46 | shashlick | sorry that's the wrong link - this instead https://github.com/nim-lang/Nim/issues/7383 |
16:09:59 | shashlick | which is just adding test cases and documentation, no new code - yes |
16:10:07 | shashlick | also am looking at adding more os procs into nimscript |
16:10:21 | * | rbrt joined #nim |
16:10:30 | shashlick | but if we can get many more modules enabled with this dynamic method, I'm happy to look into it |
16:10:57 | FromGitter | <Araq> it is an interesting experiment. |
16:11:14 | FromGitter | <Araq> another thing to consider is to add a 'vm' target to the testament tester |
16:11:51 | FromGitter | <Araq> so collection tests etc can simply be reused like 'targets: "c cpp js vm" ' in the spec section |
16:12:04 | FromGitter | <Araq> or added to categories.nim |
16:12:59 | shashlick | ya but the test cases are not really focused - the ttables test case has sharedtables stuff in it |
16:13:09 | shashlick | so you cannot use it as is |
16:14:45 | FromGitter | <Araq> well often we modify tests instead of adding new ones so that travis and appveyor can run all the tests within their time budgets |
16:15:26 | FromGitter | <Araq> not ideal but at least it's "green" |
16:21:00 | shashlick | okay I'll try out the parseStmt+slurp experiment and see how it works |
16:21:57 | shashlick | did you have any guidance on #7383? just want to make sure there's no specific reason for limiting the list of VM supported modules besides test |
16:23:50 | FromGitter | <Araq> hmm not sure what you're asking about. Update the documenation and the tests at the same time incrementally and create PRs. |
16:24:13 | FromGitter | <Araq> unicode and the collections are most important, I think |
16:24:15 | shashlick | cool |
16:25:22 | FromGitter | <Araq> note thate some modules like terminal have very different Windows<->posix paths |
16:25:45 | FromGitter | <Araq> so what works in the VM on one OS might fail on some other OS |
16:26:04 | FromGitter | <Araq> but we'll tell you in the review process anyway |
16:26:27 | shashlick | will keep that in mind, i'll try on Windows and Ubuntu before PRs |
16:27:44 | shashlick | ok, another question - to use nim as a scripting language - i.e. VM mode, do you need the same set of files (full stdlib dir, nimble, etc.) or is it a shorter list? I presume you don't need a C compiler at least |
16:28:25 | FromGitter | <alehander42> why couldn't fucking "checked" be bool, html standard ⏎ Araq , are there any helpers in karax for conditionally including in a tag stuff like `checked` ? |
16:29:51 | FromGitter | <Araq> karax.toChecked proc? |
16:30:42 | FromGitter | <Araq> shashlick you need system.nim lib/system/ and what you made accessible. you get set the search path via the API |
16:31:14 | FromGitter | <Araq> you can compile these into your binary too but I don't know how :-) |
16:31:58 | FromGitter | <alehander42> ah, so `nil` actually will be the same as leaving it out, incredible |
16:32:00 | FromGitter | <alehander42> thanks |
16:32:19 | FromGitter | <Araq> you can also come up with a reduced system.nim, the compiler is somewhat helpful when you get it wrong |
16:32:19 | shashlick | will be cool to ship a smaller "scripting build" of nim with minimal dependencies, okay will stop dreaming for now |
16:33:41 | shashlick | I know you have getBool(), getInt(), etc. in typeinfo, how do you get other data types? |
16:33:50 | shashlick | openarray or some custom type? |
16:33:57 | FromGitter | <Araq> a more modular system.nim, be my guest. I think we're at a point where it has full test coverage |
16:35:36 | * | Trustable joined #nim |
16:36:08 | shashlick | why do you need system.nim and lib/system? that should be built into nim.exe right? |
16:36:10 | FromGitter | <Araq> hmm? ntyOpenArray? |
16:36:33 | FromGitter | <Araq> it's not |
16:36:57 | shashlick | oh actually nim binary will be stuff in the compiler, makes sense |
16:39:37 | shashlick | okay I have some good guidance, will keep you posted on my progress - any particular module I should focus on or is os.nim a good enough start? |
16:40:53 | FromGitter | <Araq> os.nim is probably harder than others |
16:42:11 | shashlick | okay |
16:44:13 | shashlick | by the way, if a module is included at say "stdlib.os" via registerCallback, do you have to "import os" or is it automatically available? also, if you "import os" does it use the callback or look for the module on the filesystem? |
16:47:59 | FromGitter | <Araq> the import is still required |
16:48:18 | FromGitter | <Araq> the bytecode generator the VM uses intercepts the registered calls |
16:48:36 | FromGitter | <Araq> and produces an opcode that calls into the supplied callback |
16:48:50 | shashlick | cool beans, so in theory it's possible to pull in all modules into the VM with no external file dependencies |
16:48:54 | FromGitter | <Araq> that is also why this mechanism takes no type signatures |
16:49:23 | FromGitter | <Araq> the type signatures are still taken from the real .nim code file, so to speak. |
16:49:59 | FromGitter | <Araq> > so in theory it's possible to pull in all modules into the VM with no external file dependencies ⏎ er, no, that's not why I said. I said the opposite. |
16:50:46 | skelett | btw: I _really_ love that functions in `times` have now less verbose names! |
16:51:09 | FromGitter | <Araq> I love that I can trust times now ;-) |
16:52:13 | skelett | :D |
16:52:30 | * | rbrt quit (Quit: Oíche mhaith) |
16:53:58 | * | askatasu1 quit (Quit: WeeChat 1.9) |
16:55:11 | FromGitter | <Araq> btw if you understand why ``opcCallbackCall`` would not work in Nim's VM, you have a pretty good understanding of programming languages ;-) |
16:55:29 | * | askatasu1 joined #nim |
16:55:43 | * | askatasu1 quit (Client Quit) |
16:56:01 | skelett | Online documentation of parseopt2 does not say that it's a deprecated module |
16:56:39 | * | jjido quit (Remote host closed the connection) |
16:57:20 | * | nsf joined #nim |
16:58:54 | shashlick | Are you saying the info is pulled at compile time or script run time |
16:59:35 | FromGitter | <Araq> at script compile-time ? |
16:59:53 | FromGitter | <Araq> lexer -> parser -> sem'check -> vmgen -> vm |
16:59:58 | FromGitter | <Araq> is the pipeline |
17:00:11 | FromGitter | <Araq> your registered callbacks only affect vmgen and vm |
17:00:56 | FromGitter | <Araq> which is why the .nim files are important. in some sense the vmgen patches the proc's body |
17:04:12 | FromGitter | <pr-yemibedu> this smells a lot like reader from (lex, parse, sem check) and eval from (vmgen, vm) ... |
17:04:32 | skelett | Araq: Is there a general rule, when I can say `{.gcsafe.}` (except from "if it's safe")? |
17:05:02 | shashlick | I see, so the VM is not built into the Nim binary |
17:05:23 | FromGitter | <Araq> lisp holds no patents on basic compiler technology |
17:06:02 | FromGitter | <Araq> shashlick. the VM is built into the Nim binary. if you import it (which the compiler does). |
17:06:26 | FromGitter | <pr-yemibedu> that is true. I never used that wording for a reason. but the when it comes to programming, the logic tends to converge into similar ideas eventually. |
17:07:28 | FromGitter | <pr-yemibedu> and it is a good smell btw. |
17:09:24 | shashlick | So what I was thinking was that we could inject the procs from select stdlib modules into the VM at Nim compile time |
17:09:46 | shashlick | That way, those modules would be available to the script at script compile time |
17:11:01 | * | SenasOzys_ joined #nim |
17:11:17 | shashlick | You don't need to ship those files in script mode then, and perhaps script compile time will be faster too |
17:12:27 | FromGitter | <pr-yemibedu> you want to get a *core* subset as proper a built in set of features? with macros? |
17:14:10 | * | SenasOzys quit (Ping timeout: 264 seconds) |
17:16:11 | * | birdspider quit (Remote host closed the connection) |
17:16:53 | shashlick | I just want more Nim stdlib in the VM, that way you can do more fun stuff in macros and in nims scripts |
17:17:41 | FromGitter | <Araq> sorry, have to go, will explain more later. |
17:18:32 | shashlick | Shipping a more capable script mode with a minimal Nim interpreter so to speak will compete well with python |
17:19:38 | shashlick | Makes distribution of scripts and apps easier, don't need to build binaries for every OS you want to support |
17:21:35 | shashlick | Thanks Araq |
17:22:55 | skelett | kk;w |
17:23:05 | skelett | sry |
17:27:57 | * | floppydh_ quit (Ping timeout: 264 seconds) |
17:32:39 | * | PMunch quit (Quit: Leaving) |
17:37:53 | * | MightyJoe quit (Read error: Connection reset by peer) |
17:39:02 | * | cyraxjoe joined #nim |
17:43:16 | * | sendell quit (Remote host closed the connection) |
18:00:15 | * | natrys joined #nim |
18:06:21 | * | MJCaley joined #nim |
19:03:41 | * | adeohluwa joined #nim |
19:12:18 | * | athenot quit (Remote host closed the connection) |
19:13:06 | * | athenot joined #nim |
19:14:44 | FromGitter | <AjBreidenbach> is there a way to pass an anonymous proc into a macro? |
19:23:37 | FromGitter | <coffeepots> Is there an RFC for a debugging module yet? |
20:03:07 | * | athenot_ joined #nim |
20:03:37 | * | athenot quit (Read error: Connection reset by peer) |
20:12:53 | FromGitter | <mratsim> @AjBreidenbach you can pass anything to a macro except non-valid Nim identifiers (like : or … ) |
20:13:30 | FromGitter | <mratsim> @coffeepots Endb is looking for maintainers: https://nim-lang.org/docs/endb.html |
20:14:16 | FromGitter | <coffeepots> @mratsim I was thinking more of just a module with useful debugging routines :D |
20:14:56 | FromGitter | <mratsim> Currently my debugging routine is dumpTree and dumpASTgen :D |
20:15:15 | FromGitter | <coffeepots> If there's one in discussion atm I'll add to it, if not I might start one |
20:16:49 | brainproxy | macOS, use emacs for most things, but nim-mode seems erratic... recommendations on a different editor which has great nim support |
20:16:51 | brainproxy | ? |
20:16:55 | FromGitter | <coffeepots> Yeah same here, and a modified 'debug' from here https://nim-lang.org/docs/manual.html#macros-expression-macros |
20:17:13 | FromGitter | <coffeepots> would be nice to have a dump memory routine as well and some other bits and bobs |
20:18:16 | FromGitter | <coffeepots> maybe i'll just start one as a nimble lib :) |
20:33:11 | * | rockcavera quit (Remote host closed the connection) |
20:39:18 | shashlick | brainproxy: I've had very good results with vscode and vim |
20:41:02 | * | Trustable quit (Remote host closed the connection) |
20:46:33 | * | natrys quit (Ping timeout: 264 seconds) |
20:49:45 | * | athenot_ quit (Remote host closed the connection) |
20:50:32 | * | rokups quit (Quit: Connection closed for inactivity) |
20:50:40 | * | athenot joined #nim |
20:50:43 | adeohluwa | hello guyz |
20:51:23 | adeohluwa | brainproxy: I use sublime text... fast & fast & errm fast |
20:52:36 | adeohluwa | is there an inbuilt way to compose a function n times ? |
20:52:41 | * | miran quit (Quit: Konversation terminated!) |
20:53:34 | adeohluwa | someone suggested something on stackoverflow I thought was clever |
20:55:06 | adeohluwa | f * 3 as f(f(f())) |
20:56:59 | adeohluwa | meanwhile I will be writing a wrapper for twilio in nim-lang |
20:57:16 | * | natrys joined #nim |
20:58:55 | * | smt quit (Remote host closed the connection) |
20:59:36 | * | smt joined #nim |
21:01:10 | shashlick | adeohluwa: sounds like fun |
21:01:29 | * | athenot quit (Ping timeout: 255 seconds) |
21:02:04 | shashlick | i've been thinking about a REST API wrapper module, make it easy to wrap any REST API and expose a standard interface |
21:05:04 | FromGitter | <HonzsSedlomn> Hey guys, anyone can help me? I'm getting "permission denied" error while creating httpserver |
21:05:13 | FromGitter | <HonzsSedlomn> I have just that sample code from documentation |
21:14:29 | * | MJCaley quit (Quit: MJCaley) |
21:15:37 | * | nsf quit (Quit: WeeChat 2.0.1) |
21:19:46 | * | athenot joined #nim |
21:26:24 | FromGitter | <Araq> shashlick: A DSL for REST based servers would be sweet |
21:26:40 | FromGitter | <Araq> @HonzsSedlomn compile with -d:ssl |
21:27:03 | FromGitter | <Araq> and maybe check your firewall settings |
21:27:31 | * | athenot quit (Remote host closed the connection) |
21:27:34 | FromGitter | <HonzsSedlomn> I found out, that it's deprecated. I switched to asynchttpserver |
21:27:37 | FromGitter | <HonzsSedlomn> But thanks anyway |
21:27:42 | FromGitter | <Araq> oh ok |
21:28:10 | shashlick | @araq I'm getting too many ideas but limited time! |
21:28:11 | * | athenot joined #nim |
21:28:31 | FromGitter | <Araq> so ... before I forget it |
21:28:48 | FromGitter | <Araq> you seem to have a slightly wrong idea of how NimScript works. |
21:29:10 | FromGitter | <Araq> proc setCurrentDir*(...) # in os.nim |
21:29:16 | shashlick | So my question on pulling in modules code into the VM |
21:29:27 | * | natrys quit (Ping timeout: 246 seconds) |
21:29:33 | FromGitter | <Araq> = ... <body here> |
21:29:54 | FromGitter | <Araq> what you then do is to register a "hook" for os.setCurrentDir |
21:30:29 | FromGitter | <Araq> this means when the vmgen encounters a call to os.setCurrentDir, it instructs the VM to call your hook instead of the <body here> |
21:31:01 | FromGitter | <Araq> this is purely a "backend" thing, the Nim compiler does not know about os.setCurrentDir |
21:31:11 | FromGitter | <Araq> unless it reads os.nim and compiles it |
21:31:43 | FromGitter | <Araq> so that it gains knowledge about its existance and what types it takes etc |
21:32:02 | FromGitter | <Araq> this is why os.nim still must be around |
21:32:16 | FromGitter | <Araq> even if every proc in it has been registered to the vm(gen) |
21:33:00 | FromGitter | <Araq> if you do not register a hook for it, the vmgen will try to compile it to bytecode and eventually fails because the VM can't "importc" stuff |
21:33:12 | FromGitter | <Araq> clear? |
21:33:37 | shashlick | Ok so that's fine, I can still load the file and create hooks for every proc in the module |
21:33:48 | FromGitter | <Araq> yes |
21:33:56 | shashlick | I kind of jumped in understanding, thinking I could pull the implementation in as well |
21:34:30 | FromGitter | <Araq> well the hook for os.createDir calls os.createDir |
21:34:33 | FromGitter | <Araq> :-) |
21:34:56 | shashlick | Ok, so given that framework, is it fair to pull in every module in using that method? |
21:35:11 | shashlick | That's in the stdlib |
21:35:31 | FromGitter | <Araq> probably it won't scale well as it currently uses a linear search for these hooks |
21:35:48 | FromGitter | <Araq> but that should be easy to change |
21:36:17 | FromGitter | <Araq> more crucially, this mechanism doesn't allow for overloading |
21:36:48 | FromGitter | <Araq> as package.module.procname is not unambiguous |
21:37:07 | shashlick | More importantly, can this method allow importing modules and procs that use ffi? |
21:37:23 | FromGitter | <Araq> depends on what you mean |
21:37:53 | FromGitter | <Araq> os.createDir does use the FFI and will work as I outlined |
21:40:06 | shashlick | okay so we could expect most modules to work if we did it right |
21:40:31 | * | rbrt joined #nim |
21:40:46 | shashlick | so going back to overloading, if a module has multiple read() procs with different signatures, couldn't we create corresponding hooks in the VM? |
21:41:26 | FromGitter | <Araq> well currently if you set a hook for stdlib.system.read then every read in system is affected |
21:41:49 | FromGitter | <Araq> you can then use some ifs in the hook to see what overload to call |
21:42:12 | FromGitter | <Araq> but that might not be good enough and is awful to automate |
21:43:02 | FromGitter | <Araq> but frankly, what have we won if every stdlib module is in VM? Nim embraces its interop with C and C++ |
21:43:59 | shashlick | hmm, that definitely seems like an obstacle |
21:44:34 | shashlick | even if the hook was smart enough to call the right one, the signature for the hook can be only one? |
21:45:05 | shashlick | or can we have the same name with multiple signatures in the VM? |
21:45:14 | FromGitter | <Araq> no. |
21:45:50 | FromGitter | <Araq> we can extend it to allow "package.module.proc(int,int)" for example |
21:46:25 | FromGitter | <Araq> but if you want it so much better spend the time on evalffi.nim |
21:46:42 | * | gokr joined #nim |
21:46:42 | FromGitter | <Araq> which gives the VM full FFI support |
21:48:26 | shashlick | hmm, really depends on what you think is the better way to do this, but i'm also curious what you mean when you say "what have we won if ..." above |
21:49:11 | FromGitter | <Araq> I don't see the point in running a 3D shooter at compile-time |
21:49:47 | shashlick | ya, it's mainly for simple scripting and quick tasks |
21:49:54 | * | arandomperson joined #nim |
21:49:59 | shashlick | and perhaps doing more complicated things in .nimble files |
21:50:02 | FromGitter | <Araq> it depends on what you want to do |
21:50:43 | FromGitter | <Araq> 1) use the VM in your application. Then you might want to sandbox things and everything the VM supports can actually be harmful. |
21:50:45 | shashlick | but if it is possible to minimize the delta between VM and compiled, it will be really useful |
21:50:57 | shashlick | for simple tasks, there's no need to compile, link and then run |
21:51:02 | FromGitter | <Araq> 1) use the VM because it's used in the REPL |
21:51:42 | FromGitter | <Araq> then 'evalffi' seems less work and supports much more |
21:51:50 | FromGitter | <Araq> than only the stdlib. |
21:52:14 | FromGitter | <Araq> 1) use the VM because macros need to be able to use e.g. regexes |
21:52:56 | FromGitter | <Araq> then you should prioritize regexes over times.nim |
21:54:03 | shashlick | i think the biggest benefit is in macros and for quick scripts |
21:54:15 | shashlick | for quick scripts, I don't need to build a binary for each platform, just distribute the .nims and it works everywhere |
21:54:20 | FromGitter | <dgski> Hello, I am trying to understand why the following nom code does not work: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I get the following error: ... [https://gitter.im/nim-lang/Nim?at=5ab2d48c27c509a7748cac15] |
21:54:30 | * | Vladar quit (Quit: Leaving) |
21:54:56 | FromGitter | <Araq> but since we last talked I had some new ideas for evalffi so please play with that :P |
21:55:09 | shashlick | i'm not totally fascinated by a REPL, even though i used Python a lot that way |
21:55:11 | shashlick | i get the same effect with that console editor I wrote |
21:55:22 | FromGitter | <Araq> @dsgki use Log[S: static[int]; T] |
21:58:22 | shashlick | most of the time, I want to build a proc or snippet which I can later integrate into the main app, having the code in front of you, editable, and getting immediate output guiding you is good enough |
21:58:27 | shashlick | anyway, i'll look at evalffi and see if I "get" what you are doing there :) |
21:58:51 | shashlick | one other thing, what about copyMem and other memory ops, will they work in the VM with evalffi fully functional? |
21:59:34 | FromGitter | <Araq> kind of. probably needs more special casing but in theory, yes |
22:03:38 | shashlick | okay then will continue in that direction - for the near term, I'll continue to add test cases for modules that already import just fine - I'll add .nims files for various modules in some subdir in tests and invoke them within test_nimscript.nims |
22:05:15 | shashlick | when you said add a vm target to testament, what did you mean by that |
22:13:15 | * | jjido joined #nim |
22:13:40 | * | arandomperson2 joined #nim |
22:14:26 | arandomperson2 | test 1, 2, 3 |
22:14:55 | arandomperson2 | ok, now it works. so here's the question again: |
22:15:22 | arandomperson2 | why does this statement fail to compile: |
22:15:24 | arandomperson2 | let y: type("what"[0..2]) = "what"[0..2] |
22:15:33 | arandomperson2 | with thi message: main.nim(5, 35) Error: type mismatch: got (string) but expected 'char = Char' |
22:15:44 | arandomperson2 | this* |
22:18:07 | * | rauss quit (Quit: WeeChat 2.1) |
22:19:08 | * | rauss joined #nim |
22:23:33 | FromGitter | <zacharycarter> `let a: type("what"[0..2]) = 'a'` |
22:24:00 | FromGitter | <zacharycarter> !eval type("what"[0..2]) |
22:24:01 | NimBot | Compile failed: in.nim(1, 6) Error: expression 'type("what"[0 .. 2])' is of type 'type char' and has to be discarded |
22:24:17 | FromGitter | <zacharycarter> arandomlperson2 ^ |
22:24:52 | arandomperson2 | but the result of "what"[0..2] is "wha", not a char |
22:25:08 | arandomperson2 | if you bind it like: let x = "what"[0..2] |
22:25:12 | arandomperson2 | type(x) == string |
22:25:19 | arandomperson2 | and echo x => wha |
22:25:49 | FromGitter | <zacharycarter> !eval type("what"[0..2]) |
22:25:50 | NimBot | Compile failed: in.nim(1, 6) Error: expression 'type("what"[0 .. 2])' is of type 'type char' and has to be discarded |
22:25:58 | FromGitter | <zacharycarter> doesn't seem to be the case right... |
22:26:19 | FromGitter | <zacharycarter> !eval type("wha") |
22:26:20 | NimBot | Compile failed: in.nim(1, 6) Error: expression 'type("wha")' is of type 'type string' and has to be discarded |
22:26:25 | arandomperson2 | !eval echo ("what"[0..2]) |
22:26:28 | NimBot | wha |
22:26:28 | arandomperson2 | aw |
22:26:32 | arandomperson2 | oh |
22:26:36 | arandomperson2 | right. |
22:27:15 | arandomperson2 | !eval from typetraits import name; echo name type "what"[0..2] |
22:27:17 | NimBot | char |
22:27:29 | arandomperson2 | !eval from typetraits import name; let x = "what"[0..2]; echo name type x |
22:27:32 | NimBot | string |
22:27:38 | arandomperson2 | doesn't make sense to me |
22:27:48 | FromGitter | <zacharycarter> yeah :/ I'm not sure |
22:27:50 | adeohluwa | shashlick: looks like work |
22:27:51 | arandomperson2 | looks like the type inferred by the type builtin is wrong |
22:27:55 | adeohluwa | :( |
22:28:17 | adeohluwa | on checking how it was written for python |
22:28:28 | adeohluwa | tons of shit there |
22:29:09 | FromGitter | <Araq> problem is that type() prefers iterators over other interpretations |
22:29:22 | FromGitter | <Araq> not sure how exactly that works but '..' is also an iterator |
22:30:44 | FromGitter | <Araq> oh I know how it work |
22:30:47 | FromGitter | <Araq> s |
22:30:58 | FromGitter | <Araq> yeah but here. but a subtle one :P |
22:31:45 | FromGitter | <Araq> report it properly please but it's simple to fix |
22:46:10 | arandomperson2 | hmm, i see. a workaround i found is to use a template that puts the expr into a variable and returns the type of that variable. |
22:48:36 | shashlick | Adeohluwa: does twilio publish their API in some format? Like swagger? |
22:58:48 | adeohluwa | shashlick: yes there is |
22:59:38 | adeohluwa | https://www.twilio.com/docs/api |
23:09:20 | shashlick | That's not parsable, I'm asking if there's a Json it xml format or something |
23:09:29 | shashlick | Check out swagger for an example |
23:13:21 | * | arandomperson2 quit (Quit: Leaving) |
23:13:24 | * | arandomperson quit (Quit: Page closed) |
23:33:37 | adeohluwa | shashlick: you won't believe I've bn searching too |
23:33:44 | adeohluwa | I'm for *brain dead* simple |
23:48:05 | shashlick | :) |
23:51:47 | * | MJCaley joined #nim |