<< 18-10-2018 >>

00:09:18*zachk quit (Quit: Leaving)
00:09:56*darithorn quit ()
00:11:45*floppydh quit (Ping timeout: 252 seconds)
00:13:57*floppydh joined #nim
00:37:08*banc quit (Ping timeout: 245 seconds)
00:37:23*banc joined #nim
01:00:39*druonysus quit (Read error: Connection reset by peer)
01:14:15FromGitter<zacharycarter> https://github.com/maiavictor/formality - Rust project specifically mentioning the EVM
01:14:28FromGitter<zacharycarter> isn't ethereum moving to eWASM or something?
01:14:49FromGitter<zacharycarter> the whole crypto space is a giant ball of confusion
01:17:03FromGitter<arnetheduck> ewasm is years away
01:21:16FromGitter<zacharycarter> ah
01:22:52FromGitter<zacharycarter> @arnetheduck - I'm leaving my current position soon, and taking a sabatical to do some further theoretical / DS and algo learning - I'm hoping to re-apply at status in the not-so distant future
01:23:36FromGitter<zacharycarter> but I also need to up my crypto knowledge, because I'm also very lacking in that area
01:24:34FromGitter<zacharycarter> in regards to both cryptography and ethereum
01:25:25FromGitter<zacharycarter> it's very cool to have a bridge to learn about all these concepts and topics via Nim
01:25:44FromGitter<zacharycarter> or a gateway - I guess is a better analogy
01:28:43FromGitter<rayman22201> @zacharycarter you should blog / stream your progress as you do this. It will give you some good "street cred" and it will benefit people wanting to learn Nim and people wanting to learn more about crypto.
01:28:48FromGitter<zacharycarter> I also want to write my own forth interpreter and write my own compiler, and then of course work on the next iteration of my hobby game engine
01:29:01FromGitter<zacharycarter> so who knows wtf I will end up actually working on / learning :P
01:29:31FromGitter<zacharycarter> @rayman22201 - that's a really good idea - I guess whatever I end up pursuing (I have a feeling it will be the game engine / graphics programming stuff) - I'll definitely try to find a way to incorporate that
01:29:43FromGitter<zacharycarter> I'm going to have a ton of free time to figure things like that out - which I'm very much excited about having
01:29:50FromGitter<rayman22201> :D awsome
01:30:27FromGitter<zacharycarter> It's funny - I shared an article in my work's slack channel earlier about algos / data structures
01:30:41FromGitter<zacharycarter> and a guy that recently joined was like - why the hell are you sharing this? doesn't everyone know this crap already?
01:31:05FromGitter<zacharycarter> and then I had to figure out a polite way to say no - especially the people I work with on a consistent basis
01:31:17FromGitter<rayman22201> Well, that's rude. Even though I know a lot of CS, I like to read articles and brush up my knowledge.
01:31:36FromGitter<zacharycarter> yeah - i have a feeling he's fresh out of a comp-sci or masters degree
01:31:43FromGitter<zacharycarter> and just kind of didn't think about what he was typing
01:32:10FromGitter<rayman22201> Your point about politeness is valid regardless.
01:32:31FromGitter<zacharycarter> but - he has a good point - like everyone SHOULD know this stuff if they want to work in software, and if they don't have that passion, then there needs to be some kind of distinction b/w those that do and those that don't
01:32:39FromGitter<zacharycarter> unfortunately, we don't have that / have never had that
01:33:12FromGitter<zacharycarter> so we talked 1 on 1 and kind of compared / contrasted our learning experiences - like he started with circuitry / breadboards / assembly language / C
01:33:23FromGitter<zacharycarter> and I started with HTML / JavaScript, then CSS then VB.NET then C# etc
01:33:32FromGitter<zacharycarter> so it was very cool / insightful to compare and contrats
01:33:44FromGitter<rayman22201> yeah. definitely.
01:34:08FromGitter<arnetheduck> the rigor in thinking will help you craft better code that needs less refactoring and behaves in a more predictable way.. that said, not all useful or great looking products have that - the road to great outcomes can take many turns.
01:34:32FromGitter<zacharycarter> yeah - I think simplicity and iteration are so important
01:34:42FromGitter<zacharycarter> don't seek out complexity and don't be afraid to fail fast
01:35:40FromGitter<zacharycarter> that's another frustration I have - like my job emphasizes pair programming, but I work with a dev that only cares about HTML / JS / CSS
01:35:43FromGitter<rayman22201> Also people take many paths to coding. I've seen amazing programmers come out of "code bootcamps" and shitty programmers with masters degrees.
01:35:59FromGitter<arnetheduck> there's also the domain to consider - sometimes it simply doesn't matter (ie a web ui or game) - but in the case of a project like nimbus, the difference between one and the other will be costly
01:36:45FromGitter<zacharycarter> it's so frustrating pairing with someone that doesn't have a drive or desire to learn, and just wants to write code
01:36:58FromGitter<zacharycarter> forced pair programming is the worst IMO
01:37:38FromGitter<rayman22201> Ironic that HN just had a thread on this: https://news.ycombinator.com/item?id=18245120
01:37:42FromGitter<zacharycarter> @rayman22201 - yeah - that's true as well, although I think it just really depends on how passionate the person is about programming
01:37:54FromGitter<zacharycarter> :P
01:38:19FromGitter<zacharycarter> @arnetheduck - well, it sucks that web dev and other dev gets relegated to that domain
01:38:29FromGitter<zacharycarter> I'd love to write performant web apps at work - but it's not possible
01:38:55FromGitter<zacharycarter> my company will spend 3+ months optimizing a JavaScript frotnend, and spend zero effort on backend optimziation
01:39:15FromGitter<zacharycarter> also - they pass JSON between backend services everywhere
01:39:20FromGitter<zacharycarter> rarely utilize caching
01:39:34FromGitter<zacharycarter> just, rookie level stuff - that even myself, not having a CS degree, can find major faults with
01:39:48FromGitter<zacharycarter> and when you point out these issues - but don't solve them yourself - you're a malcontent
01:40:45FromGitter<zacharycarter> and when you want to introduce a new idea or performant technology - you face a mountain of criticism / have to defend yourself to a soul-crushing degree
01:40:54FromGitter<zacharycarter> to the point that it's not worth it, and you either leave or adapt
01:41:24FromGitter<rayman22201> https://en.wikipedia.org/wiki/Peter_principle
01:41:55FromGitter<zacharycarter> yup! and then they flatten the engineering org
01:42:05FromGitter<zacharycarter> and just randomly people will rise to positions of autonomy
01:42:08FromGitter<arnetheduck> no, it doesn't suck - it's a reasonable tradeoff. the user experience of a web site is more important than its performance - whether you use a linked list or an array really doesn't matter in that context as long as it's not blatantly and obviously bad - it is rare that you even need to know the difference in that context. also, if a single web page on the internet is poor, it's really not the end of the world. all
01:42:08FromGitter... the other web pages keep working.
01:42:09FromGitter<zacharycarter> with zero transparency
01:42:51FromGitter<zacharycarter> I'd argue that the modern web experience does holistically suck
01:43:23FromGitter<zacharycarter> and a lot of that is due to software bloat / not paying attention to efficient and performant coding practices
01:43:53*vlad1777d__ quit (Remote host closed the connection)
01:43:54FromGitter<zacharycarter> and with the focus on SEO these days, at least in my experience with the company I work for - having a performant web stack is becoming increasingly important
01:44:10FromGitter<zacharycarter> which directly contradicts all the attention on aesthetics that the modern web dictates
01:44:30FromGitter<zacharycarter> a visit to a modern news website will take several megs of bandwidth for 250k of text
01:44:39FromGitter<zacharycarter> if you ask me - it's because it's not a reasonable tradeoff
01:45:40*vlad1777d joined #nim
01:47:13FromGitter<rayman22201> It's economics. I did webdev for a long time. I got sick of it. The economics just dictate that it's not worth companies putting money into hiring better people. At the end of the day, google is still showing the links in their results, and showing their ads, and "joe schmoe" is still using the website, and paying them money. Consumers don't know any better, and don't really care. You have to remember that you
01:47:13FromGitter... aren't the target market. Your parents and less-computer literate peers are.
01:47:15FromGitter<arnetheduck> beyond "good enough performance", in the majority of applications you're just wasting time. it's a bit like optimizing a parser for command line arguments - sure, it's a fun intellectual exercise, but for all intents and purposes, it doesn't matter the least.
01:47:50FromGitter<zacharycarter> well - please explain that to my org, because they're wasting millions of dollars in that case
01:47:56FromGitter<zacharycarter> trying to outrank cargurus in SEO
01:48:22FromGitter<arnetheduck> seo matters in that case - not compsci 101
01:48:33FromGitter<zacharycarter> well if you have people writing bad javascript
01:48:35FromGitter<rayman22201> There are industries where this is different. Banking, crypto, those have higher standards because they loose a lot of money if they don't. Thus they put out money to hire the kind of people that excel in those area.
01:48:36FromGitter<zacharycarter> I mean
01:48:38FromGitter<zacharycarter> ...
01:49:16FromGitter<rayman22201> Gaming is interesting, because they care about performance, but not necessarily reliability. So different kinds of patterns appear there.
01:49:25FromGitter<zacharycarter> I'm not implying the web stack is as critical as what you work on
01:50:01FromGitter<rayman22201> I'm not saying one is better / more critical than the other. Just that the people with the money have different ideas about what is "good"
01:50:03FromGitter<zacharycarter> I'm saying if someone is allocating inside of a loop or writing terrible nested conditional logic because they dont' know any better
01:50:03FromGitter<rayman22201> or good enough
01:50:32FromGitter<zacharycarter> it's not helping in any scenario - and the more folks understand about programming / computer science in general and how to measure the performance of the code they're authoring, the better off they will be
01:51:07FromGitter<zacharycarter> I know that I've operated for over a decade at a high level of understanding - and I've regretted my lack of low level knowledge
01:51:09*vlad1777d quit (Ping timeout: 268 seconds)
01:51:32FromGitter<rayman22201> Unless, they don't care, b/c they are just looking for a paycheck.... which is sadly a lot of people
01:51:35FromGitter<zacharycarter> I'm sure it's not essential to things - but I also know that software is very bloated these days and slow and it's layered and I think that's a result of programmers getting lazy and not caring
01:51:44FromGitter<zacharycarter> > Unless, they don't care, b/c they are just looking for a paycheck.... which is sadly a lot of people
01:52:25FromGitter<rayman22201> and it seem like a lot of those people end up in webdev... because that industry can tolerate that kind of crap. again, unfortunately.
01:52:38FromGitter<zacharycarter> yeah - that's why I'm out
01:52:46FromGitter<zacharycarter> it's really enterprise dev
01:52:51FromGitter<zacharycarter> just don't get into that scene IMO
01:53:10FromGitter<zacharycarter> as soon as you start hearing those buzz words
01:53:13FromGitter<rayman22201> lol... true... the amount of bad enterprise Java I've seen would give you nightmares
01:54:47FromGitter<rayman22201> anyway. Despite the personal / philosophical stuff, I hope you get to play with Nim more. I wish I could. viva la Nim :-)
01:56:37FromGitter<yyyc514> is having a method/proc named the same as my module not possible?
01:56:46FromGitter<yyyc514> "Error: expression 'runtime' has no type (or is ambiguous)"
01:56:50FromGitter<yyyc514> even if i try runtime.runtime
01:56:54FromGitter<yyyc514> renaming it it works fine though
01:57:10FromGitter<zacharycarter> @rayman22201 thank you! me too!
01:57:49FromGitter<zacharycarter> and I hope you get to as well!
01:59:21FromGitter<zacharycarter> @yyyc514 - I don't have a definitive answer for you, but maybe I can help provide some insight
01:59:35FromGitter<zacharycarter> https://nim-lang.org/docs/manual.html#modules-scope-rules & https://github.com/nim-lang/Nim/issues/4971
02:00:08FromGitter<zacharycarter> going to sign off for the night - have a good one all
02:00:17FromGitter<yyyc514> i’d think this might fall under qualification
02:00:47FromGitter<yyyc514> thanks
02:01:29FromGitter<zacharycarter> 👍
02:04:53*banc quit (Quit: ZNC - http://znc.in)
02:13:46*darithorn joined #nim
02:20:24*banc joined #nim
02:41:37*dddddd quit (Remote host closed the connection)
02:43:23*arecaceae quit (Remote host closed the connection)
02:43:41*arecaceae joined #nim
02:44:06*endragor joined #nim
03:08:19*chemist69_ joined #nim
03:11:56*chemist69 quit (Ping timeout: 268 seconds)
03:35:02FromGitter<yyyc514> does nim have anything like elixir’s |> for chains of things?
03:36:28FromGitter<kaushalmodi> can you give an example?
03:36:39FromGitter<kaushalmodi> do you know of the Nim UFCS syntax?
03:36:59FromGitter<yyyc514> lol
03:37:23FromGitter<yyyc514> (https://files.gitter.im/nim-lang/Nim/CWnp/Screen-Shot-2018-10-17-at-11.37.00-PM.png)
03:37:42FromGitter<yyyc514> pipes output into the first parameter of the next call
03:37:58FromGitter<kaushalmodi> why lol? just asking asked because I wasn't sure what you meant
03:38:54FromGitter<kaushalmodi> depending on if the proc signatures are designed for use with UFCS and in which combination you are using those procs, that is possible.
03:41:04FromGitter<yyyc514> in that case you could just chain with ., yes?
03:41:24FromGitter<kaushalmodi> yep
03:41:49FromGitter<yyyc514> well isn’t that a neat trick :)
03:42:50FromGitter<kaushalmodi> Nim calls it *Command Invocation Syntax* for some reason: https://nim-lang.github.io/Nim/manual.html#procedures-command-invocation-syntax
03:43:10FromGitter<kaushalmodi> but I think this is more commonly known as UFCS: https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax
03:43:45FromGitter<yyyc514> teaching me new acronyms
03:45:05*smt quit (Read error: Connection reset by peer)
03:46:04*smt joined #nim
03:52:23leorizekaushalmodi: *Command Invocation Syntax* is **not** UFCS...
03:52:46FromGitter<kaushalmodi> oops
03:52:50leorizein Nim it's actually called the *Method call syntax*
03:53:29FromGitter<kaushalmodi> This example in Command Invocation Syntax uses UFCS: `let y = 1.optarg optarg 8`
03:54:08leorizeyou do realise it was trying to demonstrate the syntax, right?
03:54:23leorizein UFCS you'd have to: `let y = 1.optarg(8)`
03:55:09leorizebut we can omit the parentheses since there's command call syntax
03:55:16FromGitter<kaushalmodi> thanks for correcting me
03:55:32FromGitter<kaushalmodi> so optional parens is command invocation syntax?
03:55:41leorizeyep
03:55:49leorizequite unique I'd say
03:55:57FromGitter<kaushalmodi> and dot-chaining aka UFCS is method call syntax?
03:56:03FromGitter<kaushalmodi> *time to fix notes*
04:18:13FromGitter<yyyc514> hmmmm can i not pass the name of a proc in place of a inline function?
04:19:10FromGitter<yyyc514> but expression 'router' is of type: void
04:28:48FromGitter<yyyc514> the exact example in first class functions works
04:28:55FromGitter<yyyc514> mabye it’s because i’m inside another proc and the scope is different?
04:29:35FromGitter<yyyc514> nope
04:32:32*darithorn quit ()
04:33:10FromGitter<yyyc514> maybe i’m missing some pragma?
04:34:05leorizewhat are you trying to do?
04:34:19FromGitter<yyyc514> pass a proc
04:34:48FromGitter<kaushalmodi> can you paste a code snippet?
04:35:30FromGitter<yyyc514> https://gist.github.com/yyyc514/b91b59fdd6bb52d0f29eb42952819e8b
04:37:11FromGitter<kaushalmodi> what is `router` in that example? may be a minimal all-inclusive example would help
04:37:33FromGitter<yyyc514> added
04:37:46FromGitter<yyyc514> it’s just a proc
04:37:55FromGitter<yyyc514> that matches the call protocol
04:38:47FromGitter<yyyc514> oh grrrr it’s probably the name of the improt killing me again
04:38:54FromGitter<yyyc514> import router and then also a router rpco
04:38:59FromGitter<yyyc514> let me change that :)
04:39:02FromGitter<kaushalmodi> that would do it
04:39:22FromGitter<kaushalmodi> /because I did a simpler version of what you are doing yest and it works./
04:39:36leorizesame here
04:39:52FromGitter<yyyc514> yep that fixes it :)
04:48:17FromGitter<yyyc514> @kaushalmodi thanks
05:19:32*floppydh quit (Quit: WeeChat 2.2)
05:31:31*nsf joined #nim
05:36:51*Cthalupa quit (Ping timeout: 268 seconds)
05:38:59*Cthalupa joined #nim
05:52:28*krux02 joined #nim
05:55:14FromGitter<yyyc514> how can i have a proc that optimzies differently depending on if it’s given a constant or not?
05:55:21FromGitter<yyyc514> if it’s constant it can be {.compileTime}
05:56:37leorizethe compiler can usually infer {.noSideEffects.} functions and optimize them at compile time
05:57:08FromGitter<yyyc514> oh so this is built in?
05:57:27FromGitter<yyyc514> i was imagining like string helpers etc
05:57:41FromGitter<yyyc514> “constant”.toUpperAscii could be done at comile time
05:57:43FromGitter<yyyc514> for example
05:58:01leorize`const someConst = "constant".toUpperAscii`
05:58:05leorizeyep, done at compile time
05:58:16FromGitter<yyyc514> sure if you use const, but if not will it figure it out?
05:58:29leorizeone way to know, try it
05:59:27FromGitter<yyyc514> nope seems dynamic
05:59:38FromGitter<yyyc514> even if the proc only takes constant input
06:00:57FromGitter<yyyc514> wait, how would i test that properly?
06:01:15leorizeread the generated C code, ofc
06:01:30leorizebut the C compiler might optimize it
06:01:36leorizeso read the assembly
06:01:43FromGitter<yyyc514> ok another day :)
06:02:02FromGitter<yyyc514> might be getting into premature optimization
06:04:38leorizeyea compile time eval only stop at `const` & `static` section
06:05:12leorizeso if you want your `proc` to only work in VM context, use `{.compileTime.}`
06:05:38FromGitter<yyyc514> yeah but then if you give it a variable it throws an obscure compiler error :)
06:05:51FromGitter<yyyc514> i was wanting best of both worlds
06:06:15leorizehttps://nim-lang.github.io/Nim/manual.html#special-types-static-t
06:08:09FromGitter<yyyc514> i think i was hoping static would be a part of the overloading so i could just write both functions, one static and one not
06:08:47FromGitter<yyyc514> probably could do it with macros
06:09:29leorize`static` is a part of the overloading resolution
06:15:01*smt quit (Read error: Connection reset by peer)
06:15:04FromGitter<yyyc514> well then maybe it would work :)
06:15:31leorizeand static param is pretty weird
06:15:53leorizefor example: `echo toUpperAscii toLowerAscii "constant"`
06:16:15leorizetoUpperAscii here takes a `static string`, but there's also an overload for `string`
06:16:29leorizetoLowerAscii is the stock one from strutils
06:17:04leorizeinstead of running in runtime (like it does if you don't have the `static` version)
06:17:23leorize`toLowerAscii` is evaluated during compile time
06:19:13leorizehttps://ptpb.pw/8cFg/nim
06:22:09FromGitter<yyyc514> nice
06:23:29FromGitter<yyyc514> seems like a pretty verbose way to get a small speedup though
06:23:41leorizethe sad part is that `toUpperAscii` is still evaluated at runtime
06:23:51leorizeyea, this is literally premature optimization :P
06:24:03leorizeinstead, use `const` whenever you can
06:24:35FromGitter<yyyc514> wait what? why would toLower be evaluted at compile time but not too upper?
06:25:23leorizeyes, it compiles into a special `proc` that takes nothing and operate on the string directly
06:25:35leorizewhich is how `static[T]` works
06:26:08FromGitter<yyyc514> and you’re seeing this from the C output?
06:26:12leorizeyep
06:26:28leorizehttps://ptpb.pw/pHw9/nim
06:26:41leorizeand here is how to make something `{.compileTime.}`
06:27:10FromGitter<yyyc514> yeah i tried that earlier
06:27:26FromGitter<yyyc514> i was playing with variables or not though not layers of functions
06:41:59FromGitter<yyyc514> name params with macors is a bit funny
06:42:14FromGitter<yyyc514> in that if you just break the syntax slightly now your named params gets whatever
06:55:00FromGitter<yyyc514> doe a macro have access to the name of the current file context it’s running inside of?
06:56:34FromGitter<yyyc514> what could lineInfoObj be :)
07:01:12FromGitter<yyyc514> though it needs a node to work with
07:01:18FromGitter<yyyc514> just just call a macro with no params
07:03:18FromGitter<yyyc514> ok nope you can just use the empty resul’ts AST :)
07:08:33FromGitter<yyyc514> macros may not work so well with filters though
07:12:13FromGitter<yyyc514> has anyone played with stdtmpl and macros before?
07:18:41*PMunch joined #nim
07:20:01*sagax joined #nim
07:21:05FromGitter<technicallyagd> You mean generating macros with SCF?
07:21:25FromGitter<yyyc514> trying to use a macro inside stdtmpl to write a template :)
07:21:32FromGitter<yyyc514> not even sure that’s supported in general
07:22:45FromGitter<technicallyagd> Gonna try that now
07:23:29FromGitter<yyyc514> the source for it is matching keywords in order to do the proper spacing
07:23:40FromGitter<yyyc514> it doesn’t have any code to match on “:” that i see so i think the spcing would forever be wrong
07:24:05FromGitter<yyyc514> which kind of makes sense with what i’m seeing
07:27:06FromGitter<yyyc514> https://gist.github.com/yyyc514/302ebd7341b7ecb6f64eb9d75a975ce7
07:27:15FromGitter<yyyc514> was trying to make a macro to write that boiler plate
07:29:32FromGitter<alehander42> @Araq I saw that, what I did was a helper to actually load karaxdsl templates from different files on compile time (e.g. let page = render("main_view"))
07:29:55FromGitter<alehander42> so I wondered if this should be included somewhere
07:30:28FromGitter<yyyc514> are you talking to me at all?
07:30:33FromGitter<yyyc514> looks related even if it’s not lol
07:31:51FromGitter<technicallyagd> @yyyc514 the gist you provided works though?
07:32:43FromGitter<yyyc514> yes what i provided works
07:32:56FromGitter<yyyc514> i wanted to remove the ‘result’ boiler plate and auto-generate the name of the template based on the filename
07:33:22FromGitter<yyyc514> but i’m not sure source code filters is advanced enough for that
07:34:13FromGitter<technicallyagd> So you want a macro that creates template for you with different names
07:34:30FromGitter<yyyc514> inside a code filter file :)
07:34:47FromGitter<yyyc514> i’m not sure if macros can write templates in general, i’ve never tried
07:35:15FromGitter<yyyc514> but i think the larger issue is there seems to be no way to run a macro inside a code filter and also pass it a block
07:36:52FromGitter<technicallyagd> I am still unsure of how you want to use this macro
07:37:14FromGitter<yyyc514> `# view:` LOL
07:37:37FromGitter<yyyc514> then it spits out the boilter plate proper template, etc
07:37:53FromGitter<yyyc514> and i’d have a 3 line header
07:38:03FromGitter<yyyc514> #stdtmpl, import view, and view:
07:38:06FromGitter<yyyc514> whoa
07:38:42FromGitter<technicallyagd> what is `view`?
07:38:43FromGitter<yyyc514> having to include the name right now is the most annoying aprt
07:38:55FromGitter<yyyc514> it would be a macro that writes the view template
07:39:02FromGitter<yyyc514> which is what the whole gist is
07:39:35FromGitter<yyyc514> updated gist
07:40:03FromGitter<technicallyagd> Ah I see
07:41:08FromGitter<yyyc514> i’ll probably end up havign to reimplement the stdtmpl stuff myself to just work on “raw” files without any header boilerplate
07:46:01FromGitter<alehander42> @yyyc514 I wasn't addressing you, but you might also find it interesting
07:46:11sagaxhi all!
07:46:17sagaxwe have some web framework?
07:46:22FromGitter<alehander42> I am using dsl similar to https://github.com/pragmagic/karax/blob/master/examples/mediaplayer/mediaplayer.nim#L29 without any boilerplate
07:46:50leorizesagax: there're plenty
07:46:53FromGitter<yyyc514> sagax: i’m working on one :) there is also Jester
07:46:58FromGitter<yyyc514> oh, there are plenty?
07:47:04FromGitter<yyyc514> what else is big other than jester?
07:47:33FromGitter<yyyc514> @alehander42 yeah i want/need RAW html
07:47:40FromGitter<yyyc514> i don’t want to write in some psuedo html thingy
07:47:41leorizemofuw, or Meccha hayai Asynchronous I/O no super Fast de Ultra minimal na Web
07:48:00leorizeyes, it's a thing :P https://github.com/2vg/mofuw
07:48:15sagaxwell
07:48:36sagaxgood
07:48:42sagaxwill se this framework
07:49:03FromGitter<yyyc514> cool might be good to look at for inspiration but i think i’m wanting to build something a bit larger :)
07:49:25leorizethere's also httpbeast by dom96
07:49:33FromGitter<yyyc514> sagax: it’s probably a few days away from actually doing much, though i think i’ve figured out a lot of foundational stuff
07:49:39FromGitter<yyyc514> i’d call beast a server not a framework
07:49:49FromGitter<yyyc514> like asynchttpserver is a server
07:49:53FromGitter<alehander42> @yyyc514 I hate raw html, xml-like syntaxes take so much space
07:50:04FromGitter<alehander42> yeah httpbeast is a server
07:50:13FromGitter<alehander42> a bigger framework would be very cool to see
07:50:27FromGitter<yyyc514> my background is Rails and Phoenix
07:51:04FromGitter<yyyc514> so far i have simple routing, before and after processors, middleware, and working on controllers and templates now
07:52:27FromGitter<yyyc514> well controllers work actually it’s just templating and bulking them up a bit more
07:53:13FromGitter<yyyc514> so this is aiming to be less minimal than Jester, although at first i’m just going to build on top of the Jester foundation (ripping out the router)… that’ll get something running fast
07:53:41FromGitter<yyyc514> i’m curious about the value of having some standard HTTP wrapper like Rack that would make working with different back ends simpler
07:54:03FromGitter<yyyc514> so i’m building that in the middle and then maybe later we can push it out
07:56:37FromGitter<yyyc514> (https://files.gitter.im/nim-lang/Nim/ArQ6/Screen-Shot-2018-10-18-at-3.56.18-AM.png)
07:56:44FromGitter<yyyc514> ie, much more app like structure vs “everything in one big file"
08:08:56FromGitter<mratsim> ugh, so many folders
08:09:44PMunchHmm, unsafeAddr tells me it has no address and says that I should try to use unsafeAddr
08:09:52FromGitter<mratsim> I’m curious, so many people from Ruby try Elixir and Crystal, what brought you to Nim?
08:10:16FromGitter<mratsim> @yyyc514 ^
08:12:38FromGitter<yyyc514> i’ve tried Elixir and Crystal :) is it either or ? :)
08:13:15FromGitter<yyyc514> i found: https://totallywearingpants.com/posts/nim-underdog/
08:13:36FromGitter<yyyc514> i like that it compiles to C (and JS) and might even be usable (for me) in an arduino context one day
08:13:38FromGitter<mratsim> not really more like curious of what brought you here
08:14:03FromGitter<yyyc514> i liked that it’s small and fast, that the compiler can compile itself so quickly is hugely impressive
08:14:09PMunchyyyc514, Nim does run on Arduino
08:14:10FromGitter<mratsim> For embedded: https://github.com/VPashkov/awesome-nim#embedded
08:14:14FromGitter<yyyc514> if you’ve ever tried to build rust or crystal :)
08:14:31FromGitter<mratsim> I did try Rust for a couple of months before Nim, didn’t try crystal
08:14:58FromGitter<yyyc514> i tried crystal a year or two ago, been a while
08:15:31FromGitter<mratsim> Crystal main issu I would say is the syntax with `end` that I just don’t like and the lack of Windows support.
08:15:49FromGitter<yyyc514> i don’t mind end, coming from Ruby of course :)
08:15:51FromGitter<mratsim> Ah, the OOP focus.
08:15:58FromGitter<yyyc514> the python way is kind of blah, but i can get used to it
08:16:09FromGitter<mratsim> I suppose I can get used to it as well
08:16:26FromGitter<yyyc514> yeah i havent’ looked at hacking objects with macros yet, but my middleware stuff comes awefully close
08:17:17FromGitter<alehander42> @yyyc514 yeah something more unified like rack would be nice, currently httpserver and httpbeast's server api-s are not too different (something like jester's request.nim can be also expected)
08:18:58FromGitter<yyyc514> well you’d start with very low-leverl (like rack, ENV and 3 piece typle responses) and then build on top of that
08:19:04FromGitter<yyyc514> like a generic request object just to make things nicer
08:19:17FromGitter<yyyc514> proc toTuple*(r: Response) : RackOut =
08:19:19FromGitter<yyyc514> lol :)
08:20:08FromGitter<yyyc514> and request would wrap ENV and just make it nicer
08:20:15FromGitter<yyyc514> right now both async and httpbeast are trying to do too much
08:20:27FromGitter<yyyc514> trying to build the whole abstraction because no one else has
08:20:40FromGitter<alehander42> also, a way to use a custom template would be cool (I guess you can staticRead a config file and import `<current_template_lib>` based on it)
08:20:54FromGitter<yyyc514> custom template?
08:21:21FromGitter<yyyc514> eventually you’d want the ability to have different types of template files i presume
08:21:31FromGitter<yyyc514> but i’m not sure how that works with the compiler workflow
08:21:36FromGitter<alehander42> yeah, this would make sense, especially if it's zero overhead (no unnecesarry object alocations)
08:21:45FromGitter<alehander42> I described a possible way above
08:22:04FromGitter<yyyc514> no i mean how to parse and get all the individual templates into the binary
08:22:05FromGitter<mratsim> I vote for renaming Alexander to alehanderZero instead of Alehander42
08:22:05FromGitter<alehander42> where you can generate the import statement in a macro
08:22:27FromGitter<yyyc514> no cross-platform way to walk the file tree with compiler
08:23:05FromGitter<alehander42> and e.g. expect that a template system defines `render(source: string): Stuff`
08:23:41FromGitter<alehander42> ah well I do it also with a macro currently
08:23:51FromGitter<mratsim> Ah I’d like to embed html templates and JS into a Nim binary like what is possible in go https://github.com/zserge/webview#how-to-serve-or-inject-the-initial-htmlcssjavascript-into-the-webview
08:23:55FromGitter<yyyc514> that presumes you arent’ passing render dynamic values i think
08:24:17FromGitter<yyyc514> render(variable) kind of falls on it’s face
08:24:23FromGitter<yyyc514> since variable isn’t known at compile time
08:24:26FromGitter<yyyc514> but maybe you just don’t allow that
08:24:27FromGitter<technicallyagd> @yyyc514 LOL I got it to work.
08:24:27FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bc8433bc08b8b306732186a]
08:24:44FromGitter<yyyc514> that’s a constant
08:24:45FromGitter<yyyc514> not a variable :)
08:25:03FromGitter<technicallyagd> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bc8435fc08b8b30673218bc]
08:25:04FromGitter<yyyc514> view_name : string; render(view_name) is a whle other thing
08:25:34FromGitter<alehander42> it is a string, I just used `untyped` out of habit
08:25:40FromGitter<yyyc514> @technicallyagd what the hell? is the trick your emit or what
08:25:48FromGitter<technicallyagd> yeah
08:25:51FromGitter<alehander42> I don't understand what you mean by constant
08:25:57FromGitter<yyyc514> @alehander42 it’s a constant at compile time
08:26:00FromGitter<yyyc514> KNOWN
08:26:05FromGitter<technicallyagd> I manually put 2 spaces before result.add
08:26:05FromGitter<alehander42> what is a constant?
08:26:11FromGitter<technicallyagd> so the indentation will be correct
08:26:16FromGitter<alehander42> the path name?
08:26:22FromGitter<yyyc514> the filename
08:26:34FromGitter<yyyc514> @technicallyagd damn is that all it is?
08:26:49FromGitter<yyyc514> @technicallyagd is that generating the template also?
08:26:52FromGitter<technicallyagd> the `view` macro is super ugly though
08:27:09FromGitter<technicallyagd> I will update a gist, hold on
08:27:58FromGitter<alehander42> well, I very rarely need to pass a dynamic path honestly
08:29:14FromGitter<technicallyagd> @yyyc514 https://gist.github.com/technicallyagd/27e5e51f6f3cc5778f8e873304c57e7a
08:29:24FromGitter<alehander42> @yyyc514 but still that's not a big problem: you can do something else, load all the templates on compile time and assign each one to a function, this way you would be able to render them dynamically
08:29:34FromGitter<technicallyagd> All three files included
08:30:44FromGitter<yyyc514> can’t you quote any of that?
08:31:03FromGitter<yyyc514> yeah the loading them all at compile time seaptely was what i was wondering about
08:32:49FromGitter<yyyc514> (https://files.gitter.im/nim-lang/Nim/RDmx/Screen-Shot-2018-10-18-at-4.32.33-AM.png)
08:33:25FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bc84555271506518d2e75ed]
08:33:39FromGitter<alehander42> you basically need to generate something like this in a macro
08:33:54FromGitter<yyyc514> but you need all the paths :)
08:34:05FromGitter<yyyc514> so now you’re getting into a small build process :)
08:34:07FromGitter<yyyc514> not impossible
08:34:12FromGitter<yyyc514> but i don’t know how to do it all in one pass
08:34:42FromGitter<alehander42> well the framework probably expects the views to be in certain directories
08:34:42FromGitter<yyyc514> @technicallyagd any way to get rid of import view without glocally importing it everywhere? (which i think the compiler can do?)
08:34:59FromGitter<yyyc514> @alehander42 lol it would but you still can’t iterate over the filesystem inside the VM
08:35:07FromGitter<yyyc514> you can’t find out which files are present
08:35:11FromGitter<yyyc514> so you don’t known which ones to compile
08:35:21FromGitter<alehander42> ah
08:35:56FromGitter<yyyc514> all the file stuff (other than static read) is locked up inside `os` which is OS dependent and not accessible from the VM
08:36:15FromGitter<technicallyagd> @yyyc514 If you import it in `main.nim` before including the template then it would probably work
08:36:21FromGitter<yyyc514> you can drop to shell and do something like `find` but now you’re back to if that works on windows or not :)
08:36:42FromGitter<yyyc514> oh
08:36:45FromGitter<yyyc514> the template was imported
08:36:51FromGitter<yyyc514> but yeah if in inculded it you’re right i think
08:37:17FromGitter<yyyc514> include doesn’t support the nice syntax
08:37:27FromGitter<technicallyagd> @yyyc514 `quote` is awesome, I didn't know it exists lol. I will update the gist, hold on.
08:37:32FromGitter<yyyc514> import views/pastes / [index, show]
08:37:44FromGitter<yyyc514> @technicallyagd ok i have it working though :)
08:38:01FromGitter<yyyc514> yeah quote is super helpful if you don’t need to insert too much dynamically
08:39:00FromGitter<yyyc514> now if i could just do a global include for the view macro itsel then it imporst the other view stuff….
08:39:23FromGitter<technicallyagd> Yeah I think you need to include it instead of importing it
08:39:35FromGitter<technicallyagd> I meant the macro
08:39:38FromGitter<yyyc514> would --import:PATH get the job done?
08:40:22FromGitter<yyyc514> yep
08:41:28FromGitter<yyyc514> SWEET
08:41:32FromGitter<yyyc514> 2 line header
08:41:50FromGitter<technicallyagd> import for the `macrosTemp.tmpl`?
08:42:13FromGitter<yyyc514> i just imported the view.nim which has the view macro globally
08:42:23FromGitter<yyyc514> if i add more stuff to it theni’ll split it out and have it do it’s own imports
08:43:14FromGitter<yyyc514> grrrrr
08:43:17FromGitter<yyyc514> only works on empty files
08:43:25FromGitter<yyyc514> because the padding for the COMMANDS is now wrong
08:43:29FromGitter<yyyc514> only HTML works
08:44:19FromGitter<yyyc514> well damn
08:45:16FromGitter<technicallyagd> COMMANDS?
08:45:24FromGitter<yyyc514> embedded code
08:45:31FromGitter<yyyc514> `# if true == true: ⏎ <h1>hello world</h1>`
08:45:39FromGitter<yyyc514> the if needs two extra spaces
08:46:03FromGitter<yyyc514> you fixed the string concat for HTML for not the inline code
08:46:12FromGitter<technicallyagd> Ah damn
08:46:40FromGitter<yyyc514> the compiler needs to be extended to support “do"
08:47:07FromGitter<yyyc514> but wait can’t you use do randomly with other things?
08:48:26FromGitter<yyyc514> @alehander42 but yes you’re completely right if your view name are known at compile time a simple macro will get it done
08:49:46FromGitter<yyyc514> actually if ou’re using a macro you can’t truly pass a variable to it
08:49:55FromGitter<yyyc514> without turning the whole thing into a runtime call
08:50:14FromGitter<yyyc514> but i’d say for 99% of uses it’d be static :)
08:51:50FromGitter<yyyc514> wait
08:51:56FromGitter<yyyc514> what is this strong spaces parser?
08:53:33FromGitter<alehander42> @yyyc514 yeah, but you can still have the best of both worlds
08:53:56FromGitter<alehander42> a macro for compile-time constant paths
08:54:05FromGitter<alehander42> and a proc for variables
08:54:27FromGitter<yyyc514> how would your proc work? :) i was assumign the templates included code that needed to be compiled
08:54:50FromGitter<alehander42> I am not sure about staticReadDir: maybe we can add it to the vm, but in the worst case one can also use staticExec
08:55:08FromGitter<yyyc514> yeah that’s the hack that’s not cross platform safe :)
08:55:45FromGitter<alehander42> @yyyc514 well it doesn't have to be ;)
08:55:47FromGitter<yyyc514> oh for sure if the VM includes a few things to walk the dir tree that’d be awesome
08:56:05FromGitter<yyyc514> how many people are using nim on windows nayways?
08:56:12FromGitter<alehander42> you can exec a helper nim program which will itself use the platform-compatible stdlib
08:56:26FromGitter<alehander42> not the best possible solution, but it's possible
08:58:49FromGitter<technicallyagd> @yyyc514 LOL, I think there is a even simpler solution
08:59:20FromGitter<technicallyagd> Use `view(code)` instead of `view: code` syntax
08:59:35FromGitter<technicallyagd> then you don't even need to tweak the `emit` param
09:00:11FromGitter<yyyc514> but how does thatwork in the template then?
09:00:28FromGitter<yyyc514> you need the : to get the block
09:00:36FromGitter<yyyc514> afaik
09:03:26*gmpreussner quit (Ping timeout: 268 seconds)
09:03:31*gmpreussner_ joined #nim
09:04:24FromGitter<technicallyagd> Well I think you could, I have updated the gist
09:04:29FromGitter<technicallyagd> https://gist.github.com/technicallyagd/27e5e51f6f3cc5778f8e873304c57e7a
09:05:05FromGitter<yyyc514> whoa does that work?
09:05:15FromGitter<technicallyagd> Yeah, it works on my machine
09:06:38FromGitter<yyyc514> hmmm
09:06:42FromGitter<yyyc514> not sure what i think of that syntax :)
09:07:47FromGitter<technicallyagd> lol
09:08:11*platoff joined #nim
09:08:55*craigger joined #nim
09:09:34livcdyyyc514: i do
09:09:56FromGitter<yyyc514> the dangling ) is just annoying :)
09:10:17*craigger_ quit (Ping timeout: 244 seconds)
09:11:35FromGitter<yyyc514> i’m trying to hack it but then i end up with: Error: 'export' is only allowed at top level
09:12:21FromGitter<yyyc514> ah because my way puts the sapces back
09:12:27FromGitter<yyyc514> but now the template export is no longer valid
09:12:33FromGitter<yyyc514> it has to be at the top level
09:13:13FromGitter<yyyc514> seems by the time all is said and done it would be, but i guess the compiler isn’t liking it
09:13:39FromGitter<yyyc514> you can use a trick like `# block: discard; view:` to get the compiler to shift the indent
09:13:46FromGitter<yyyc514> oh wait
09:15:43FromGitter<alehander42> @yyyc514 I managed to write a loadViews macro (which I'll probably reuse for my project too)
09:15:44*MyMind quit (Read error: Connection reset by peer)
09:17:23*Senketsu quit (Ping timeout: 252 seconds)
09:18:31*Senketsu joined #nim
09:18:37FromGitter<yyyc514> so weird
09:18:52*MyMind joined #nim
09:20:17FromGitter<yyyc514> WAI
09:20:31FromGitter<yyyc514> is the spacing really what’s doing it? isn’t code just outputting an AST one way or the other?
09:26:55FromGitter<alehander42> what is the problem with spacing
09:27:27FromGitter<yyyc514> i tricked it into adding the two missing spaces but now it thinks i’m trying to define a templte at a non top level
09:30:03FromGitter<alehander42> well you should be able to define a template at non-top level
09:30:14FromGitter<yyyc514> sure but you can’t export it
09:30:19FromGitter<yyyc514> and i want to import my templates not include them
09:31:34FromGitter<yyyc514> feels buggy though
09:31:41FromGitter<yyyc514> just being isinde a macro isn’t non top level
09:31:51FromGitter<yyyc514> the macro (if it’s top level) is writing things into the top level
09:32:58FromGitter<yyyc514> the problem isn’t with the genrate AST though it starts at TemplateDef
09:33:34FromGitter<alehander42> well you have to give some kind of example(e.g. generated code)
09:34:05FromGitter<yyyc514> it blows up first :)
09:34:20FromGitter<yyyc514> but exports in a simple macro don’t work either
09:34:22FromGitter<alehander42> hm, actually I can iterate through directories in a macro
09:34:32FromGitter<yyyc514> @alehander42 how?
09:45:20FromGitter<yyyc514> so wow view( vs view: puts the compiler in an entirely different frame of mind
09:45:30FromGitter<yyyc514> one increases the depth one doesn't
09:45:44FromGitter<yyyc514> i wonder if there is a pragma to change that
09:48:36*sagax quit (Ping timeout: 252 seconds)
09:49:15FromGitter<alehander42> @yyyc514 well it seems os is actually available in macros
09:49:27FromGitter<alehander42> so I can `walkDir` succesfully
09:49:41FromGitter<yyyc514> oh now that didn’t work for me at all
09:49:59FromGitter<yyyc514> share your example?
09:50:15FromGitter<yyyc514> i specifically asked on Git and was told it can’t work :)
09:50:15PMunchHmm, casting doesn't work in macros?
09:50:15FromGitter<gogolxdong> what's the equivalent of this snippet in Nim ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bc8575782893a2f3bfe0b86]
09:50:37FromGitter<yyyc514> pmunch: why wouldn’t it?
09:50:45PMunchI tried to create a distinct type and some procedures that worked on it but it seems to copy the data
09:50:46FromGitter<yyyc514> OH
09:50:50FromGitter<yyyc514> you mean in the code
09:50:56FromGitter<yyyc514> compiled code or VM code?
09:51:02leorizegogolxong: once `=sink` is a thing you can use `system.move`...
09:51:11PMunchyyyc514, VM code
09:51:23PMunchJust a sec, I'll create an example
09:51:29FromGitter<yyyc514> yeah that’s probably the problem: that’s it’s VM code
09:51:30FromGitter<alehander42> @yyyc514 well it works for me, I am not sure why
09:51:36FromGitter<yyyc514> i bet the typcasting has to do with C semantics
09:51:38leorize@gogolxdong see my prev msg
09:51:58FromGitter<gogolxdong> How long ago?
09:52:14FromGitter<alehander42> it shouldn't, casting works in the js backend
09:52:21FromGitter<alehander42> works well*
09:52:46FromGitter<yyyc514> JS also isn’t VM :)
09:52:53FromGitter<yyyc514> either the VM supports it or it doesn't
09:52:54FromGitter<gogolxdong> ah, it is just like a flash.
09:54:04FromGitter<alehander42> i mean that it isn't closely tied to C semantics.
09:54:50FromGitter<yyyc514> s/C/backend compiler/ :-)
09:55:05FromGitter<yyyc514> but lets see that example :)
09:55:41PMunchWell not casting, but conversion
09:55:57FromGitter<gogolxdong> Does it mean I have to implement `proc `=sink`()`
09:57:20FromGitter<gogolxdong> of specified type
09:57:23leorizePretty much
09:57:55leorizeonce destructor support is mature that is
10:01:37leorizegogolxdong: you could try `system.move` directly, I haven't tested that
10:04:03PMunchThis is what I was trying to do: http://ix.io/1psu/
10:04:51*craigger quit (Ping timeout: 260 seconds)
10:05:10*craigger joined #nim
10:13:16FromGitter<yyyc514> thinking of how to do layouts and sub-templates now
10:13:23FromGitter<yyyc514> not sure could make it atll static at compile tile
10:13:37FromGitter<yyyc514> without making that an explciit goal
10:14:59FromGitter<yyyc514> take so much for granted in a fully dynamic language :)
10:19:45FromGitter<yyyc514> @alehander42 you going to share that file traversal code? please?
10:25:29FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bc85f99c08b8b306732c5af]
10:26:28FromGitter<alehander42> this assumes a `render(path: static[string]): untyped` for constant paths is implemented
10:28:16FromGitter<alehander42> i am going to put this in a lib, because I need it for my Jester projects(and with some support for passing a hierarchy of view folders it can be reused internally by all nim web frameworks)
10:28:47FromGitter<alehander42> but feel free to tweak it for your code if it seems useful
10:41:33*elrood joined #nim
10:48:22PMunchpoopBot, https://github.com/PMunch/gtkgenui is now updated to work on 0.19.0
10:50:30*kapil____ joined #nim
10:52:11FromGitter<vegai> huh, interesting. The nim layer on my home spacemacs works fine, while my work machine’s spacemacs freezes when I try to use it
10:52:21FromGitter<vegai> almost identical configurations…. but I suppose not
10:59:48poopBotPMunch, ty will try
11:01:03*Vladar joined #nim
11:06:49*smt joined #nim
11:07:57*smt quit (Read error: Connection reset by peer)
11:21:59FromGitter<kaushalmodi> @vegai it's probably nimsuggest. There's a variable for setting nimsuggest path; set that to "".
11:23:37*dddddd joined #nim
11:24:38*vlad1777d joined #nim
11:28:16PMunchpoopBot, cool. Let me know if you get stuck on anything
11:28:18*couven92 joined #nim
11:28:37poopBotPMunch, dont wory i will xD
11:31:06*hwallann joined #nim
11:40:31*hwallann quit (Quit: Leaving)
11:40:43*hwallann joined #nim
11:43:42*pwntus quit (Changing host)
11:43:42*pwntus joined #nim
11:44:28*poopBot quit (Remote host closed the connection)
11:46:19*poopBot joined #nim
11:52:35poopBotPMunch, this only Gtk2 or suports GTK3 too?
11:54:21PMunchI have a version that supports Gtk3, but that's not yet updated to 0.19.0
11:54:26PMunchI have the fix for it at home though
11:54:32PMunchSo I'll fix it tonight
11:54:38poopBotnice
11:58:58poopBot../../../../.nimble/pkgs/gtkgenui-0.1.0/gtkgenui.nim(1, 16) Error: cannot open file: stack
11:59:21poopBothmm, clang issue or what, i just copy pasted your example
12:01:29PMunchHmm, stack.nim should be in the genui package
12:01:52PMunchMight be a Nimble issue
12:02:43poopBoti dide nimble install gtkgenui agian, i try manul delete then reisntall again
12:03:09PMunchNah, looks like the Nimble project is wrong
12:03:10PMunchHold on
12:03:19poopBotok
12:15:00PMunchThere
12:15:09PMunchnimble install gtkgenui should now work
12:15:38poopBotyep
12:15:42poopBoti did it
12:16:58poopBotit works now
12:16:59poopBotyey
12:18:59PMunchWoo
12:24:09*adeohluwa joined #nim
12:53:29*vlad1777d quit (Ping timeout: 244 seconds)
13:07:31*endragor quit (Remote host closed the connection)
13:12:10*stefanos82 joined #nim
13:17:54*kapil____ quit (Quit: Connection closed for inactivity)
13:27:17PMunchpoopBot, getting anywhere?
13:31:46*endragor joined #nim
13:36:13*endragor quit (Ping timeout: 250 seconds)
13:52:22*stephan___ joined #nim
13:54:26*platoff quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:57:52*shadowbane joined #nim
14:08:30poopBotPMunch, not really, head to go out just came back, first plan is to read all stuff you writed to get to know how it works
14:09:18PMunchAh right
14:09:55*kapil____ joined #nim
14:10:19poopBotdont worry will try for sure
14:10:24PMunch:)
14:11:43PMunchIt's basically just a DSL for Gtk, so you should be able to use Gtk documentation to figure out which widgets you want and then use the DSL to create and layout the widgets
14:12:20poopBotyep, i think i get how it works, tought i dont know what DSL stands for
14:12:23poopBotxD
14:12:46PMunchDomain Specific language
14:12:59PMunchBasically a custom syntax for a particular application
14:14:14poopBotyep i saw that, i was hmm, how can he do that like that :) , guess it has something to do with nim macros ,right?
14:15:12*Snircle joined #nim
14:21:46*stephan___ quit (Quit: Page closed)
14:22:35PMunchYup
14:23:39PMunchBasically a Nim macro takes in the code you write as a complex tree structure, and return a similar tree structure. The genui macro takes the tree you give it, and rewrites it to a bunch of Gtk statements in it's output tree
14:24:23PMunchIf you compile it with -d:debug it will show you what the genui macro generates
14:32:10*enthus1ast joined #nim
14:36:44*platoff joined #nim
14:39:10poopBotok ty
14:43:15poopBotam reading now explanation, and i can say you really nicly wirited it so nowbie like me can undurstend it
14:44:44PMunchGood to hear :)
14:44:48*PrimHelios joined #nim
14:45:03*PrimHelios quit (Client Quit)
14:53:55*adeohluwa quit (Quit: Connection closed for inactivity)
14:56:40*craigger_ joined #nim
14:56:54*craigger quit (Ping timeout: 264 seconds)
15:00:12*PMunch quit (Quit: Leaving)
15:02:37poopBotnow i remember why i hated gtk, just installed Glade to make mokup, working with GameEngines is so easyer
15:09:13FromGitter<kaushalmodi> @skellock I happened to visit your profile and saw that you have forked https://github.com/mlichvar/newt. Please tell me you are building a Nim lib to wrap that :) (For other folks not familiar, newt is a TUI library, looks like this: https://www.youtube.com/watch?v=HZLt2KT4aLA).
15:14:04poopBoti dident even know CLI uis like this exists
15:15:11FromGitter<kaushalmodi> poopBot: These are very old school (which I love). I love apps like ncdu and htop which use similar TUI elements but from the ncurses lib
15:15:40*craigger joined #nim
15:15:55*craigger_ quit (Ping timeout: 246 seconds)
15:16:42poopBoti have htop tought it doset look so pop like that 1 in video
15:18:28*Summertime joined #nim
15:20:12*narimiran joined #nim
15:20:19*Trustable joined #nim
15:32:30Summertimeis it possible to have nimble create a binary with a dash in it? e.g. word-word instead of word_word
15:33:14FromGitter<kaushalmodi> No, I remember nimble throwing an error on detecting dash
15:33:42leorizethe compiler will throw an error before you do :P
15:35:35SummertimeI can pass -o:word-word to the compiler though :n (well, to nim c, at least)
15:36:18leorizeoh, totally forgot about that flag :P
15:36:28leorizeI don't think nimble have it though
15:36:55FromGitter<kaushalmodi> you can always create a NimScript task that does mvFile at the end
15:37:51leorizecan you still do `nimble install` after that?
15:38:06FromGitter<kaushalmodi> unfortunately not
15:38:19FromGitter<kaushalmodi> I had opened an issue on nimble regarding that
15:40:30Summertimethe obvious solution is to do the mv in the .nimble directory, and also edit the metadata for the package to reflect it / allow uninstalling
15:41:09FromGitter<kaushalmodi> that's too much of a hack; better to fix this in nimble by submitting a PR
15:45:35*Vladar quit (Remote host closed the connection)
15:46:12planetis[m]Iam confused with macros, what does `==`(a,b: NimNode) check differently than eqIdent(a, b: NimNode)?
15:46:30planetis[m]and when to use which?
15:46:59*nsf quit (Quit: WeeChat 2.2)
15:47:42leorize`==` is, uh when you want to check whether two NimNode is equivalent
15:48:02leorizeeqIdent when you just want to compare their identifier
15:50:08planetis[m]i was comparing the return types of two procs and eqIdent returns false if they're both void
15:50:16planetis[m]but == works
15:50:31planetis[m]is it a bug?
15:51:06leorizeno
15:51:47planetis[m]i see their both nnkEmpty
15:51:54planetis[m]not nnkIdent
15:52:35*darithorn joined #nim
15:54:27planetis[m]so does == check their childern, right?
15:54:48planetis[m]*children Nodes
15:55:52planetis[m]so I can just write proc1.params == proc2.params
16:00:27planetis[m]?
16:01:00leorizetry it yourself...
16:02:35planetis[m]I can trust a test, man I usally read the code I run but this is "magic" :p
16:06:00*d10n-work joined #nim
16:35:28*PMunch joined #nim
16:51:39*vlad1777d joined #nim
17:10:45*Trustable quit (Remote host closed the connection)
17:16:47*enthus1ast quit (Ping timeout: 250 seconds)
17:19:52*krux02 quit (Remote host closed the connection)
17:27:24FromGitter<vegai> why’s the repl a secret?
17:34:02FromDiscord<treeform> hey @dom96 I have figured out that SSL puzzle, but I don't know how to make a PR to fix the actual SSL so that it can be submitted? https://github.com/nim-lang/Nim/issues/9419#issuecomment-430809742
17:37:25FromGitter<kaushalmodi> Talking about the RFC repo, Araq, @narimiran , what if the GitHub Projects feature is used for that? https://github.com/nim-lang/Nim/projects
17:37:55narimirani've never used it, but maybe this could work
17:38:09FromGitter<kaushalmodi> In Projects, you can create filtered lists of RFCs, vs everything else
17:38:19FromDiscord<treeform> I though the RFC tag did that? https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC
17:38:27narimiranbut isn't that something like trello?
17:38:42FromGitter<kaushalmodi> The everything else can be further broken down based on tags like nimpretty, etc
17:39:18FromGitter<kaushalmodi> treeform: the projects will give a more organized v
17:39:22FromGitter<kaushalmodi> view
17:39:39FromGitter<kaushalmodi> narimiran: yes, like Trello
17:40:39FromGitter<kaushalmodi> Projects is not being used at all, so doesn't hurt creating a bunch of filters and seeing what it looks like. :).
17:42:23FromGitter<rayman22201> @vegai repl is a secret because it is buggy and not very well supported.
17:43:07FromGitter<rayman22201> This needs to be put in a FAQ somewhere lol. The question gets asked here at least once every few weeks.
17:43:31narimiran@kaushalmodi i'm not sure how RFCs fit in with trello-like workflow :/
17:49:01FromDiscord<hotdog> "nim check" (used by vscode extension) is stuck, using 100% CPU every time I open my project. How can I debug what's causing it?
17:55:13FromGitter<vegai> @rayman22201 or perhaps make it “nim i” again since all that secrecy is more confusing :)
17:55:23FromGitter<kaushalmodi> nirimiran: OK, I misunderstand, looks like issue cards can only be moved one at a time
17:55:32FromGitter<kaushalmodi> .. about GitHub Projects
17:59:22narimiran@hotdog are you maybe using macros?
18:00:03narimirani'm not sure it's the macros, but in some cases, i know that nimsuggest (used by that extension) uses 100% cpu and i must manually kill it
18:02:09FromDiscord<hotdog> @narimiran not using any macros at the moment (apart from some stuff in stdlib). I've been killing the process manually, but every time I save a file it starts up again
18:05:18narimiranrestart vscode maybe?
18:05:31FromDiscord<hotdog> It happens after restart too
18:05:58FromGitter<Vindaar> does it also happen if you run `nim check` manually on the file in the terminal?
18:06:18FromDiscord<hotdog> Yeah, tried running it myself and it hangs too
18:06:19FromDiscord<hotdog> Running "nim check" myself I see a lot of "Error: This module only works on the JavaScript platform" (I'm outputting JS in this project), how can I let nim check know that?
18:06:31narimiraneh, such is that plugin. when it works, it works....okayish. when it doesn't, maybe kill/restart helps (it usually does for me), maybe not
18:07:30FromDiscord<hotdog> Yeah
18:08:13FromDiscord<hotdog> "Hint: <module> [Processing]" seems to get printed _after_ each module is processed, so I can't even tell which module it's stuck on
18:09:06FromGitter<kaushalmodi> hotdog: I don't use VSCode, but don't have a good suggestion related to that. But what if you simply remove nimsuggest from PATH?
18:09:35narimiranwell, you can easily turn off nim check on save, in vscode settings
18:09:45leorizenimsuggest still has a long way to go...
18:10:23FromDiscord<hotdog> @kaushalmodi yeah I can turn it off, but I quite like having it if it works 😃
18:11:02FromGitter<kaushalmodi> hotdog: oh OK. Probably, like many others, I just don't use it and life is still good
18:13:21leorizenimsuggest gives you that "auto-completion" thing tho...
18:13:40narimiran...until it stops working ;)
18:13:40leorizealthough I've to admit that I never use it
18:14:26FromDiscord<hotdog> I'm sure everyone's workflow is a bit different 😃
18:14:48FromDiscord<hotdog> I'm not complaining that it's not working, just wanted to know if anyone had any tips on how to debug it
18:15:02FromGitter<kaushalmodi> I normally tend to auto-complete from whatever is in existing open file buffers. Emacs hippie-expand just works wonders
18:15:13FromGitter<kaushalmodi> it's lang agnostic and Just Works(TM)
18:15:23FromGitter<Vindaar> ^this
18:15:51leorize@hotdog: attach a debugger, maybe?
18:16:10leorizekaushalmodi: same, but for vim
18:21:51*nsf joined #nim
18:27:40*Trustable joined #nim
18:34:57*zachk joined #nim
18:38:58*kapil____ quit (Quit: Connection closed for inactivity)
18:43:57*hoijui joined #nim
18:49:08*Trustable quit (Remote host closed the connection)
18:54:27*zachk quit (Changing host)
18:54:27*zachk joined #nim
18:59:48PMunchpoopBot, fixed gtk3genui now
19:06:56mastermhm... I have the most peculiar Nim compilation error (compiler bug perhaps?)
19:07:19mastermI'm working on C bindings and I have a type definition like this: https://pastebin.com/j5zDTKHN
19:07:38mastermthis gets me:
19:08:25masterm../nim-amigaos/amigaos/graphics/gels.nim(34, 3) Error: redefinition of 'VSprite'; previous declaration here: ../nim-amigaos/amigaos/graphics/gels.nim(34, 2)
19:09:06mastermso nim claims that previous declaration is *one character* to the left, which doesn't make sense
19:09:23mastermit's the same line
19:09:28PMunchHmm, that is indeed particular
19:10:11mastermthe same type definition works when pasted to Nim playground so it's probably something else in my code but the msg is somehow wrong... I guess...
19:10:31PMunchYeah, that snippet looks good to me
19:19:43*tiorock joined #nim
19:19:43*tiorock quit (Changing host)
19:19:43*tiorock joined #nim
19:19:43*rockcavera is now known as Guest59631
19:19:43*tiorock is now known as rockcavera
19:22:54*Guest59631 quit (Ping timeout: 252 seconds)
19:32:46poopBotPMunch, can gtk3genui use CSS ?
19:32:53PMunchYes
19:32:54*glassofethanol joined #nim
19:33:01poopBotnice
19:33:16PMunchIt just generates Gtk3 calls
19:33:40PMunchSo you should be able to apply CSS after it has created the GUI
19:34:35poopBotnice, i am still trying to figure out how to create layout using Glade, then will just implament same in gtk3genui
19:36:03*glassofethanol left #nim (#nim)
19:37:09FromGitter<yyyc514> is ShallowCOpy not consistent?
19:37:15FromGitter<yyyc514> i read that shallow might or might not be honored by the compiler
19:37:27*glassofethanol joined #nim
19:38:06FromGitter<yyyc514> i can’t even get the simple example working
19:39:43*glassofethanol left #nim (#nim)
19:39:50*hoijui quit (Ping timeout: 268 seconds)
19:44:27*stefanos82 quit (Quit: Quitting for now...)
19:44:45*dddddd quit (Ping timeout: 244 seconds)
19:45:50FromGitter<yyyc514> ok is there no newString ? i just assign it to a variable then assign it to a pointer if i want a pointer to a string?
19:46:30FromGitter<yyyc514> ah there is but it takes an int
19:49:11PMunchyyyc514, what are you trying to do?
19:49:40FromGitter<yyyc514> trying to have a buffer (pointer to string) that i can easily point to different strings and then have things write to them and easily swap the “destination"
19:49:49FromGitter<yyyc514> still hacking the code filter stuff
19:50:10FromGitter<yyyc514> i have it working but the only way to get a string seems to be to assign it to a variable then use addr
19:50:22FromGitter<yyyc514> which actually is fine but i was just wondering if there is another way to init a new string
19:50:28FromGitter<yyyc514> like new(newString(20)) or something
19:50:33FromGitter<yyyc514> to get a pointer
19:52:11*Jesin joined #nim
19:52:36PMunchAh, not entirely sure
19:52:47FromGitter<yyyc514> i need a “capture” method inside a template that can capture things that aren’t intended for output yet… but the template only allows one output call… like “result.add"
19:52:56*cozachk joined #nim
19:52:58FromGitter<yyyc514> so if i make it buffer[].add then i can retarget it just by changing buffer
19:53:02*craigger_ joined #nim
19:54:09FromGitter<yyyc514> hence playing with string pointers
19:54:15*craigger quit (Ping timeout: 252 seconds)
19:54:27PMunchStrings are already pointers though..
19:54:33PMunchSo you can just assign a string to it
19:54:42PMunchOh wait
19:54:48FromGitter<yyyc514> well no because i don’t need copy on write
19:55:03PMunchYeah, so you need to update both places
19:55:13PMunchWell you have alloc
19:55:15*zachk quit (Ping timeout: 268 seconds)
19:55:33FromGitter<kayabaNerve> Can I pass varargs to C++?
19:55:36*craigger joined #nim
19:55:42FromGitter<yyyc514> how would one use alloc in Nim?
19:55:44PMunchkayabaNerve, yes
19:55:50PMunchyyyc514 alloc
19:55:57FromGitter<kayabaNerve> I'm trying to interface with vectors. This damn library made constructors private.
19:56:09FromGitter<yyyc514> i’m not that familiar with C allocation what would it look like in a full example line
19:56:17FromGitter<kayabaNerve> Basically, trying to pass an unknown amount of objects and use the `{}` vector constructor
19:56:48PMunchyyyc514, look up create in system
19:56:53*craigger- joined #nim
19:57:00FromGitter<kayabaNerve> But that only works if I can convert the seq to a varargs
19:57:06FromGitter<kayabaNerve> :/
19:57:59*craigger_ quit (Ping timeout: 276 seconds)
19:58:05FromGitter<yyyc514> actually maybe it would work without pointers but it’d do a lot of extra copying if you changed context a lot
19:58:13PMunchkayabaNerve, I remember seeing a module using C varargs recently
19:58:29PMunchCan't quite remember what it was though, maybe see if you can find a printf wrapper?
19:58:38FromGitter<kayabaNerve> Thanks for the idea. I'll go figure it out
19:59:02FromGitter<kaushalmodi> Araq: I was playing with the nightlies fork.. looks like it builds fine (testing linux only for now), but deployment fails: https://travis-ci.org/kaushalmodi/nightlies/builds/443358860#L805
19:59:28FromGitter<kaushalmodi> It's not clear what the nightlies repo has to do with "fatal: repository 'https://github.com/nim-lang/Nim/' not found" during deployment
19:59:37FromGitter<kaushalmodi> I am not setting that URL anywhere in travis config
19:59:41PMunchyyyc514, or create a ref object with your string in it
19:59:48*craigger_ joined #nim
19:59:49PMunchThat way it will be shared
20:00:48*craigger quit (Ping timeout: 268 seconds)
20:01:44*craigger_ quit (Read error: Connection reset by peer)
20:02:02FromGitter<yyyc514> i’m not sure that’d work i bet that’d still do copy of write semantica
20:02:19FromGitter<yyyc514> var a = obj.some_string; a.add(blah) … a is now different
20:02:33*craigger- quit (Ping timeout: 245 seconds)
20:02:40FromGitter<yyyc514> i think you have to use pointers or the shallowcopy stuff (which i couldnt’ get working)
20:03:12PMunchtype RefString = ref object; str: string
20:03:23PMunchThen pass RefString objects around
20:03:32FromGitter<yyyc514> why not just ref string then?
20:03:41FromGitter<yyyc514> i don’t think what you’re proposing will work
20:03:42PMunchI couldn't get that to work..
20:03:58FromGitter<yyyc514> mine works if i assign all the “real” strings to variables first
20:04:03*craigger joined #nim
20:04:04FromGitter<yyyc514> oh i’m using ptr sorry
20:04:06FromGitter<yyyc514> not ref
20:04:25FromGitter<yyyc514> `ptr string` :-)
20:04:28PMunchIf I understand correctly what you are trying to do I'm 90% sure my solution would work
20:05:44FromGitter<yyyc514> hmmm how do you manually “deref” something
20:05:52PMunch[]
20:06:04FromGitter<yyyc514> no the opposite
20:06:08FromGitter<yyyc514> the equiv of “Addr"
20:06:19FromGitter<yyyc514> i guess that’d be reffing it lol
20:06:26PMunchWait..
20:06:29FromGitter<yyyc514> a : ref string
20:06:32FromGitter<yyyc514> how do i assign a string to a
20:06:38PMunchOh
20:07:52FromGitter<yyyc514> oh you might be right about the object ref :)
20:07:55FromGitter<yyyc514> from what i just read
20:08:21PMunchThis seems to work: http://ix.io/1puZ
20:10:29FromGitter<alehander42> @yyyc514 why do you need `ptr`? this is very rarely useful in normal nim code
20:10:42FromGitter<yyyc514> well refs might work
20:10:48FromGitter<yyyc514> but the first string op is still a copy
20:11:02FromGitter<yyyc514> then copying the refs around gets you references
20:11:06FromGitter<yyyc514> a[] = c # gets you a copy
20:11:52FromGitter<alehander42> i see you intend to use it in templates, but I still don't understand why do you need this buffer
20:12:08FromGitter<yyyc514> i need to swap the target of result.add
20:12:29FromGitter<yyyc514> so result needs to be a ptr or ref
20:12:32FromGitter<yyyc514> i think ref works
20:12:40FromGitter<yyyc514> just allocate it and then i can pass the ref around
20:12:55FromGitter<yyyc514> want to support something like this
20:12:58FromGitter<alehander42> ok, without any more details of the macro you're trying to write I can't tell
20:12:59FromGitter<yyyc514> (https://files.gitter.im/nim-lang/Nim/6C2E/Screen-Shot-2018-10-18-at-4.12.44-PM.png)
20:13:13FromGitter<yyyc514> where special_script doesn’t render but is saved for say the layout template
20:13:20FromGitter<alehander42> but it seems very overengineered to me, I can't believe there is no simpler solution
20:13:50FromGitter<yyyc514> seems pretty simple to me but maybe i’m missing something :)
20:13:56PMunchWell if it's a macro you can pas a symbol
20:15:03FromGitter<yyyc514> not sure i follow
20:15:35FromGitter<yyyc514> @alehander42 I have a template that’s writing to a buffer… but for something like “content_for” i need to change the target of the writes for a bit and then keep track of the sections like that for later use
20:15:58FromGitter<yyyc514> and with the build in code filters all you’re allowed is a single “emit"
20:16:20FromGitter<yyyc514> so it’d seemed easiest to emit to a ref string and then you could just change which string you’re emitting to easily
20:16:55FromGitter<alehander42> I see, I haven't played with code filters, it seems more reasonable now, sorry
20:17:22FromGitter<yyyc514> trying to make them stretch as far as possibl until i swap them with my own thing
20:17:28FromGitter<yyyc514> still struggling with how dynamic to make it
20:18:13FromGitter<alehander42> but still it seems you can change what emit does
20:18:22FromGitter<alehander42> it is `result.add` by default
20:18:30FromGitter<yyyc514> yep
20:18:34FromGitter<yyyc514> so i’d make it buffer.add :-)
20:18:53FromGitter<yyyc514> and then have content_for be a template that changes the buffer pointer at the beginning and end
20:19:09FromGitter<yyyc514> writes into a table of strings, etc
20:19:31FromGitter<yyyc514> which then the layout could easily grab
20:19:47FromGitter<alehander42> isn't emit called for each line?
20:19:55FromGitter<yyyc514> each line of HTML
20:20:01FromGitter<yyyc514> yes
20:20:13FromGitter<alehander42> ok, can't you have a custom proc templateAdd
20:20:27FromGitter<alehander42> which detects if the stripped line starts with content_for or something like this
20:20:42FromGitter<alehander42> and only then adds it to a different buffer
20:20:46FromGitter<yyyc514> well at that point yuo’re writing your own template parser from scratch
20:20:58FromGitter<alehander42> in this case you can just maintain a table of strings
20:21:00FromGitter<yyyc514> when the built in stuff it’s reading it and rewriting it in place
20:21:13FromGitter<yyyc514> you can’t “detect” a line
20:21:23FromGitter<yyyc514> only have the line do something by being a proc/template/macro etc
20:21:24FromGitter<alehander42> well if it's simpler to write a template engine
20:21:27FromGitter<alehander42> I'd do that :D
20:21:46FromGitter<yyyc514> i’ll never get around to actually making the HTTP part work if i do down every rabbit hole :)
20:21:55FromGitter<alehander42> that's why I like dsl-s like the karax one, much simpler to add this kind of functionality
20:22:05FromGitter<yyyc514> i want an ERB like one
20:22:08FromGitter<yyyc514> <%= syntax
20:22:18FromGitter<yyyc514> but otherwise the same idea as the built in
20:22:55FromGitter<yyyc514> conver to source code and pass that to a parseStatement or wahtever
20:23:16FromGitter<alehander42> well honestly I think writing a simple ERB-like template syntax and generating a nim file from it would take less time
20:23:32FromGitter<alehander42> but I can be wrong
20:23:55FromGitter<yyyc514> well that’s one approach… generate the nim template file vs generate the source code directly
20:24:22FromGitter<yyyc514> i guess technically you could still do both inside the compiler single pass
20:25:00FromGitter<alehander42> yeah, you can generate the code in memory and parseExpr it
20:25:24FromGitter<alehander42> I just parseExpr my karax templates
20:25:32FromGitter<yyyc514> what is karax?
20:25:50FromGitter<alehander42> a SPA framework
20:25:56FromGitter<alehander42> but it includes a html-building dsl
20:26:21Araqkaushalmodi: thanks for working on this, sadly the error is mysterious to me too
20:26:24FromGitter<yyyc514> oh yes i think you showed me that
20:26:30FromGitter<yyyc514> like HAML from ruby :)
20:26:39FromGitter<yyyc514> never cared for HAML though i know it’s like a religious war type topic :)
20:27:00FromGitter<yyyc514> i think progammers like that more and front-end people like HTML better, but i could be mistaken
20:27:11FromGitter<yyyc514> i’ve never minded HTML that much
20:27:25FromGitter<yyyc514> but then i also don’t like writing “end” in Ruby :)
20:27:32FromGitter<yyyc514> so i don’t have an issue with needing to “pair” elements :)
20:27:49FromGitter<yyyc514> i find i get lost sometimes in Nim/Python though editors can help with that
20:28:37FromGitter<alehander42> exactly, I don't like the need for closing tags in html/xml
20:29:03FromGitter<alehander42> well, one should strive to have relatively short functions/blocks of code
20:29:05FromGitter<yyyc514> yeah i think that’s the common gripe, mismatched tags - i’ve just never had a huge problem with that in practice
20:29:19FromGitter<yyyc514> > well, one should strive to have relatively short functions/blocks of code
20:29:23FromGitter<yyyc514> dat true too
20:29:25FromGitter<alehander42> it's not even that, it's just babysitting the syntax
20:29:42FromGitter<alehander42> with indentation the parser can figure out what is the tree of the code anyway
20:29:44FromGitter<yyyc514> i get that :) that’s why frameworks should support both options :)
20:29:50FromGitter<alehander42> yep
20:29:54FromGitter<yyyc514> so you just drop in yoru fav template engine and away you go :)
20:30:00FromGitter<yyyc514> or write your own :)
20:30:05FromGitter<alehander42> that's the spirit :)
20:30:21FromGitter<yyyc514> but don’t yell if the default is HTML ish :)
20:30:38FromGitter<yyyc514> for whatever default means, hopefully it’d be loosely coupled
20:31:03FromGitter<yyyc514> i’m thinking render might take a static string and then layout might be done at runtime
20:31:22FromGitter<yyyc514> render :index; layout = variable_that_is_a_layout_render_proc
20:31:35FromGitter<yyyc514> so you can dynamically change the layout at runtime
20:31:45FromGitter<yyyc514> but you have to kind of decide upfront which template you’re rendering
20:32:02FromGitter<yyyc514> or hard code it (if x; render :index; else render :oh_no; )
20:32:21FromGitter<yyyc514> then all layout has to do is add a bunch of strings together
20:32:28FromGitter<alehander42> I haven't really thought how layouts would fit in this
20:32:45FromGitter<yyyc514> yeah Rails is big on layouts… like your overall site design so you don’t repeat it
20:33:01FromGitter<alehander42> in my solution this `if x: render :index else: render other` is autogenerated by a macro
20:33:05FromGitter<yyyc514> so at the simplest you have layouts and templates and your “main view” fits inside the layout
20:33:14FromGitter<alehander42> but I have to think how to combine it with layouts
20:33:36FromGitter<yyyc514> autogenerated how?
20:33:44FromGitter<yyyc514> like what code is the user writing in the controller
20:34:53*hoijui joined #nim
20:35:02FromGitter<alehander42> nope, I am talking about passing a variable path to render, as my templates are simpler
20:35:38FromGitter<yyyc514> you mean if there is a constrained list? i’m just not imaginign what you’re saying in practice
20:35:43FromGitter<yyyc514> or only seeing it very abstractly
20:35:50FromGitter<alehander42> a sec
20:36:18FromGitter<yyyc514> the only thing is if a template becomes a proc then it can’t access variables setup in the controller
20:36:28FromGitter<yyyc514> which views can because they are tempaltes running inline in the controller
20:36:58FromGitter<yyyc514> which would lead to hacks like passing things to the layout via the view
20:37:06FromGitter<yyyc514> not sure how often that would come up
20:37:10FromGitter<alehander42> well that's not fatal, because I can just use a template instead of proc
20:37:34FromGitter<yyyc514> well but then you can’t have a pointer to it at runtime
20:37:50FromGitter<yyyc514> i’m really feeling like layout should be a runtime choice (for me)
20:37:52FromGitter<alehander42> but you can collect all possible layouts
20:37:56FromGitter<yyyc514> hmmm
20:38:01FromGitter<alehander42> and generate something
20:38:05FromGitter<alehander42> that invokes them based on a string
20:38:13FromGitter<alehander42> similar to my runtime render solution
20:38:39FromGitter<yyyc514> i kind of get that but the invokation happens separately from the setting
20:38:54FromGitter<yyyc514> you’re saying i just generate all the possibilites in a case
20:39:02FromGitter<yyyc514> and then the run-time render calls that
20:39:17FromGitter<yyyc514> passing it the run-time value of layout which is resolved there
20:40:18FromGitter<yyyc514> and then they could be templates again and have the access back
20:40:25FromGitter<alehander42> well I am not sure how exactly the layouts worked in rails
20:40:29FromGitter<yyyc514> man the C code this stuff generates much be really ugly :)
20:40:32FromGitter<alehander42> i have to take a look at an example
20:40:37FromGitter<yyyc514> layouts just wrap views
20:40:42FromGitter<yyyc514> and yield when they want content
20:40:50FromGitter<yyyc514> <%= yield %> gives you the main content
20:40:54FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bc8efd5c08b8b306736970d]
20:41:06FromGitter<yyyc514> <% yield js_snippter %> would give you some JS snippet you setup earlier in the view but didn’t want to render in the view
20:41:21FromGitter<alehander42> this was the code that collects render and generates a ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5bc8eff11e23486b93df05fb]
20:41:26FromGitter<yyyc514> and the walkDir stuff all works for you?
20:41:30FromGitter<yyyc514> you on nim 0.19 whatever?
20:41:48FromGitter<alehander42> yes, I always use one of the last versions
20:41:55FromGitter<yyyc514> i’ll try it again
20:42:07FromGitter<alehander42> everything before that is basically EOL
20:42:12FromGitter<yyyc514> sounds like that’d be the way to have the cake and eat it too
20:42:16FromGitter<alehander42> (until we get to 1.0)
20:42:47FromGitter<yyyc514> so which nim file do all your tempaltes get compiled to?
20:43:16FromGitter<yyyc514> i guess it could just be one big one you import everywhere but i don’t know if that would slow things down more than breaking it out
20:43:23FromGitter<yyyc514> for me views are OFTEN going to be scoped to controller
20:43:37FromGitter<alehander42> they don't compile to any file
20:43:46FromGitter<alehander42> whenever I need one
20:43:59FromGitter<alehander42> I just call `render("name of template without .nim")`
20:44:11FromGitter<alehander42> or `render(variable)`
20:44:30FromGitter<yyyc514> ok and that drops ALL your templates there
20:44:36FromGitter<yyyc514> in each spot
20:44:45FromGitter<alehander42> well it drops the template under this path
20:44:54FromGitter<alehander42> I have a single template directory
20:44:57FromGitter<alehander42> so no name clashes
20:45:15FromGitter<yyyc514> i mean everytime you call render you’re adding all the code to render ANY template yes? because of your case
20:45:21FromGitter<alehander42> e.g. main_view.nim chat_view.nim etc
20:45:31FromGitter<alehander42> and if i call render("main_view") I get only this template
20:45:45FromGitter<alehander42> well I add the code to render this particular template
20:45:46FromGitter<alehander42> only
20:45:46*nsf quit (Quit: WeeChat 2.2)
20:45:51FromGitter<yyyc514> you only get it RENDERED, but it’s still compiled (subject to dead code elimitation), yes?
20:46:11FromGitter<alehander42> well the case happens only if I call it with a variable
20:46:15*narimiran quit (Quit: Konversation terminated!)
20:46:17FromGitter<alehander42> which should be rare
20:46:25FromGitter<yyyc514> ah ok… you have both cases?
20:46:31FromGitter<alehander42> yes, that's the point
20:46:39FromGitter<yyyc514> right if you call it static it’d just inline the appropriate thing :)
20:46:41FromGitter<alehander42> the case version just invokes the constant string `render
20:47:06FromGitter<alehander42> this way I can reuse this for any template system that defines
20:47:14FromGitter<alehander42> a `render(path: static[string])`
20:47:35FromGitter<alehander42> which might be a bit limited for now, but it's fine for my usecases
20:49:53FromGitter<yyyc514> yeah i might be overengineering a bit but i’m learning a lot about Nim :)
20:51:59FromGitter<alehander42> great to hear :)
20:53:27*dddddd joined #nim
20:55:05FromGitter<yyyc514> HA
20:55:06FromGitter<yyyc514> Error: cannot 'importc' variable at compile time
20:55:20FromGitter<yyyc514> @alehander42 walkDir vs walkDirs
20:55:26FromGitter<yyyc514> walkDirs hits POSIX and is unsafe
20:55:33FromGitter<yyyc514> walkDir evidentally does something else entirely :)
20:55:38FromGitter<yyyc514> which works inside the VM
20:55:43FromGitter<yyyc514> i’m going to update my post on Github
20:56:43*sagax joined #nim
20:57:12FromGitter<alehander42> ah I see, well the pattern version is probably trickier
20:57:24FromGitter<alehander42> walkDir just takes a path, not a pattern
20:57:54*craigger_ joined #nim
20:58:05FromGitter<yyyc514> https://github.com/nim-lang/Nim/issues/9253
20:58:07*craigger quit (Ping timeout: 244 seconds)
20:58:16FromGitter<yyyc514> yeah i see the diff :)
20:58:19FromGitter<yyyc514> THANKS!
20:58:24FromGitter<yyyc514> this helps a lot
20:58:33FromGitter<yyyc514> since now i can just collet the templates without having to import them specially
20:58:47FromGitter<yyyc514> more stupid boilerplate gone :)
21:00:12FromGitter<yyyc514> are you doing include vs import for templates?
21:01:01FromGitter<yyyc514> oh i get the “top level” error when i try to import/include the template at the call-site
21:02:08FromGitter<yyyc514> so how are you loading the templates themselves? i don’t see that in the code you pasted
21:02:55FromGitter<yyyc514> nim scares me cause i’m often importing the saem thing to every file and though i know it’s not getting confused i feel like it’s probably doing a lot of hard work to filter that all out and make sense of it
21:02:58FromGitter<yyyc514> something like strutils, etc
21:03:25FromGitter<yyyc514> i guess if the whole compiler builds in 12 seconds i’m probably good for a while, but still :)
21:05:59FromGitter<alehander42> well I am staticRead-ing my templates
21:06:04FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bc8f5bc38449236615efbd3]
21:06:18FromGitter<alehander42> but that's because they contain code
21:07:03FromGitter<alehander42> I mean I parseExpr them because they contain code, this way I have more control on what to do with that code
21:07:16FromGitter<alehander42> e.g. I can define a special proc instead or something else
21:07:37FromGitter<alehander42> with include I have to make sure the file itself contains something exported
21:07:46FromGitter<yyyc514> ah yeah i don’t think i can staticRead AND pass it to the code filter engine, i’d need to write my own engine
21:07:57FromGitter<yyyc514> i was trying to do an import_all macro but can’t because of the top-level things
21:08:03FromGitter<yyyc514> *trying to import each one in a loop)
21:08:35FromGitter<yyyc514> although i can swear i got this to work before
21:08:39FromGitter<yyyc514> if the macro was at the top level
21:09:10FromGitter<alehander42> I have no idea if parseExpr applies a code filter
21:09:16FromGitter<yyyc514> OH the import can’t be run from the macro lol :)
21:09:20FromGitter<yyyc514> it has to be generated AST :)
21:09:21FromGitter<yyyc514> one sec
21:20:05FromGitter<yyyc514> and now i can’t get it to work at all, grrrr
21:21:00FromGitter<yyyc514> it’s like my macro isn’t running at all
21:21:31FromGitter<yyyc514> ok it is just walkDir is doing nothing
21:24:27*hoijui quit (Ping timeout: 252 seconds)
21:27:06FromGitter<yyyc514> lkike walkDir is returning nothing
21:33:04FromGitter<yyyc514> it’s relative from current dir, weird
21:33:15FromGitter<yyyc514> not sure why it doesn’t throw an error if the directoy can’t be found - thought it did that earlier
21:33:19FromGitter<yyyc514> now it just does nothing silently
21:33:53*PMunch quit (Remote host closed the connection)
21:40:17*arecaceae quit (Remote host closed the connection)
21:40:31FromGitter<yyyc514> annoying that walkDir and import and running in different dirs :)
21:41:54FromGitter<citycide> can you constrain the parameter on a `proc {.importcpp.}` (js backend) to eg. one of 4 strings/cstrings? thought an `enum V = "V"` might do it but nah
21:43:09FromGitter<kaushalmodi> Araq: Success! with nightly deployment
21:43:30FromGitter<kaushalmodi> anyone up to test the nightly built release? I tested it fine on RHEL (Linux)
21:43:36FromGitter<kaushalmodi> any macOS/Win testers?
21:44:16FromGitter<kaushalmodi> Test nightly release: https://github.com/kaushalmodi/nightlies/releases/tag/untagged-c475d82c22c32f112cf9
21:45:05FromGitter<kaushalmodi> download, extract https://github.com/kaushalmodi/nightlies/releases/download/untagged-c475d82c22c32f112cf9/nim-0.19.1.tar.xz
21:45:29FromGitter<kaushalmodi> the archive is a surprise zipbomb.. 3.xMB extracts to ~500MB
21:51:09Araqzipbomb ... we probably need to do something about that
21:51:37Araqthe problem is we precompute the C sources for all CPU/OS combinations somebody ever was interested in
21:52:06Araqand they zip well, but don't "deduplicate" well anymore, even though deduplication has been implemented too
21:53:09Araqkaushalmodi: there is also a test for unzip + build.sh + tests via 'koch testinstall'
21:54:00FromGitter<yyyc514> any consistent naming for internalish variables?
21:54:04Araqwhich we can run if we don't already. anyway it's late here, will test the binaries tomorrow but create a PR already please
21:54:05FromGitter<yyyc514> i can’t use an underscore evidentaly :)
21:54:29Araqyyyc514: 'Impl' suffix is common for procs
21:55:35FromGitter<yyyc514> no this is a variable
21:55:59FromGitter<kayabaNerve> If anyone here is interested in BLS signatures, I just finished my lib for it. https://github.com/EmberCrypto/BLS
21:56:16FromGitter<yyyc514> maybe i’ll remove the inject and go back to leeting the compiler name it
21:57:02FromGitter<kaushalmodi> Araq: I wonder how koch testinstall works.. we will be deploying the archive only from one OS
21:57:18FromGitter<kaushalmodi> so we can testinstall only on the OS we are deploying from
21:57:23Araqwell read koch.nim to find out
21:57:42Araqnot everything written by me is hard to read...
21:57:45FromGitter<kaushalmodi> I didn't mean "how testinstall works"
21:57:45FromGitter<kayabaNerve> Read the source. It's like RTFM but for when you don't have proper docs.
21:58:00FromGitter<kayabaNerve> :thinking:
21:58:14FromGitter<kaushalmodi> My question is a practical one
21:58:31FromGitter<kaushalmodi> we are deploying one archive that can extract on all OSes
21:58:42FromGitter<kaushalmodi> so we can pick one of linux/osx to build that
21:59:21FromGitter<kaushalmodi> then running testinstall makes sense only on the OS whose built version we are deploying
22:00:00FromGitter<kaushalmodi> as I am deploying linux built archive (which technically should extract fine on osx too), running testinstall on linux won't prove that
22:00:18FromGitter<kaushalmodi> and running testinstall on osx on Travis makes no sense as we are not deploying the version built there
22:01:14FromGitter<kaushalmodi> so.. we need a "tester" repo that picks up the nightly built archive and tests on all OSes :P
22:03:00Araqyup
22:03:11Araqbut 'koch testinstall' is better than nothing
22:03:40FromGitter<yyyc514> anyone else using Sublime?
22:03:48Araqalso ... we can consider to avoid the zip bomb by producing nim_linux.tar.xz, nim_osx.tar.xz, nim_other.tar.xz
22:04:06FromGitter<yyyc514> my plugin is acting funny now because the path it uses to resolve the code when editing isn’t the same as when it’s compiling so my macro that walksDir is failing to compile inside the editor
22:04:41FromGitter<rayman22201> @Araq I think that is the solution I would favor. different zip packages for each main OS.
22:04:58FromGitter<rayman22201> @kaushalmodi trying the zip on windows now
22:09:03FromDiscord<hotdog> I found what was causing nim check to hang
22:09:25FromDiscord<hotdog> Here's the minimal example: https://ghostbin.com/paste/44wmm
22:09:30FromGitter<kaushalmodi> Araq: os-specific archives would be nice
22:09:52FromDiscord<hotdog> It compiles fine, but "nim check" will hang indefinitely, using 100% CPU
22:11:45*Tortice quit (Ping timeout: 252 seconds)
22:27:13*cozachk quit (Quit: Leaving)
22:28:40FromGitter<alehander42> hotdog, you are making me hungry
22:28:51FromGitter<alehander42> @yyyc514 I use sublime
22:29:25FromGitter<alehander42> are you talking about jump to?
22:29:57FromGitter<kaushalmodi> @rayman22201 ⏎ ⏎ > trying the zip on windows now ⏎ ⏎ what happened then? :P [https://gitter.im/nim-lang/Nim?at=5bc90964f659e67772da3790]
22:30:40*elrood quit (Quit: Leaving)
22:30:49FromGitter<rayman22201> sorry. Got distracted
22:31:32FromGitter<kaushalmodi> no worries. I am signing off for the day
22:32:44FromGitter<rayman22201> building now. I'll let you know. take it easy! @kaushalmodi
22:40:05FromGitter<yyyc514> https://github.com/Varriount/NimLime/issues/110 if anyone can help
22:40:34FromGitter<yyyc514> @alehander42 my magic import_all is failing the built in check because it’s not running the compiler from the root of the project evidentaly
22:40:38FromGitter<yyyc514> the issue explains it i think
22:41:52FromGitter<yyyc514> battery almost dead goign to have to head home
22:42:30FromGitter<yyyc514> maybe a nim.cfg seting can fix this?
22:44:47FromGitter<yyyc514> maybe not https://forum.nim-lang.org/t/3853
22:45:44FromGitter<yyyc514> bbiab
22:46:38FromGitter<rayman22201> @kaushalmodi and @araq the nightly zip worked for me on windows with no problems 😀 👍
22:47:24*endragor joined #nim
22:47:27FromGitter<kaushalmodi> 👍
22:50:44FromGitter<alehander42> well for relative imports you need to use "path"
22:50:48FromGitter<alehander42> @yyyc514 ^
22:52:14*endragor quit (Ping timeout: 268 seconds)
23:12:55*zachk joined #nim
23:14:40*zachk quit (Read error: Connection reset by peer)
23:14:58*zachk joined #nim
23:21:59*zachk quit (Changing host)
23:21:59*zachk joined #nim
23:23:09FromGitter<yyyc514> @alehander42 the problem is with walkDir not the imports
23:23:12*rockcavera quit (Read error: Connection reset by peer)
23:23:15FromGitter<yyyc514> the imports work if done manually
23:23:28*rockcavera joined #nim
23:23:28*rockcavera quit (Changing host)
23:23:28*rockcavera joined #nim
23:23:52FromGitter<yyyc514> i have ./app in my path
23:24:20FromGitter<yyyc514> walk dir seems to be local to the directory the compiler has as it’s PWD
23:24:32FromGitter<yyyc514> not the directory of the file in question
23:25:30*craigger joined #nim
23:27:39*craigger_ quit (Ping timeout: 252 seconds)
23:28:32FromGitter<alehander42> then just use
23:28:40FromGitter<alehander42> currentSourcePath & relativePath
23:28:49*darithorn quit ()
23:35:26FromGitter<yyyc514> hmmm
23:37:44*zachk quit (Quit: Leaving)
23:42:03FromGitter<yyyc514> where is relativepath documented
23:47:05FromDiscord<treeform> hmm how can this fail: https://gist.github.com/treeform/4ed4e280143a7f751f67dc93a0321176
23:47:28FromDiscord<treeform> it fails on this line: ` let alen = a.len`
23:47:38FromGitter<yyyc514> @alehander42 walkDir doesn’t like absolutely path
23:47:52FromDiscord<treeform> if a is null it returns 0, a is not null it returns len, how can it sigfault?
23:56:28FromGitter<yyyc514> @alehander42 thanks i got currentSourcePath working