00:06:27 | * | cfv[m] quit (*.net *.split) |
00:06:29 | * | surma quit (*.net *.split) |
00:06:31 | * | nuxdie quit (*.net *.split) |
00:06:31 | * | JStoker quit (*.net *.split) |
00:06:31 | * | kaliy quit (*.net *.split) |
00:06:57 | * | surma joined #nim |
00:07:01 | * | nuxdie joined #nim |
00:07:04 | * | JStoker joined #nim |
00:08:01 | * | cfv[m] joined #nim |
00:34:32 | * | stefanos82 quit (Quit: Quitting for now...) |
00:51:08 | * | sz0 quit (Ping timeout: 252 seconds) |
00:54:40 | * | sz0 joined #nim |
01:03:39 | * | PrimHelios joined #nim |
01:06:26 | * | Voltist joined #nim |
01:13:59 | * | Voltist quit (Quit: Quit) |
01:32:27 | FromGitter | <zetashift> IIRC in Python you can append to a list during iteration |
01:42:47 | * | dddddd quit (Remote host closed the connection) |
01:49:19 | theelous3 | you can yeah |
01:49:25 | theelous3 | ill advised usually :D |
01:49:59 | * | lritter quit (Ping timeout: 258 seconds) |
01:52:14 | * | lritter joined #nim |
02:04:56 | * | lritter quit (Ping timeout: 258 seconds) |
02:06:56 | * | theelous3 quit (Ping timeout: 244 seconds) |
02:25:40 | * | theelous3 joined #nim |
03:08:07 | FromGitter | <kaushalmodi> how can I print the field names and their types in an object? |
03:08:27 | FromGitter | <kaushalmodi> I know of `fieldPairs`, but that accepts a variable of an object type |
03:09:11 | FromGitter | <kaushalmodi> I am trying this.. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d143357850b87037c68b054] |
03:10:00 | FromGitter | <kaushalmodi> inside that macro, I need to loop through all fields of input typeDesc `typ` and get the field names and types |
03:11:28 | FromGitter | <kaushalmodi> this is step 0 of what actually I need to do (I need to take in an object type and create a new object type which would be mostly identical to the input type, but with the types of some fields changed) |
03:15:33 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:47:52 | FromGitter | <JasperJenkins> @kaushalmodi As you may have noticed, the type of the typedesc is typedesc[Foo] not Foo. So to get the actual type you call getType again on Foo. `echo treeRepr getType(getType(typ)[1])`. |
03:49:18 | * | deech quit (Ping timeout: 252 seconds) |
04:06:49 | * | laaron joined #nim |
04:35:49 | * | nsf joined #nim |
04:45:25 | * | brakmic joined #nim |
04:49:00 | * | brakmic quit (Remote host closed the connection) |
04:49:21 | * | brakmic joined #nim |
05:13:58 | * | narimiran joined #nim |
05:22:30 | * | leorize quit (Quit: WeeChat 2.3) |
05:52:34 | * | leorize joined #nim |
06:03:17 | * | solitudesf joined #nim |
06:29:45 | * | hoijui joined #nim |
06:47:55 | FromGitter | <rokups> can we do any kind of debugging of karax webapp when it runs in the browser? |
06:48:57 | leorize | I typically `echo` and hope for the best |
06:49:08 | leorize | if you understand js then the generated code is kinda readable |
06:49:27 | leorize | so a js debugger in browser should be able to handle those |
06:49:41 | FromGitter | <rokups> this is what i feared |
06:49:51 | FromGitter | <rokups> but it must be possible using js maps i think |
06:50:14 | FromGitter | <rokups> possible in theory that is |
06:50:35 | leorize | js have a map to source function? |
06:50:49 | leorize | then probably the compiler can be made to generate the needed directives, if it haven't |
06:51:34 | FromGitter | <rokups> js debuggers support reading file.js.map or something like that. its like a json (i think) that maps source locations in js to actual source files |
06:51:45 | FromGitter | <rokups> so compiler should generate extra file with that info |
06:52:08 | FromGitter | <rokups> i know little of it, just saw it when working with typescript in one game engine |
06:53:45 | * | dwdv joined #nim |
06:57:46 | Araq | there is a PR to give us source-maps |
06:57:59 | Araq | but getStackTrace() etc works out of the box |
06:58:06 | Araq | like it does for the C backend |
06:58:39 | Araq | I had no problems debugging Karax itself |
06:58:49 | FromGitter | <rokups> i see just one PR and its adding a new example. https://github.com/pragmagic/karax isnt main repo? |
06:59:32 | * | krux02 joined #nim |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:01:14 | leorize | that's the main repo |
07:01:56 | Araq | rokups: the sourcemap PR was for Nim's JS codegen |
07:02:06 | FromGitter | <rokups> ohh |
07:04:40 | * | gmpreussner joined #nim |
07:06:16 | * | Voltist joined #nim |
07:08:12 | * | gmpreussner quit (Read error: Connection timed out) |
07:08:30 | * | gmpreussner joined #nim |
07:09:35 | Voltist | Is there a way to define a method that runs on the initialisation of an object in Nim, like the __init__ function in python? |
07:10:16 | leorize | nope |
07:10:32 | leorize | the typical notion in Nim is to write a initializer proc |
07:10:43 | Voltist | Ok |
07:10:45 | leorize | something like this: `proc initObj(): Obj` |
07:10:53 | Voltist | That makes sense, it is own way |
07:11:29 | FromGitter | <rokups> one of my biggest issues with nim. someone will eventually write `proc initFoo(): Bar`. intializers should really be tied to a type somehow |
07:11:29 | leorize | there were requests for constructors in the past, but IIRC Araq dislikes them |
07:12:20 | Voltist | Fair enough |
07:12:41 | leorize | @rokups: so far no one messed up, so we're good :) |
07:13:45 | FromGitter | <rokups> come on.. we are humans. if we do not restrain ourselves we will let all hell loose |
07:13:54 | FromGitter | <rokups> besides it would be cleaner as well |
07:15:21 | Araq | proc initFoo(): Bar is a feature. It's the factory pattern. |
07:15:45 | FromGitter | <rokups> someone will surely forget themselves and do `proc initFoo(): ref Bar` as well |
07:16:02 | FromGitter | <rokups> didnt even stdlib even have this discrepancy between new/init and ref/value types? |
07:16:45 | Araq | it still does, it's a feature |
07:17:21 | FromGitter | <rokups> like all those windows bugs that by now cant be fixed because that would break stuff? :p |
07:30:21 | * | Trustable joined #nim |
07:31:21 | Voltist | Could anyone please recommend a desktop IRC client? |
07:31:30 | Voltist | The web can be a drag |
07:31:41 | * | brakmic_ joined #nim |
07:31:43 | leorize | HexChat seems to be popular around here |
07:32:16 | Voltist | I'll give it a go |
07:32:16 | * | brakmic quit (Read error: Connection reset by peer) |
07:32:22 | * | Voltist left #nim (#nim) |
07:32:40 | * | brakmic joined #nim |
07:35:54 | * | Voltist joined #nim |
07:36:12 | Voltist | Hooray, it works! |
07:36:16 | * | brakmic_ quit (Ping timeout: 252 seconds) |
07:40:31 | * | hoijui quit (Quit: Leaving) |
07:42:18 | * | Voltist quit (Remote host closed the connection) |
07:46:31 | Araq | no like: "the distinction between value and ref semantics is important and will remain important" |
07:49:20 | * | steshaw quit (Quit: Connection closed for inactivity) |
07:49:53 | FromGitter | <rokups> noone is suggesting to erase this distinction though |
07:50:15 | FromGitter | <rokups> but it would be way clearer if we knew that `new` produces ref and `init` produces a value |
07:50:39 | FromGitter | <rokups> even better - if compiler somehow enforced this distinction so we cant do weird and confusing things |
07:54:04 | * | PrimHelios quit (Ping timeout: 264 seconds) |
07:56:29 | * | floppydh joined #nim |
07:56:43 | * | PrimHelios joined #nim |
08:16:05 | leorize | Araq: how can there still be stacktrace with --stacktrace:off? |
08:17:20 | * | couven92 joined #nim |
08:17:24 | FromGitter | <mratsim> I think there was a PR to add minimal stacktraces even in release mode |
08:18:00 | leorize | maybe that should be moved to --stacktrace:minimal? |
08:18:27 | Araq | meh |
08:18:57 | Araq | let's please not add even more stacktrace related switches, it's already pretty bad |
08:20:20 | leorize | it's weird when you have --stacktrace:off and still have stacktrace... |
08:22:10 | Araq | sounds like a real bug |
08:24:25 | leorize | the --stacktrace switch only have on and off |
08:25:02 | leorize | so when you implement a minimal stacktrace for release mode, your only option is to implement it when the switch is off |
08:25:10 | leorize | https://github.com/nim-lang/Nim/pull/9480 |
08:25:42 | FromGitter | <mratsim> we can have on/off/minimal |
08:25:52 | * | theelous3 quit (Ping timeout: 245 seconds) |
08:26:55 | * | abm joined #nim |
08:32:36 | FromGitter | <rokups> is `--nimcache` supposed to work for js? |
08:32:46 | leorize | it should? |
08:32:57 | FromGitter | <rokups> hmm does not appear to |
08:33:19 | leorize | well, to be more precise, does the compiler even produce any cache files while compiling to js? |
08:33:40 | leorize | everything is in a project.js file already |
08:33:43 | FromGitter | <rokups> yes, next to source file |
08:33:58 | leorize | just use -o: if you want it to produce files elsewhere |
08:34:59 | FromGitter | <rokups> ok that works, thanks |
08:42:08 | * | tjmac joined #nim |
08:44:27 | FromGitter | <mratsim> don't we have the builddir flag now? |
08:44:38 | leorize | --outdir iirc |
09:02:26 | * | leorize quit (Quit: WeeChat 2.3) |
09:58:05 | * | cyraxjoe quit (Read error: Connection reset by peer) |
09:59:14 | * | cyraxjoe joined #nim |
10:05:45 | FromGitter | <rokups> writing html in nim is awesome experience. suddenly webdev is cool again |
10:20:31 | * | theelous3 joined #nim |
10:21:58 | FromGitter | <mohamedmoussa89> trying to understand generics better, could someone have a look at this and let me know the precise reason why it doesnt compile, and if there is a better way? ⏎ https://nim.ide.judge0.com/?ANrC-J5yh1SmNPec9_jHKKYkNoey |
10:22:27 | FromGitter | <mohamedmoussa89> I have a workaround where I use t: T (in the argument list) and manually do a static assert in the body to check the type T really is A.T |
10:33:36 | leorize[m] | the better way is ```proc `+`[N, T](a: Vec[N, T], b: T): string``` |
10:35:58 | * | stefanos82 joined #nim |
10:39:53 | * | lf-araujo joined #nim |
10:40:39 | FromGitter | <mohamedmoussa89> What if (for example) you wanted the procedure to work with Matrix[R,C,T] and Vector[N,T]? |
10:42:50 | narimiran | you would have `+`[R, C, N], and just use floats? :P |
10:46:38 | FromGitter | <mohamedmoussa89> I mean something like `proc +A: VM (a: A, t: A.T): A` where `VM = Vector | Matrix` |
10:47:25 | * | lf-araujo quit (Ping timeout: 258 seconds) |
10:48:10 | FromGitter | <mohamedmoussa89> that will work, until I switch `a` and `t` |
10:48:26 | leorize[m] | I doubt `+` can be handled in the same way for that case... |
10:48:47 | leorize[m] | didn't know you could access the generic parameters |
10:49:02 | leorize[m] | try switching to template |
10:49:10 | FromGitter | <mohamedmoussa89> hmm |
10:53:09 | narimiran | browse `neo` repo, maybe you'll find some inspiration. e.g. https://github.com/unicredit/neo/blob/master/neo/statics.nim |
10:53:40 | FromGitter | <mohamedmoussa89> good idea |
10:53:49 | * | lritter joined #nim |
10:57:14 | leorize[m] | there's also @mratsim's arraymancer, which has more active development |
10:57:35 | * | dddddd joined #nim |
10:57:39 | * | deech joined #nim |
11:00:25 | * | gangstacat quit (Ping timeout: 268 seconds) |
11:00:34 | FromGitter | <mohamedmoussa89> I had a look, but it looks like the size is not part of the tensor type |
11:00:52 | FromGitter | <mohamedmoussa89> anyway, its not too important, just something i got side tracked on |
11:01:51 | * | gangstacat joined #nim |
11:05:05 | * | laaron quit (Remote host closed the connection) |
11:06:36 | * | laaron joined #nim |
11:12:57 | FromGitter | <kaushalmodi> @JasperJenkins Thanks! So I should use `treeRepr()` instead of `repr()` :), and what you suggested helps |
11:13:40 | FromGitter | <kaushalmodi> now I get ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ as output of that treeRepr [https://gitter.im/nim-lang/Nim?at=5d14a4e46e07c20470704aee] |
11:14:17 | FromGitter | <kaushalmodi> but it doesn't list of the types of those fields |
11:14:29 | leorize[m] | getImpl them |
11:14:38 | leorize[m] | or getType |
11:15:28 | FromGitter | <kaushalmodi> hmm .. let me try.. |
11:17:27 | FromGitter | <mratsim> probably getTypeInst if you want to know the instantiated type of a generic type |
11:18:29 | FromGitter | <kaushalmodi> ended up with this: http://ix.io/1MUp |
11:18:52 | FromGitter | <kaushalmodi> does that look right? If I visit that nested index reference in a week, I'll get scared of the code :P |
11:18:53 | FromGitter | <mratsim> @mohamedmoussa89 you can use Neo's StaticMatrix if you want the size to be part of the tensor type: https://github.com/unicredit/neo/blob/master/neo/statics.nim#L17-L19 |
11:19:34 | leorize[m] | @kaushalmodi try getTypeImpl instead of getType |
11:20:01 | FromGitter | <mratsim> It used to be the main way in @andreaferretti previous library: https://github.com/unicredit/linear-algebra/blob/master/linalg/private/types.nim#L15-L35 but we both felt too restricted. |
11:20:14 | * | nsf quit (Quit: WeeChat 2.4) |
11:21:27 | FromGitter | <kaushalmodi> leorize: ooh! That is nice |
11:21:29 | FromGitter | <kaushalmodi> thanks |
11:22:35 | FromGitter | <mohamedmoussa89> @mratsim thanks for that |
11:22:35 | FromGitter | <mratsim> This is basically why I started Arraymancer: https://github.com/mratsim/nim-rmad/issues/4#issuecomment-294281199, I needed vectors, matrices and tensors to have the same type |
11:23:53 | FromGitter | <kaushalmodi> leorize: just for reference, here's what I have now: http://ix.io/1MUr |
11:24:49 | FromGitter | <kaushalmodi> need to sign off, but now I need step is to look through the getTypeImpl interrogate the types of fields |
11:24:50 | leorize[m] | looks nice. Probably there should be a getTypeImpl for typedesc in stdlib :p |
11:24:50 | FromGitter | <kaushalmodi> thanks again |
11:25:13 | leorize[m] | PMunch: have you fixed the playground? |
11:28:03 | * | xet7 quit (Remote host closed the connection) |
11:30:14 | * | xet7 joined #nim |
11:30:15 | * | Trustable quit (Remote host closed the connection) |
11:31:18 | * | Vladar joined #nim |
11:31:23 | FromGitter | <mohamedmoussa89> how do I raise a static error i.e. at compile time? |
11:32:03 | * | lf-araujo joined #nim |
11:32:32 | FromGitter | <rokups> `macros.error("foo")` |
11:33:34 | FromGitter | <mohamedmoussa89> cheers |
11:38:15 | leorize[m] | or `{.error: "foo".}` |
11:38:27 | leorize[m] | ^ use that if not writing macros |
11:42:34 | FromGitter | <mohamedmoussa89> ah, i was using `static: eror("foo")` |
11:47:28 | * | lf-araujo quit (Remote host closed the connection) |
11:47:43 | * | lf-araujo joined #nim |
11:52:13 | * | deech quit (Ping timeout: 268 seconds) |
11:59:52 | FromGitter | <mohamedmoussa89> time for bed. thank you for your help today |
12:04:36 | * | deech joined #nim |
12:07:41 | FromGitter | <alehander42> @rokups Araq i wondered if it makes sense to finish the early version of sourcemaps PR |
12:08:08 | FromGitter | <rokups> why would it not make sense? its only a good thing |
12:08:12 | FromGitter | <alehander42> i just dont have so much time to finish the ast->ast rewrite (maybe 40-50% of ready) |
12:08:44 | FromGitter | <alehander42> @rokups first i did a simpler post-pass |
12:09:26 | FromGitter | <alehander42> which made a sourcemap from the raw output of jsgen |
12:09:26 | FromGitter | <rokups> i have no clue how sourcemaps work. do they embed ast of actual source file or what? |
12:09:26 | FromGitter | <alehander42> which kinda worked |
12:09:36 | FromGitter | <alehander42> but it is a good idea to have a more structured approach |
12:10:14 | FromGitter | <alehander42> so i started a new rewrite of the jsgen to js-like AST and then a renderer for it, but it's not finished(it's kinda half-finished and a bit coderot maybe) |
12:11:10 | FromGitter | <alehander42> but maybe its ok to just keep the postprocessing pass : its simple, it should work and it usually doesnt give a serious perf problem(after all we just compile to javascript in debug mode) |
12:11:22 | FromGitter | <alehander42> so we can have sourcemaps now |
12:11:50 | FromGitter | <alehander42> and eventually remove it when a ast->ast rewrite is actually ready |
12:12:15 | FromGitter | <alehander42> they contain a mapping of source locations iirc |
12:12:41 | FromGitter | <alehander42> (the sourcemaps) @rokups which is kinda base64-ed , i mostly ported an existing implementation |
12:12:51 | FromGitter | <alehander42> iirc |
12:13:54 | FromGitter | <rokups> all you talked about i totally dont understand ^_^ i would have expected something like .js line -> .nim line mapping. no clue what ast has to do with this |
12:14:01 | FromGitter | <rokups> sounds complicated |
12:14:25 | * | Snircle joined #nim |
12:20:16 | * | clyybber joined #nim |
12:20:24 | * | ng0 joined #nim |
12:22:08 | clyybber | Hi Araq, I'm trying to fix all the remaining issues for =move, and tbintree2 is failing with a sigsev in nimRawDispose |
12:22:27 | clyybber | does it have to do something with the {.nodestroy.} pragma? What does it do? |
12:30:18 | Araq | clyybber: .nodestroy prevents destruction/=/=move injections |
12:30:53 | * | envoyt joined #nim |
12:31:34 | Araq | as for the crash, use -d:useMalloc and run it under valgrind |
12:31:48 | Araq | it detects the bug when it happens |
12:31:54 | Araq | not when it materializes |
12:36:12 | * | brakmic quit (Ping timeout: 252 seconds) |
12:38:16 | * | brakmic joined #nim |
12:39:40 | * | envoyt quit (Read error: Connection reset by peer) |
12:41:24 | * | envoyt joined #nim |
12:57:35 | FromGitter | <juancarlospaco> Hi |
13:00:16 | FromGitter | <mratsim> btw @juancarlospaco I said it on reddit (though not with a mratsim username) but cool work and explanations on your tensor article, really appreciated |
13:02:35 | * | envoyt quit (Read error: Connection reset by peer) |
13:03:55 | * | envoyt joined #nim |
13:04:43 | FromGitter | <juancarlospaco> Hi, honestly 1st time with playing with Tensors, glad I didnt make a disaster then. :) But other explanations seems over-complicated. |
13:06:21 | FromGitter | <mratsim> The only scary thing of tensors is the name :p |
13:07:09 | FromGitter | <juancarlospaco> I mean other explanations on other programming languages. :P |
13:07:49 | FromGitter | <mratsim> Oh? what explanations did you find? |
13:13:23 | FromGitter | <juancarlospaco> I was expecting an error when installed, because I didnt config anything, I just blindly installed with nimble and it works on cpu backend on first try. |
13:16:55 | lf-araujo | Hi all, is it possible to build a project with nimble and run the resulting binary in one command? |
13:17:36 | lqdev[m] | You can define a task for that |
13:17:42 | clyybber | I just use "nimble build && ./thebinary" |
13:18:35 | solitudesf | nimble build -r |
13:18:48 | FromGitter | <juancarlospaco> https://nim-lang.org/docs/nims.html > "NimScript as a build tool" @lf-araujo |
13:19:08 | lf-araujo | thanks! |
13:22:09 | * | envoyt quit (Ping timeout: 248 seconds) |
13:24:49 | * | deech quit (Ping timeout: 248 seconds) |
13:27:31 | * | PMunch_ joined #nim |
13:27:49 | lf-araujo | All nim and nimble command line interface is well designed and clear, which module devs uses for pretty printing on the terminal? |
13:30:16 | Araq | custom code on top of terminal.nim |
13:30:23 | FromGitter | <juancarlospaco> terminal, json.pretty |
13:35:13 | FromGitter | <juancarlospaco> I think marshal can represent stuff as json, then json.pretty for pretty-print it, then terminal for hipster colors. |
13:37:48 | * | lf-araujo_ joined #nim |
13:38:40 | * | lf-araujo_ quit (Remote host closed the connection) |
13:41:21 | leorize[m] | the failing tests here seems to be irrelevant :/ https://github.com/nim-lang/Nim/pull/11605 |
13:42:03 | * | lf-araujo quit (Ping timeout: 264 seconds) |
13:45:21 | Araq | https://www.codingnow.com/2000/download/pentopt.htm#1 ah the memories, optimizing for the old Pentiums. U and V pipelines, shifts that cannot be paired, compilers that produce bad code and cannot keep up with CPU improvements. Those were the days |
13:48:00 | * | lf-araujo joined #nim |
13:52:47 | * | deech joined #nim |
13:59:23 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
14:01:37 | FromGitter | <mratsim> of the infamous Pentium 4 IDIV bug |
14:01:40 | FromGitter | <mratsim> or* |
14:10:56 | PMunch_ | !eval import osproc; echo execProcess("""echo "Hello world from user \"$(whoami)\""""") |
14:11:01 | NimBot | Hello world from user "nobody"↵ |
14:11:27 | PMunch_ | Playground is back up! |
14:11:40 | PMunch_ | And the docker container now executes code as user "nobody" |
14:11:44 | Araq | yay |
14:11:45 | PMunch_ | Instead of root |
14:11:55 | Araq | aww |
14:12:23 | PMunch_ | aww? Did you have nefarious plans for the playground Araq? |
14:12:57 | Araq | everything and everybody should be root |
14:13:21 | PMunch_ | Tell that to the security flaw list of docker :P |
14:14:37 | FromGitter | <rokups> is there some tutorial on `async`? |
14:14:51 | Araq | capabilities should be attached to processes/applications, not to users |
14:15:08 | * | laaron quit (Remote host closed the connection) |
14:15:16 | lf-araujo | Where is the standard place for config/nim.cfg, when choosenim is used for installation? |
14:15:32 | Araq | dunno, /etc ? |
14:15:35 | * | laaron joined #nim |
14:15:53 | FromGitter | <rokups> PMunch_ using docker as a security measure for playground? well good luck with that :trollface: |
14:16:24 | * | jchev joined #nim |
14:17:13 | FromGitter | <kaushalmodi> lf-araujo: $XDG_CONFIG_HOME |
14:17:22 | lf-araujo | thank you |
14:17:24 | FromGitter | <kaushalmodi> on most linux based OSes, that defaults to $HOME/.config |
14:17:33 | FromGitter | <kaushalmodi> nim respects XDG_CONFIG_HOME |
14:17:46 | PMunch_ | rokups, it's fairly common with playgrounds |
14:18:19 | FromGitter | <rokups> PMunch_ its a terrible idea. it is very unsafe |
14:18:33 | PMunch_ | Well it's more safe than just running it as a user |
14:19:06 | FromGitter | <rokups> tiny bit. but for the best effect you should use actual VM and burn it quite often |
14:19:37 | PMunch_ | The docker container has no network, limited memory, limited CPU, and a limited runtime. And a new one is spun up for every snippet of code |
14:19:53 | PMunch_ | And now it's not even allowed root access within the container |
14:21:42 | * | Vladar quit (Remote host closed the connection) |
14:21:44 | FromGitter | <rokups> but that doesnt do much. kernel vulnerabilities that elevate access arent that uncommon. new one will be found soon enough and it will be usable on playground because you didnt update in time. then its a matter of breaking out of container which depends on many factors, but its a thing |
14:22:27 | FromGitter | <rokups> there were docker vulnerabilities allowing breakout, but it could be possible if you misconfigure docker in some way |
14:23:44 | PMunch_ | Yes, but that's still a lot of ifs and buts. Besides, the entire playground is running on a virtual machine, so worst case scenario an attacker takes down that or turns it into a spam-machine, in which case it can simply be nuked. |
14:24:05 | FromGitter | <kaushalmodi> PMunch: feature request for playground.. can we have separate buttons for compilation out and run time out? |
14:24:30 | PMunch_ | kaushalmodi, what do you mean? You can already switch between the two |
14:24:42 | FromGitter | <rokups> ah nice, i wasnt aware that docker containers run inside a VM :] |
14:25:51 | PMunch_ | Well it's the same VM as the webserver, but yes they do run under a VM |
14:26:24 | FromGitter | <kaushalmodi> PMunch: just separate buttons instead of a toggle button |
14:26:41 | FromGitter | <kaushalmodi> I didn't know that "Showing: output" was a button :/ |
14:26:52 | PMunch_ | Why? What would the "Switch to output" button do when you're already on output? |
14:27:07 | clyybber | Araq: setting up SELinux is kind of complicated, so I can't blame anyone for *not* using it.. |
14:27:08 | PMunch_ | Oh yeah, I've been thinking of ways to make that more obvious.. |
14:29:25 | FromGitter | <kaushalmodi> PMunch: e.g. go to https://play.nim-lang.org/#ix=1MUr and hit Run |
14:29:29 | Araq | huh? why highlight me? |
14:29:39 | FromGitter | <kaushalmodi> when I did that, I was like.. "hmm, nothing happened?" |
14:30:19 | PMunch_ | kaushalmodi, ah, that's a bug. It's supposed to switch over to debug if there is no input |
14:30:22 | PMunch_ | output* |
14:30:25 | FromGitter | <kaushalmodi> PMunch: may be have separate buttons for compilation log and simulation log? |
14:30:36 | FromGitter | <kaushalmodi> compilation log button becaomes red if compilation fails? |
14:30:52 | FromGitter | <kaushalmodi> if it becomes red, focus auto switches to that log |
14:31:05 | FromGitter | <kaushalmodi> if it becomes green, focus switches to runlog |
14:31:14 | FromGitter | <kaushalmodi> if run log is empty, focus remains on compilation log |
14:31:20 | clyybber | Araq: You were saying that capabilites should be attached to processes, and thats what SELinux is accomplishing |
14:31:22 | FromGitter | <kaushalmodi> (too much to ask? sorry) |
14:31:35 | Araq | ah ok |
14:31:45 | Araq | to be honest, I wasn't aware |
14:31:56 | FromGitter | <kaushalmodi> PMunch: I know that I am just making feature requests.. I don't know the underlying complexity |
14:32:57 | PMunch_ | Hmm, I'd have to implement some changes to the output of curl -X POST https://play.nim-lang.org/compile -d '{"compilationTarget": "c", "code": "echo \"hello world\""}' for that to work |
14:33:34 | PMunch_ | The output of that command is what I have to work with currently |
14:33:44 | PMunch_ | As you can see it's only compilationLog and log |
14:33:53 | FromGitter | <kaushalmodi> woh! I can curl code to the playground.. that's neat |
14:34:06 | PMunch_ | I would need status codes of the compiler and the program as well to implement those features. Completely doable though |
14:34:26 | PMunch_ | kaushalmodi, yes it's just a REST API in the background :) |
14:34:28 | FromGitter | <kaushalmodi> PMunch: I see "log" as one of the returned fields |
14:34:41 | FromGitter | <kaushalmodi> should you have "compile_log" and "run_log"? |
14:34:47 | PMunch_ | Yes, "log" is the log from running the program |
14:34:58 | PMunch_ | Yeah, the names there are a bit confusing.. |
14:35:12 | PMunch_ | This was "borrowed" from the old playground |
14:35:18 | FromGitter | <kaushalmodi> got it |
14:35:30 | FromGitter | <kaushalmodi> ok, I see there's "compileLog" already |
14:35:38 | FromGitter | <kaushalmodi> so we need "log" -> "runLog" |
14:35:44 | Araq | PMunch_, narimiran can we add the new playground to important_packages please? |
14:35:54 | * | deech quit (Ping timeout: 272 seconds) |
14:36:47 | FromGitter | <kaushalmodi> PMunch_: there could be a quick small CLI to run code on playground |
14:37:14 | FromGitter | <kaushalmodi> call it "nimplay" and "nimplay foo.nim" :) |
14:37:28 | FromGitter | <kaushalmodi> I am adding that to my list of pet projects |
14:37:49 | * | lf-araujo_ joined #nim |
14:38:57 | PMunch_ | Definitely could, but why not just install Nim then? :P |
14:39:37 | FromGitter | <kaushalmodi> to tease people into installing nim |
14:39:59 | FromGitter | <kaushalmodi> "hey, try out this small statically compiled binary to remotely run and execute the nim code" |
14:40:10 | solitudesf | how is that better than just using playground? |
14:40:16 | FromGitter | <kaushalmodi> i know i know .. |
14:40:19 | FromGitter | <kaushalmodi> still :) |
14:40:36 | PMunch_ | I agree it would be cool, but it's completely pointless :P |
14:41:20 | * | smitop joined #nim |
14:41:39 | FromGitter | <kaushalmodi> yeah, one of those projects |
14:41:45 | jchev | hi all, is this a place to get a little nim guidance? |
14:41:47 | * | lf-araujo quit (Ping timeout: 244 seconds) |
14:41:48 | * | lf-araujo_ is now known as lf-araujo |
14:42:00 | lqdev[m] | sure |
14:42:00 | PMunch_ | jchev, yup :) |
14:42:08 | FromGitter | <kaushalmodi> jchev: the quantity of guidance can be limited by you |
14:43:41 | jchev | i've been exploring nim the past few weeks and been enjoying it. i've been working through some project euler questions and using nim in a fairly functional manner |
14:43:53 | jchev | (loads of iterators) |
14:44:12 | jchev | i am currently on problem 12 on project euler, https://projecteuler.net/problem=12 |
14:44:37 | jchev | here is the code i thought would work for it, but i am getting a compile error https://gist.github.com/jchevertonwynne/51fe02ca70e660699fb1b91639a49d46 |
14:45:16 | FromGitter | <mratsim> This is my code for problem 12: https://github.com/mratsim/nim-project-euler/blob/master/src/pe012_highly_divisible_triangular_number.nim for reference |
14:46:09 | jchev | i found yours online already :) |
14:46:48 | * | lf-araujo quit (Ping timeout: 250 seconds) |
14:47:15 | * | NimBot joined #nim |
14:47:24 | jchev | i'm not quite understanding why it's complaining about types here, at least from what i can tell it *should* work |
14:48:50 | FromGitter | <mratsim> I think your firstValid[T] has T being seq int |
14:49:47 | FromGitter | <mratsim> makeDivisor creates a seq |
14:50:15 | FromGitter | <mratsim> and mapIterators will create an iterator of seq |
14:50:26 | jchev | so we begin with a iter[int], we turn that into an iter[seq[int]] |
14:50:57 | FromGitter | <mratsim> and then you take the first valid seq[int] of your iter[seq[int]] |
14:51:24 | jchev | oh wait |
14:51:29 | jchev | rubber duck |
14:51:42 | jchev | what a silly error |
14:52:09 | jchev | i forgot to get the last divisor from the firstValid result |
14:52:19 | PMunch_ | Thanks jchev, found another bug in the playground :) |
14:52:45 | PMunch_ | Apparently <seq[int]> was misunderstood as a HTML tag in the output -_- |
14:53:28 | FromGitter | <mratsim> Nice! |
14:54:39 | Araq | PMunch_, if that's a karax issue/flaw/gotcha please report it |
14:55:09 | * | lf-araujo joined #nim |
14:55:50 | FromGitter | <rokups> is it possible to call async proc from karax's `createDom()`? |
14:55:54 | * | nsf joined #nim |
14:56:01 | PMunch_ | Araq, it's not really. I add things with verbatim, because I add HTML tags to colour the output like the output you get in your terminal |
14:56:20 | PMunch_ | (I do a search and replace on some keywoards, it's not very robust..) |
14:56:27 | leorize[m] | clyybber: linux have a separated capabilities system independent from SELinux, and programs can actually drop their own capabilities with it |
14:57:20 | PMunch_ | But I should HTML-escape the output before I do this |
14:58:09 | Araq | rokups: sure |
14:58:21 | PMunch_ | Hmm, this also means you can HTML style output. Try for example 'echo "<strong>hello world</strong>"' in the playground, it will be bold.. |
14:58:30 | leorize[m] | PMunch_: can't you emit <span> for highlighting then normal text after? |
14:58:54 | PMunch_ | leorize[m], what do you mean? |
15:01:20 | jchev | thanks for talking me through my error, is so hard to realise when you've been looking at it for over an hour :) |
15:01:24 | FromGitter | <mratsim> Seems like the playground is vulnerable to "echo injection" attacks then :P |
15:01:37 | jchev | and i'm glad to be of service with helping finding that bug :) |
15:01:42 | FromGitter | <mratsim> @jchev, you're welcome |
15:06:46 | * | lf-araujo quit (Ping timeout: 276 seconds) |
15:06:56 | leorize[m] | PMunch_: http://ix.io/1MVk/nim |
15:07:50 | * | leorize joined #nim |
15:10:09 | PMunch_ | Well yes, but that's not really how it's done here: https://github.com/PMunch/nim-playground-frontend/blob/master/frontend.nim#L123-L128 and then that gets inserted into the page here: https://github.com/PMunch/nim-playground-frontend/blob/master/frontend.nim#L239 |
15:10:55 | PMunch_ | The problem is that before the replacing this should've been HTML escaped |
15:11:07 | leorize[m] | you should probably change your outputText array into a VNode array so you can build them up line-by-line |
15:11:56 | leorize[m] | and the outputText array type looks odd |
15:12:38 | PMunch_ | Yeah it could've been simplified as array[OutputKind, string] |
15:13:16 | PMunch_ | Hmm wait, how does that even work? It's using Output and not OutputKind.. |
15:15:06 | * | Tyresc joined #nim |
15:15:08 | leorize | PMunch_: you could have built the output up via a VNode :p |
15:15:21 | PMunch_ | But why? |
15:15:55 | leorize | because escaping requires iteration and idk how fast it is in JS |
15:16:05 | leorize | 'sides using a VNode is much cooler :p |
15:16:14 | leorize | oh wait building VNode needs iterating as well, nvm |
15:18:43 | leorize | maybe I'll try to play with the playground frontend |
15:19:01 | PMunch_ | Yeah, to build it up as VNode I would have to first split the string into lines. Then iterate over the lines, then search for occurrences of stuff to replace, then replace them and build a VNode tree. Seems like a lot more work than just doing search and replace |
15:19:06 | PMunch_ | leorize, oh please do :) |
15:20:05 | leorize | tbh it's just 3 loops |
15:20:23 | leorize | certainly faster than the 5 loops of replace I'm seeing here :) |
15:21:16 | PMunch_ | Yeah, not really sure why I'm not using multiReplace there.. |
15:21:58 | PMunch_ | Then it would be a single loop |
15:25:00 | * | abm quit (Read error: Connection reset by peer) |
15:29:29 | * | deech joined #nim |
15:32:13 | Araq | multiReplace ftw |
15:43:06 | * | tjmac quit (Quit: -bye) |
15:43:47 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
15:45:40 | * | laaron joined #nim |
15:54:10 | * | gangstacat quit (Quit: Ĝis!) |
15:57:00 | FromGitter | <AmberSaber> leorize? |
15:57:13 | leorize | AmberSaber: yes? |
15:57:49 | FromGitter | <AmberSaber> I don't know the word |
15:58:23 | leorize | it's meaningless :p |
15:59:07 | FromGitter | <AmberSaber> well |
16:01:24 | * | jokul quit (Ping timeout: 272 seconds) |
16:02:00 | FromGitter | <AmberSaber> Time is too late, goodbye |
16:06:47 | PMunch_ | Hmm, this is strange. I'm trying to set up the playground locally so I can develop on it, but I can't get the permissions right.. |
16:09:00 | FromGitter | <alehander42> PMunch_, you can lex the tokens |
16:09:07 | PMunch_ | Huh? |
16:09:13 | FromGitter | <alehander42> the source* |
16:09:20 | FromGitter | <alehander42> and generate highlight spans for each token |
16:09:32 | FromGitter | <alehander42> if i am understanding the problem correctly |
16:11:03 | PMunch_ | Oh, you're talking about the highlighting stuff :P |
16:11:09 | PMunch_ | Yes, that would be possible |
16:11:50 | * | enthus1ast86 joined #nim |
16:12:08 | * | enthus1ast86 is now known as enthus1ast_w |
16:12:36 | enthus1ast_w | is there any (complete) code example of the hotCodeReload feature? |
16:12:41 | shashlick_ | @narimiran - nimterop is still not in important packages right? |
16:13:16 | narimiran | shashlick_: i think there was some problem with it on windows (that's what appveyor runs on) so it is not included |
16:13:46 | solitudesf | enthus1ast_w, https://github.com/zah/nim-hcr-astronauts/ |
16:16:47 | enthus1ast_w | thank you solitudesf but it seems that i 1. lacks the params nim needs 2. sdl does not build :) |
16:17:01 | enthus1ast_w | (on windows) |
16:17:11 | * | jchev quit (Quit: WeeChat 2.5) |
16:18:04 | solitudesf | for me the app was crashing after 1-3 reloads. not this example tho. |
16:18:14 | enthus1ast_w | i guess if have to build the main with --hotCodeReloading:on ? |
16:18:50 | enthus1ast_w | but what must i do with the module (space.nim in this case) build it with --app:lib ? |
16:19:14 | solitudesf | no, you build entire app with this flag |
16:19:21 | solitudesf | and rebuild it after modifications |
16:19:34 | enthus1ast_w | while its running? |
16:19:39 | solitudesf | yes |
16:19:51 | solitudesf | that would be the point? |
16:20:04 | FromGitter | <alehander42> @rokups sorry i just was lazy and didnt finish the more complicated sourcemap-related code :( |
16:20:47 | FromGitter | <alehander42> it does map javascript locations to the original nim locations indeed, and i had a simpler patch that also did it |
16:20:51 | FromGitter | <alehander42> thats what i meant |
16:21:40 | enthus1ast_w | ah nice, thank you solitudesf for clearing this up |
16:21:57 | leorize | I thought the app rebuilds itself? |
16:22:18 | enthus1ast_w | how could you know leorize its not documented ;) |
16:22:23 | leorize | https://nim-lang.github.io/Nim/hcr |
16:22:45 | leorize | it is kinda documented, just not in stable |
16:22:58 | enthus1ast_w | ok it is documented... |
16:23:36 | FromGitter | <alehander42> there are even some talks e.g. https://slides.com/onqtam/nim_hot_code_reloading |
16:24:12 | enthus1ast_w | https://nim-lang.github.io/Nim/hcr did not show up in my google foo |
16:26:27 | FromGitter | <alehander42> but not sure if up to daate |
16:26:37 | leorize | Araq wrote it recently |
16:29:32 | FromGitter | <alehander42> oooh right |
16:29:35 | FromGitter | <alehander42> but the slides not sure |
16:29:48 | FromGitter | <alehander42> the docs are good indeed! |
16:30:22 | leorize | now we just need someone to step up and write a proper repl for nim :) |
16:32:43 | enthus1ast_w | and a crossplatform "inotifywait" |
16:42:47 | PMunch_ | leorize, what's wrong with "nim secret" |
16:43:37 | leorize | import times |
16:44:26 | PMunch_ | Aah, you want one that runs on the C backend |
16:44:40 | leorize | nim secret becomes nim secret for a reason :p |
16:45:02 | PMunch_ | I remember there was one that used TinyCC to compile faster |
16:45:18 | PMunch_ | But it suffered from some issues with "poisoning" |
16:45:47 | * | nsf quit (Quit: WeeChat 2.4) |
16:45:48 | PMunch_ | If you wrote something that had an error in it, that could get stuck in the temporary file it was actually compiling, which would make it always fail after that.. |
16:46:09 | leorize | well, the beauty of a repl comes from it's ability to preserve state |
16:47:04 | leorize | you wouldn't want to have your connection redone n times because of the n lines you typed after |
16:47:29 | PMunch_ | Yeah, that also wouldn't work :P |
16:47:38 | enthus1ast_w | the good think with nim is that you usually know what kind of data/object you operate on. So coming from python a few years ago, i had to learn that you do not really need repl for programming :) |
16:47:58 | PMunch_ | Yeah that's true |
16:48:30 | PMunch_ | But I still find myself sometimes running something in nim secret or a small file, just to test some slicing behaviour or something like that |
16:48:34 | leorize | yea, but a repl is nice for prototyping |
16:49:09 | leorize | back when I was writing pascal I have a folder called "behavior test" just to test small code snippets |
16:49:31 | enthus1ast_w | mine is called nimPlayground and is cluttered with hunderes of files :D |
16:50:49 | shashlick_ | what's wrong with this: `proc freeShared(ss: var sharedString|sharedSeq) =` |
16:51:03 | shashlick_ | it shows ss.ssptr cannot be assigned to |
16:51:50 | leorize | a full code snippet would be appreciated |
16:52:33 | shashlick_ | had to do this: `proc freeShared(ss: var (sharedString|sharedSeq)) =` |
16:53:02 | * | CcxWrk joined #nim |
16:53:06 | leorize | I think the `|` has lower precedence than `var` |
16:53:46 | shashlick_ | | doesn't work for `=destroy()` though |
16:53:59 | shashlick_ | ```proc `=destroy`*(ss: var (sharedString|sharedSeq)) =``` |
16:54:04 | leorize | yea, `=destroy` must be concrete from what I've seen |
16:56:37 | * | jokul joined #nim |
16:58:49 | PMunch_ | Hmm, with asyncfile how do you know when you reach the end with readLine? |
16:59:58 | PMunch_ | Basically I want to read the entire file into a sequence of strings |
17:02:55 | * | enthus1ast_w quit (Ping timeout: 260 seconds) |
17:03:37 | leorize | it'll return an empty string at EOF |
17:03:54 | PMunch_ | And what if I have a file with empty lines? |
17:04:00 | PMunch_ | Does it include the \n? |
17:04:37 | leorize | from the code, no |
17:05:17 | leorize | you can try to check for EOF by reading 1 byte from the stream |
17:05:22 | PMunch_ | Hmm.. |
17:05:30 | leorize | if an empty string is returned then it's EOF |
17:06:24 | leorize | although an isEof api might be needed |
17:06:53 | leorize | or something along the lines of `readLine(f: AsyncFile, s: var string): Future[bool]` like the one for File |
17:07:30 | PMunch_ | Aha, `while file.getFilePos < file.getFileSize` seems to work fine |
17:08:26 | leorize | seeing how that's done, I don't recommend doing so |
17:08:50 | leorize | on *nix this will seek to the end, then get the position as the size, then return to the current position |
17:09:51 | PMunch_ | Ooof |
17:10:09 | PMunch_ | So at least store the position and not do it every iteration.. |
17:11:14 | * | lf-araujo joined #nim |
17:12:24 | leorize | let's hope TOCTOU won't hit you :p |
17:12:52 | lqdev[m] | suggestion for the do notation: infer the types, so you don't have to specify them every time. like, `x do (a, b, c):` instead of `x do (a: float, b: int, c: bool)` |
17:13:27 | PMunch_ | Shouldn't be an issue, I'm reading the log files from the docker container, and the container is already dead |
17:13:57 | leorize | lqdev[m]: sugar.`=>` |
17:14:40 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
17:15:04 | * | laaron joined #nim |
17:15:55 | leorize | PMunch_: just check it once you hit it |
17:16:13 | PMunch_ | Huh? |
17:16:34 | leorize | while true: if readLine(f) == "" and read(f, 1) == "": break |
17:16:42 | lqdev[m] | leorize: what if I want multiple statements? |
17:17:29 | * | lf-araujo quit (Ping timeout: 250 seconds) |
17:17:45 | * | smitop quit (Quit: Connection closed for inactivity) |
17:18:02 | leorize | `=>`(x, y): # body here |
17:18:37 | * | lqdev[m] sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/KHJcairJZfqyHaQjcsyIGtkQ > |
17:19:30 | leorize | inferring is never easy :p |
17:20:25 | lqdev[m] | I think I'm going to stick with `do` for the time being |
17:21:25 | PMunch_ | kaushalmodi, I think this output will make things easier when implementing a playground: http://ix.io/1MVY |
17:22:19 | leorize | output the raw thing, with ANSI escape code :) |
17:22:26 | leorize | then do the coloring as post-processing |
17:22:32 | leorize | in the frontend |
17:22:43 | PMunch_ | Yeah I'm considering adding that as on option in the request |
17:23:08 | PMunch_ | So you could do something like: {"compilationTarget":"c", "code":"echo \"hello world\"", "colours": "ansi"} |
17:23:26 | PMunch_ | With colours being ansi, none, or html for example |
17:23:55 | leorize | yea, you could do post processing on the server instead of the client |
17:28:22 | FromGitter | <alehander42> afaik it wouldnt be too hard to write a hcr-based basic repl |
17:28:45 | FromGitter | <alehander42> i think @onqtam already had an example with how the arch would look |
17:29:01 | PMunch_ | Anyone feeling up for creating a Nim ANSI->HTML converter like this https://github.com/uu59/ansi-to-html? |
17:29:03 | FromGitter | <alehander42> the problems are adding support for nim rtl to most of stdlib / libs afaik |
17:29:17 | FromGitter | <alehander42> btw PMunch i think i did something like that |
17:29:30 | FromGitter | <alehander42> for showing terminal output in electron |
17:29:36 | FromGitter | <alehander42> but i think i stopped using it |
17:29:45 | FromGitter | <alehander42> othe roption is |
17:29:52 | FromGitter | <alehander42> using a js lib: i used one as well |
17:30:30 | leorize | ansi codes are simple :) |
17:30:51 | PMunch_ | So you want to write the library then? :P |
17:31:00 | leorize | nope :p |
17:31:05 | PMunch_ | Aaaw |
17:31:40 | PMunch_ | I was hoping to offload that to someone else, so I could add more interesting features to the playground |
17:32:13 | leorize | offload it to some external js library then :) |
17:35:18 | FromGitter | <alehander42> PMunch it was something like https://gist.github.com/alehander42/7b9d40e89f94979a3226364940f86155 |
17:35:40 | FromGitter | <alehander42> cut off from my codebase with some non-important code removed to demonstrate the logic |
17:35:47 | FromGitter | <alehander42> but that's probably too convoluted |
17:36:03 | FromGitter | <alehander42> it was written just to get it working somehow |
17:36:16 | * | narimiran quit (Ping timeout: 246 seconds) |
17:36:28 | * | narimiran joined #nim |
17:36:33 | FromGitter | <alehander42> a library i used was https://github.com/drudru/ansi_up |
17:36:44 | FromGitter | <alehander42> (in another case ) |
17:36:55 | PMunch_ | leorize, well that won't work if I want to do this on the back-end |
17:37:30 | leorize | you can write one with karax |
17:37:38 | leorize | it would work on backend and frontend :) |
17:37:45 | FromGitter | <alehander42> my code used karax as well |
17:38:04 | FromGitter | <alehander42> but i guess a cleaned up version would be best |
17:47:26 | PMunch_ | Hmm, echoing out a table looks kinda weird.. |
17:49:39 | * | krux02 quit (Remote host closed the connection) |
18:34:22 | * | jjido joined #nim |
18:45:16 | * | PMunch quit (Disconnected by services) |
18:45:21 | * | PMunch_ is now known as PMunch |
18:45:45 | * | PMunch_ joined #nim |
18:47:08 | FromGitter | <kaushalmodi> PMunch_: The new json fields look great! |
18:47:22 | FromGitter | <kaushalmodi> *I need to install `jq`.. have heard good things about it* |
18:47:36 | FromGitter | <kaushalmodi> btw is runCode and compileCode quite obvious? |
18:47:46 | FromGitter | <kaushalmodi> or should they be runExitCode and compileExitCode |
18:50:41 | PMunch | Hmm, that could be a good idea |
18:52:43 | PMunch | And yeah, jq is nice if you work a lot with JSON |
18:52:55 | PMunch | Or if you just work a bit with JSON :P |
19:04:20 | * | elrood joined #nim |
19:07:20 | * | natrys joined #nim |
19:20:20 | * | theelous3_ joined #nim |
19:25:07 | * | sentreen quit (Quit: sentreen) |
19:26:36 | * | theelous3_ quit (Ping timeout: 272 seconds) |
19:27:32 | FromDiscord_ | <djazz> I'm using nim to modify the texture atlases in the game Celeste, so it runs on the Raspberry Pi! come have a look! https://www.twitch.tv/daniel_hede/ |
19:31:23 | * | sentreen joined #nim |
19:32:22 | * | Araq joined |
19:32:27 | Araq | come on, join the party |
19:32:29 | FromGitter | <kaushalmodi> How do you generate Linux compatible .so on Windows? |
19:32:55 | FromGitter | <kaushalmodi> what cross compiler do people use? |
19:33:08 | Araq | mingw. I think |
19:34:14 | * | lf-araujo joined #nim |
19:35:53 | PMunch | Can cofirm, mingw works to create dlls for Windows |
19:36:08 | FromGitter | <kaushalmodi> I need to create .so |
19:36:23 | FromGitter | <kaushalmodi> i.e. generate the linux compatible .so on windows machine |
19:37:01 | FromGitter | <juancarlospaco> is there a way to force a template to be run on the body of a proc/func only?. |
19:37:19 | leorize[m] | @kaushalmodi you'd need a cross compiler |
19:37:44 | leorize[m] | @juancarlospaco: no |
19:37:53 | Araq | juancarlospaco: proc foobar() {.macroHere.} notation |
19:38:01 | FromGitter | <kaushalmodi> *I am googling* .. is MSYS2 a cross compiler? |
19:38:07 | Araq | in the macro you can enforce the nnkProcDef kind |
19:38:42 | leorize[m] | @kaushalmodi no :p it's a posix env on windows |
19:38:53 | FromGitter | <juancarlospaco> Thanks. |
19:39:11 | FromGitter | <kaushalmodi> leorize: ok .. :) |
19:39:24 | leorize[m] | well creating a linux cross compiler shouldn't be hard |
19:39:37 | leorize[m] | but I'm not sure if anyone attempted that on windows |
19:39:45 | FromGitter | <kaushalmodi> I have started googling about this stuff just 1/2 hr back |
19:40:02 | leorize[m] | check if msys2 have linux cross compiler |
19:40:42 | leorize[m] | if they don't, use WSL instead of wasting time trying to create a cross compiler. |
19:41:31 | FromGitter | <kaushalmodi> ok, let me check with the team that needs this |
19:41:32 | * | lf-araujo quit (Ping timeout: 252 seconds) |
19:41:36 | PMunch | kaushalmodi, oh the other way round :P |
19:41:47 | shashlick_ | i've not found a win => lin cross compiler |
19:42:04 | shashlick_ | didn't search too hard but ya |
19:44:11 | PMunch | Apparently this should work: http://metamod-p.sourceforge.net/cross-compiling.on.windows.for.linux.html |
19:44:26 | * | nsf joined #nim |
19:44:26 | FromDiscord_ | <treeform> kaushalmodi, I found it easier to have a linux build server for 5$ on digital ocean. |
19:44:55 | FromGitter | <kaushalmodi> PMunch: thanks, I also landed up on that while searching.. will ask the Windows team to try that out |
19:45:04 | FromGitter | <kaushalmodi> *all of this is linked to my work on Nim* |
19:45:47 | FromGitter | <kaushalmodi> C++ source code is developed in Windows.. Windows team compiles Windows .exe (and are now looking to compile .so for Linux side team).. and I dynlink to that .so via Nim |
19:46:05 | FromGitter | <kaushalmodi> treeform: all this devel is inhouse.. nothing goes to clouds |
19:48:46 | PMunch | djazz, are you swedish? |
19:48:49 | * | lf-araujo joined #nim |
19:49:19 | leorize[m] | crosstools-ng can generate linux cross compiler on windows |
19:50:01 | leorize[m] | clang can target linux from windows if you have all the headers and libs built |
19:50:06 | * | floppydh quit (Quit: WeeChat 2.5) |
19:56:51 | FromGitter | <kaushalmodi> thanks all, the Windows team is trying out the cygwin route |
19:59:39 | * | lf-araujo quit (Remote host closed the connection) |
20:02:23 | * | hzot joined #nim |
20:02:59 | * | hzot quit (Remote host closed the connection) |
20:07:22 | PMunch | Hmm, doesn't ANSI escape codes have a proper ending? |
20:07:23 | FromDiscord_ | <djazz> PMunch, yes |
20:08:00 | PMunch | Cool, I'm from Norway myself. Could tell from your accent :P |
20:11:28 | FromGitter | <kaushalmodi> PMunch: the ANSI escapes do have endings |
20:12:12 | FromGitter | <kaushalmodi> the `\033[0m` mark ends |
20:12:25 | PMunch | Ah yes, that marks the end of styling |
20:13:28 | PMunch | The escape sequence starts with ESC and a character in the range 0x40–0x5F |
20:13:40 | PMunch | (Normally for styling this would be ESC[) |
20:13:49 | PMunch | Or \033[ if you like |
20:13:55 | PMunch | But where does it stop? |
20:14:57 | PMunch | I can't just parse until I find an `m` because what happens if you run the escape sequence \033[5A which is supposed to move the character 5 lines up? |
20:15:46 | FromGitter | <kaushalmodi> hmm, I have used ansi escapes only for styling |
20:16:28 | PMunch | Yeah, but a library would have to at least not lock up if you pass it something else |
20:16:41 | PMunch | (especially since this will be handling user-generated output) |
20:16:56 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:17:05 | FromGitter | <kaushalmodi> I am reading (quickly) the wiki page on this.. |
20:17:15 | FromGitter | <kaushalmodi> looks like ESC[0m is the ending |
20:17:30 | FromGitter | <kaushalmodi> I cannot tell is that is style specific or not |
20:18:17 | PMunch | ESC[0m is reset all styling |
20:18:28 | PMunch | I'm talking about how I stop parsing a single code |
20:19:07 | PMunch | Currently I check if a character is ESC, then if the next is [. But I need to stop at some point |
20:19:18 | PMunch | I guess I could just be really picky with what I parse |
20:19:27 | FromGitter | <kaushalmodi> I see .. |
20:19:28 | PMunch | So I parse only up to 3 numeric characters |
20:19:55 | PMunch | And only ; separated |
20:20:07 | PMunch | Ending with `m` |
20:21:35 | FromGitter | <kaushalmodi> PMunch: here's a (non)answer: https://stackoverflow.com/a/36561805/1219634 |
20:26:28 | FromGitter | <kaushalmodi> looks like you "just" have a case statement of all ansi escapes that can be expected: http://ascii-table.com/ansi-escape-sequences-vt-100.php |
20:26:30 | * | jjido joined #nim |
20:27:08 | PMunch | Ugh |
20:27:13 | PMunch | I'll just do it my way |
20:30:31 | * | nsf quit (Quit: WeeChat 2.4) |
20:32:27 | PMunch | Hmm, what does `reset` actually do? |
20:33:45 | PMunch | By the way, for the twitch stream (can't be arsed to log in), he could use a converter to avoid the uint32 casts |
20:33:59 | FromGitter | <kaushalmodi> I'd guess.. reset the terminal fonts, cursor position, colors, etc |
20:34:12 | PMunch | kaushalmodi, I meant in Nim :P |
20:34:24 | FromGitter | <kaushalmodi> I have used `reset` command in terminal few times when for some reason, it would start printing out text in gibberish |
20:34:35 | PMunch | Resets an object obj to its initial (binary zero) value. |
20:34:57 | * | NimBot joined #nim |
20:35:00 | FromGitter | <kaushalmodi> oh OK :) |
20:35:22 | PMunch | I kinda like the semantics of "reset myVar" when I'm doing loops (instead of assigning them to 0, "", or something like that) |
20:35:44 | PMunch | Although it does do a bit more work than necessary.. |
20:35:56 | PMunch | For string for example setLen 0 would be faster than reset |
20:36:12 | FromGitter | <kaushalmodi> TIL about `reset`: https://nim-lang.github.io/Nim/system.html#reset%2CT |
20:36:33 | FromGitter | <kaushalmodi> hmm, it's *magic* |
20:36:55 | PMunch | Yeah I learnt about it from the whole variant objects can't be changed thing :P |
20:37:13 | * | pvn joined #nim |
20:37:33 | PMunch | Wouldn't really call it magic, it probably just calls memset(ptr, 0, sizeof(theType)) or something like that |
20:37:59 | FromGitter | <kaushalmodi> as in, I cannot see its implementation |
20:38:14 | FromGitter | <kaushalmodi> I don't know where to look if it is implemented using the `magic` pragma |
20:39:00 | PMunch | Oh right, for that you need to go into the compiler and dig around |
20:39:10 | PMunch | There is a nice case statement with all the magics in them IIRC |
20:41:01 | * | brakmic_ joined #nim |
20:41:53 | * | brakmic quit (Read error: Connection reset by peer) |
20:41:55 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:42:45 | Araq | it's like asking where C's '+' is "implemented" |
20:43:07 | Araq | the question is completely misguided. |
20:45:33 | clyybber | kind of related, I think the failing test cases with the =move thing are due to missing to reset temporaries in loops. |
20:49:52 | Araq | huh? but after the =move they should have been reseted. |
20:50:18 | Araq | because that's what =move does. =move is a complete operation, =sink is half |
20:55:36 | * | sagax quit (Ping timeout: 252 seconds) |
20:59:16 | clyybber | yeah, ikr. The temporary doesn't even get moved anywhere in the generated code tho |
20:59:37 | * | deech_ joined #nim |
21:01:12 | clyybber | That temporary is generated due to "a.add(a)" in a loop. |
21:01:32 | * | deech quit (Ping timeout: 244 seconds) |
21:02:20 | clyybber | nvrmind, I must have fucked somewhere |
21:02:32 | clyybber | *fucked up |
21:06:07 | * | natrys quit (Quit: natrys) |
21:08:16 | FromGitter | <arnetheduck> on this topic, `add` was changed to `addInt` to avoid overloads for string+int.. turns out `addInt` already exists as well and thus there are now other overloads.. |
21:10:03 | PMunch | Hmm, can I make a set that contains all the values in an enum? |
21:10:28 | Araq | addInt is only a compilerproc, not exported |
21:10:29 | PMunch | Basically I have two enums, and I want to say something like "if myval in {EnumOne, EnumTwo}" |
21:10:53 | Araq | {low(E)..high(E)} |
21:11:47 | PMunch | Yeah, but that creates a set[E], so I can't join it to a second non-overlapping enum |
21:12:16 | FromGitter | <arnetheduck> yeah, but in `nlvm` I have to override it (like a magic, but detected by function signature) and I was expecting it would have a return type |
21:13:08 | FromGitter | <arnetheduck> so I hit a funny bug when the other overload was added |
21:13:56 | PMunch | Hmm, I don't think enum is the right tool for what I'm trying to do :P |
21:14:05 | Araq | yup. |
21:14:30 | PMunch | A table mapping from int to string seems a bit heavy though.. |
21:14:49 | Araq | arnetheduck: .compilerprocs without a 'nim' prefix are bad but it's hard to change because of bootstrapping reasons |
21:15:36 | FromGitter | <arnetheduck> well there's a bunch of them I have to overload.. what I don't quite understand is why compilerproc is needed to begin with.. ie why can't the compiler look in the full symbol table? |
21:16:33 | FromGitter | <arnetheduck> I wouldn't be surprised if there were compilerproc's around that aren't used any more as well |
21:17:00 | PMunch | Ugh, I need to get some air |
21:17:06 | * | PMunch quit (Remote host closed the connection) |
21:17:12 | FromGitter | <arnetheduck> overload, as in override.. non-compiler-proc stuff.. atomics, bit set ops, memcpy etc.. anything that llvm has a builtin for basically |
21:17:16 | * | dwdv quit (Quit: quit) |
21:17:36 | Araq | well the codegen shouldn't access the symbol table |
21:17:53 | FromGitter | <arnetheduck> has to, in `nlvm`'s case :) |
21:17:59 | Araq | and secondly it supresses "unused symbol X" warnings |
21:18:18 | Araq | it's a reasonably clean design IMO. |
21:21:29 | * | brakmic_ quit () |
21:21:56 | FromGitter | <arnetheduck> I guess the issue I see is that compilerproc means "maybe used by the compiler", and then in nlvm, I need to detect other non-compiler-proc things anyway so there's not too much value for that particular backend.. mainly because I don't want to maintain the patchset on top of the std lib as of yet (that might change if it gets too hacky..).. |
21:22:32 | * | sagax joined #nim |
21:23:08 | * | solitudesf quit (Ping timeout: 272 seconds) |
21:24:45 | Araq | I am not following. |
21:24:56 | Araq | which compilerproc-like procs do you use in nlvm? |
21:26:22 | * | narimiran quit (Remote host closed the connection) |
21:27:44 | clyybber | Araq: It's because the copy-to-sink rule generates a temporary and previously we would generate a wasMoved here: https://github.com/nim-lang/Nim/blob/devel/compiler/injectdestructors.nim#L440 |
21:27:54 | clyybber | So I need a replacement for that wasMoved |
21:28:03 | clyybber | A magic for resetLoc essentially |
21:30:34 | FromGitter | <arnetheduck> actually I confused things, it's the other direction.. there are things that I would want to be magic that are not: https://github.com/arnetheduck/nlvm/blob/master/nlvm/llgen.nim#L2555 |
21:31:20 | FromGitter | <arnetheduck> compilerprocs, I call them but nice and regular through `getCompilerProc`: https://github.com/arnetheduck/nlvm/blob/master/nlvm/llgen.nim#L2279 |
21:33:24 | Araq | arnetheduck: ah, so we shouldn't call .compilerprocs from system.nim |
21:33:36 | Araq | then you wouldn't have to patch addInt the way you do |
21:34:35 | Araq | clyybber: huh? pass copy to sink, but also call the destructor for the copy |
21:34:38 | FromGitter | <arnetheduck> no, I have to patch addint regardless.. it behaves like a magic |
21:35:05 | Araq | no. |
21:35:46 | Araq | you could savely ignore it if only the codegen would use it. your codegen would map '+' to something else. |
21:36:24 | FromGitter | <arnetheduck> oh, but that's where the overflow check is implemented, and I want to override that to use the carry bit stuff that llvm exposes |
21:37:39 | clyybber | Araq: Right, gotta get sleep haha |
21:37:53 | clyybber | Thank you for always being helpful :) |
21:38:17 | FromGitter | <arnetheduck> there's a bunch more of them here as well: https://github.com/arnetheduck/nlvm/blob/master/nlvm/llgen.nim#L2752 |
21:38:19 | * | theelous3 quit (Read error: Connection reset by peer) |
21:38:26 | FromGitter | <arnetheduck> though there, instead of overriding the implementation, I replace the function call so that an inlined llvm instruction is used instead and the "original" implementation in the std lib is never touched thus never generated |
21:42:13 | * | pvn quit (Quit: Leaving.) |
21:54:21 | clyybber | gn8 |
21:54:22 | * | clyybber quit (Quit: WeeChat 2.5) |
22:14:47 | * | Snircle quit (Read error: Connection reset by peer) |
22:15:40 | * | Snircle joined #nim |
22:17:42 | FromGitter | <Varriount> Araq: Will the new runtime change behavior with regards to non-var argument aliasing (for example, with ref objects)? |
22:18:56 | Araq | good question. the aliasing changes for the seq/string implementation in rare cases because it's a (len, ptr) pair now and the len is copied around, previously it was part of the seq |
22:20:05 | FromGitter | <Varriount> Hm. I don't like corner cases. :/ |
22:25:47 | * | lritter quit (Quit: Leaving) |
22:26:53 | * | jjido joined #nim |
22:30:05 | Araq | well, don't alias then :-) |
22:30:46 | * | jjido quit (Client Quit) |
22:31:29 | FromDiscord_ | <djazz> YAS, i got the texture thing working! |
22:31:35 | FromDiscord_ | <djazz> 😃 |
22:43:42 | FromGitter | <mratsim> FYI, I'm creating a new Hot Code Reloading label on the tracker, I expect we will have more and more related issues |
23:01:02 | FromDiscord_ | <djazz> Next step is the .meta file format... |
23:05:34 | Araq | bah, add labels when we need them, not because you anticipate problems |
23:08:22 | FromDiscord_ | <djazz> Gnight, thanks for watching the stream ^^ |
23:08:39 | FromGitter | <mratsim> well I needed it |
23:12:03 | FromGitter | <kayabaNerve> Is shifting an array or adding to a seq and then deleting [0] faster? |
23:12:41 | FromGitter | <kayabaNerve> Example size of 5; a linked list would be perfect tbh. Just not bothering right now. |
23:14:31 | FromGitter | <mratsim> del is faster |
23:14:37 | FromGitter | <mratsim> delete is slow |
23:15:56 | FromGitter | <mratsim> delete(a, n) needs to copy all items between n+1..<a.len to n..<a.len-1 |
23:16:28 | FromGitter | <mratsim> del just move the last item to the deleted item place and then reduce the collection size |
23:16:42 | FromGitter | <mratsim> but it doesn't preserve order |
23:55:05 | * | elrood quit (Remote host closed the connection) |