<< 07-02-2018 >>

00:06:14skrylarIt compiled to C++ in the past
00:06:31skrylarmade a little mini roguelike with that once
00:13:02*unclechu quit (Ping timeout: 255 seconds)
00:13:10*hiway quit (Ping timeout: 256 seconds)
00:13:10*notdekka[m] quit (Ping timeout: 256 seconds)
00:13:10*planetis[m] quit (Ping timeout: 256 seconds)
00:13:11*byteflame quit (Ping timeout: 240 seconds)
00:13:13*TheManiac quit (Ping timeout: 255 seconds)
00:13:26*shashlick quit (Ping timeout: 248 seconds)
00:13:29*Miguelngel[m] quit (Ping timeout: 255 seconds)
00:13:36*dyce[m] quit (Ping timeout: 276 seconds)
00:13:38*Yardanico quit (Ping timeout: 255 seconds)
00:13:40*mgdelacroix[m] quit (Ping timeout: 240 seconds)
00:13:40*macsek1911[m] quit (Ping timeout: 240 seconds)
00:13:42*survivorm[m] quit (Ping timeout: 252 seconds)
00:13:54*Demos[m] quit (Ping timeout: 265 seconds)
00:13:54*hohlerde quit (Ping timeout: 265 seconds)
00:13:56*Jipok[m] quit (Ping timeout: 255 seconds)
00:14:14*ehmry quit (Ping timeout: 276 seconds)
00:21:46skrylarneat. some smalltalkers were at fosdem too
00:45:47*hiway joined #nim
00:58:11*byteflame joined #nim
00:58:11*dyce[m] joined #nim
00:58:11*Yardanico joined #nim
00:58:11*shashlick joined #nim
00:58:12*Miguelngel[m] joined #nim
00:58:12*mgdelacroix[m] joined #nim
00:58:12*Demos[m] joined #nim
00:58:12*unclechu joined #nim
00:58:12*ehmry joined #nim
00:58:18*survivorm[m] joined #nim
00:58:18*planetis[m] joined #nim
00:58:18*Jipok[m] joined #nim
00:58:18*TheManiac joined #nim
00:58:19*macsek1911[m] joined #nim
00:58:20*hohlerde joined #nim
00:58:20*notdekka[m] joined #nim
01:05:14*cspar joined #nim
01:08:17*cspar_ quit (Ping timeout: 248 seconds)
01:16:10*endragor joined #nim
01:17:37*yglukhov quit (Remote host closed the connection)
01:18:11*yglukhov joined #nim
01:18:28*radagast_04 quit (Quit: radagast_04)
01:20:42*endragor quit (Ping timeout: 255 seconds)
01:22:51*yglukhov quit (Ping timeout: 256 seconds)
01:27:45FromGitter<zacharycarter> Question - JS has this feature (at least in later ecmascript verisons) where when you call a method, if a variable you're providing for a parameter has the same name as the parameter, it's automagically matched for you
01:27:50FromGitter<zacharycarter> so instead of writing code like -
01:29:00FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a7a565cf283b8e5462c10e0]
01:29:21FromGitter<zacharycarter> if we were to apply this feature to Nim
01:30:25FromGitter<zacharycarter> I'm not sure how desirable it is - but for me / from my very naive viewpoint, I like the syntactic sugar
01:30:55FromGitter<zacharycarter> I guess it could potentially affect readability if users aren't aware of the features existence, but IMO it'd be a nice to have
01:33:36ieatnerdsI'm torn. It seems cool, but looks kind of ugly, at least IMO.
01:33:55ieatnerdsAnd you're right about readability for newcomers.
01:37:34FromGitter<zacharycarter> I just think - memberVariableName: memberVariableName is redundant I guess - I get that it's a mapping but when the mapping is obvious, it makes sense to me just to skip it altogether
01:38:09*gokr quit (Ping timeout: 248 seconds)
01:42:30FromGitter<zacharycarter> one thing JS really nails is some of its operators / syntax niceties - of course it's all moot once you factor in JS engine support / lack thereof. But still, as flawed as the language is, I think there are some takeaways. How many of them are easily attained due to the looseness of the language I'm not sure - but I constantly find myself using things like the spread operator, the feature I mentioned above, and
01:42:30FromGitter... others I'm not thinking of at the moment. I'll try to pay better attention to this.
02:22:48*chemist69 quit (Ping timeout: 240 seconds)
02:36:57*chemist69 joined #nim
02:54:12*shashlick quit (Ping timeout: 256 seconds)
02:54:18*byteflame quit (Ping timeout: 240 seconds)
02:54:31*Yardanico quit (Ping timeout: 248 seconds)
02:54:41*TheManiac quit (Ping timeout: 252 seconds)
02:54:42*dyce[m] quit (Ping timeout: 252 seconds)
02:54:47*Demos[m] quit (Ping timeout: 260 seconds)
02:54:48*Miguelngel[m] quit (Ping timeout: 256 seconds)
02:54:48*planetis[m] quit (Ping timeout: 240 seconds)
02:54:48*ehmry quit (Ping timeout: 240 seconds)
02:55:02*survivorm[m] quit (Ping timeout: 255 seconds)
02:55:03*notdekka[m] quit (Ping timeout: 248 seconds)
02:55:03*mgdelacroix[m] quit (Ping timeout: 248 seconds)
02:55:12*hohlerde quit (Ping timeout: 255 seconds)
02:55:13*Jipok[m] quit (Ping timeout: 256 seconds)
02:55:20*hiway quit (Ping timeout: 256 seconds)
02:55:26*macsek1911[m] quit (Ping timeout: 276 seconds)
02:55:26*unclechu quit (Ping timeout: 276 seconds)
02:58:43*radagast_04 joined #nim
03:02:26*rockcavera joined #nim
03:23:29*radagast_04 quit (Remote host closed the connection)
03:23:50*radagast_04 joined #nim
03:39:37*radagast_04 quit (Remote host closed the connection)
04:04:05*radagast_04 joined #nim
04:08:26skrylarzacharycarter: javascript makes more sense when you learn that it was intended to be HyperTalk, until management said "make it look java-y"
04:15:24FromGitter<Quelklef> Any way to increase maximum recursion depth?
04:29:44*endragor joined #nim
05:06:24*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
05:14:47*radagast_04 quit (Ping timeout: 260 seconds)
05:21:01*dddddd quit (Remote host closed the connection)
05:30:03*BitPuffin joined #nim
05:50:59skrylarQuelklef are you sure that's a good idea?
05:51:07skrylarstack space isn't infinite
05:51:51FromGitter<Quelklef> I mostly want to see if a bug is due to too deep recursion or due to an "actual" bug
05:52:02FromGitter<Quelklef> But I'm pretty sure it's the latter, so doesn't matter anyore
06:01:49*ehmry joined #nim
06:04:49*unclechu joined #nim
06:05:29yunfanif you are using python, it allow you to increase the default recursion depth
06:05:56yunfani think other could allow that too, since no one notice it until he has some knowledges
06:11:22*rauss quit (Quit: WeeChat 2.0.1)
06:12:38*rauss joined #nim
06:13:33*planetis[m] joined #nim
06:13:53*nsf joined #nim
06:18:48*yglukhov joined #nim
06:19:52*Jipok[m] joined #nim
06:19:59*hohlerde joined #nim
06:19:59*shashlick joined #nim
06:19:59*Miguelngel[m] joined #nim
06:19:59*notdekka[m] joined #nim
06:20:29*macsek1911[m] joined #nim
06:22:41*Demos[m] joined #nim
06:22:56*mgdelacroix[m] joined #nim
06:23:10*yglukhov quit (Ping timeout: 240 seconds)
06:23:22*Yardanico joined #nim
06:23:56*survivorm[m] joined #nim
06:25:48*byteflame joined #nim
06:26:40*TheManiac joined #nim
06:27:47*dyce[m] joined #nim
06:27:56*hiway joined #nim
06:44:24*gangstacat quit (Ping timeout: 256 seconds)
06:47:06*skelett quit (Ping timeout: 256 seconds)
06:57:47*gangstacat joined #nim
07:02:43*solitudesf joined #nim
07:23:48*Cthalupa quit (Ping timeout: 252 seconds)
07:26:38*Cthalupa joined #nim
07:38:54*gokr joined #nim
07:42:15*rokups joined #nim
07:55:59*skelett joined #nim
08:13:51*skrylar quit (Remote host closed the connection)
08:14:24*skrylar joined #nim
08:31:14*PMunch joined #nim
08:40:40*floppydh joined #nim
08:46:02*sleepyqt joined #nim
08:47:07skelettHello, am I able to create a compile time data structure in nim equivalent to https://files.skelett.io/node.c? All information to fill the structure is available at compile time.
08:50:47FromGitter<mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a7abde719147ac3231c9194]
08:51:03FromGitter<mratsim> probably something like that, you can try it on play.nim-lang.org
08:52:47FromGitter<mratsim> Static means: “require” info at compile-time, otherwise you can just not use the static
08:53:04FromGitter<mratsim> and create your object as a “const” it will be compile-time evaluated
09:02:47PMunchskelett, do you want to create the type at compile-time to be available at runtime, or do you want to create and use it on runtime
09:02:53PMunchBoth are doable :)
09:03:09skelettCould you please explain the last line containing the `array` statement? That's the line that always breaks my earlier tries. When I put a value type in there (`node`) I get a "recursive type" error, when I put `ref node` there, it's probably not compile time anymore and if I use `ptr` it compiles, but I cannot initialize the datastructure because the single nodes "have no address" (even with `unsafeAddr`)
09:03:49skelettI want to have this datastructure created at compiletime (read only tree) and read it at runtime
09:03:54FromGitter<mratsim> You cant use pointer/ref at compile-time (except strings) there is no heap memory at compile time
09:04:10AraqNode = object
09:04:14Araq kids: seq[Node]
09:04:20Araqshould work at compile-time
09:07:10PMunchOr you could do this: https://play.nim-lang.org/?gist=ae726736005fc2e97b17eb0eca7183ea
09:07:19PMunchIf you don't mind your object being a ref object
09:08:08PMunch@mratsim, ho won't have to as he's only using it on runtime
09:09:39PMunchskellet, or you could do it like this: https://play.nim-lang.org/?gist=dcb245fe4875fa64c9d2478841038616
09:09:54PMunchIf you don't want your object to be a ref object
09:10:49PMunchHmm, Araq why doesn't `new Node(name: "hello")` work? It's a bit tedious to have to do the multiline initialization for references to objects
09:11:40PMunchskelett, then of course if you wanted to create this type on compile-time based on something (say the contents of a file like I'm doing for protobuf) you'd need to wrap it up into a macro
09:12:58Araqbecause Nim is not C#? 'new' works completely differently
09:17:14PMunchYeah I was more wondering why there wasn't a way to do single-line initialization of ref objects
09:17:54Araqthere is
09:18:04AraqMyRefType(field: x)
09:18:14Araqor if you don't have an alias for the ref type
09:18:21Araq(ref MyType)(field: x)
09:18:27PMunchAh right
09:18:35PMunchThe last one was what I was looking for
09:18:43PMunchBut I guess an alias is nicer anyhow
09:20:36*yglukhov joined #nim
09:22:22FromGitter<survivorm> @PMunch I see yesterday you've edited first paragraph of an article 😄 ⏎ Thank you for Your effort, anyways. ⏎ But for now, i think using google translate was an error. It's good then you need a rought understanding of the subject, but for something more clean you'd better start yourself, google is a 'false friend'. I'm going to start manual translation, but that won't be a priority, so i wouldn't ask for your
09:22:22FromGitter... help with google-translated variant now. Maybe then i finish manual version. And that would be more honest too (after all, i can't ask you to do my own job, to 'beta' at maximum).
09:23:25PMunchsurvivorm, that wasn't me :P
09:23:45skelettThank you all! I'll play around with the examples you showed me :)
09:24:01FromGitter<survivorm> Than thank any brave soul who have done it
09:24:06PMunchsurvivorm, I've actually rewritten the first and parts of the second section already
09:24:12PMunchBut I didn't upload it
09:24:27survivorm[m]rtunately google doesn't save the anonymous author name
09:24:37FromGitter<survivorm> Unfo
09:25:00FromGitter<survivorm> Autofocus is nightmare sometimes
09:25:12PMunchHaha :P
09:25:37PMunchAnd by rewritten I don't mean fix minor bugs in the Google Translate version, but a total rewrite based on the information while trying to keep the same flow
09:25:55FromGitter<survivorm> That's great
09:26:15FromGitter<survivorm> Than i'm all to see it :)
09:27:05PMunchUnfortunately it's on my home computer, and I'm back at work :P
09:27:08FromGitter<survivorm> and, of cource it's co-authored now
09:27:22PMunchI got busy watching the falcon heavy launch yesterday :)
09:27:45FromGitter<survivorm> I have no idea what's this
09:27:59PMunchThe Falcon Heavy?
09:28:06FromGitter<survivorm> Yeah
09:28:07PMunchIt's SpaceX's latest rocket
09:28:14FromGitter<survivorm> Ah
09:28:17PMunchLargest rocket in current service
09:28:19FromGitter<survivorm> good :P
09:28:26PMunchAnd it had it's maiden flight yesterday
09:29:23FromGitter<survivorm> Space's interesting, but i'm rarely browsing news. Space news included
09:29:29PMunchWith returnable boosters landing in tandem, and the payload being Elon Musk's personal Tesla roadster as payload bound for a solar orbit above the orbit of Mars
09:30:01PMunchIf you would like to watch the launch: https://www.youtube.com/watch?v=bCc16uozHVE
09:30:30PMunchLiftoff is about 21:50
09:30:48FromGitter<survivorm> Great. But still we need something other than chemical drives to get a real space crafts, not mentioning starcrafts
09:31:14PMunchYeah that would be neat, but it takes a lot of power to go to space
09:31:39PMunchSo we'd need something with real oomph to ditch chemical rockets..
09:31:46FromGitter<survivorm> That means we do something wrong
09:31:51FromGitter<survivorm> usually
09:32:28PMunchWell, the spaceplane approach could save some fuel, but they still require a chemical drive
09:32:47FromGitter<survivorm> I mean TOTALLY wrong
09:32:58PMunch(sorry to anyone not interested in space an rocketry, just let us know and we'll hop over to #nim-offtopic)
09:33:08PMunchsurvivorm[m], not quite sure I follow :P
09:33:34PMunchYou could do off-world construction, but that's some time away still
09:34:03PMunchBuild the spaceship on the Moon with local resources for example
09:35:16FromGitter<survivorm> Maybe "right thing" is a gravity aproach, may be something else, like teleport (yeah, i know it's sci-fi now, but still), but to waste such amounts of resources just to take off (literally)...
09:39:10FromGitter<survivorm> Back to the right track. About the article - anything you care to share (and then and even if you do it at all) you may share at my mail, for example ([email protected]), or in google docs or any way you like. Just remember, in this chat i read only mentions guaranteed, other things are not
09:45:51PMunchWell BFR is going to run on Methane which will be produced by solar energy
09:46:12PMunchSo it will take carbon dioxide, hydrogen, and oxygen from the air and create methane
09:46:47PMunchWhich will then burn and create the first three, so that's sorta solar power with a detour
09:47:16PMunchsurvivorm[m], yeah I can upload and share it once I get home
09:47:26PMunchMy home machine is off so I can't SSH into it
09:48:11skelettAraq: with your example I get a compiler crash(?): https://play.nim-lang.org/?gist=7a65b2ff3890916599a7ed7de653e946
09:51:13PMunchHuh, that was a shockingly small error message
09:51:37skelett^^
09:52:09skelett`seq[ref node]` seems to work so far
09:53:56FromGitter<alehander42> ah, by defaul echo probably tries to expand kids infinitely, because there is no ref
09:54:00FromGitter<alehander42> so stack overflow
09:54:59PMunchYeah looks like it, changing it to echo grammar.node worked fine
09:55:06Araqthat's an old bug :-)
09:55:19skelettThis works: https://play.nim-lang.org/?gist=c28ac98ae993daa24e8b641d4a4378c5 => using this, thanks again :)
09:55:33skelettBut `kids` is empty
09:55:37skeletthow can it be expanded?
09:55:55PMunchHuh, that's a good point
09:56:05skelettIs there some kind of size calculation?
09:56:58skelettlike `8 + x*sizeof(8 + x*sizeof(8 + x*sizeof(...)))`
09:56:59PMunchOooh, "cli_node" are you doing something like compile-time docopts?
09:57:02FromGitter<alehander42> that's on compile time, I guess it's based on the type (still not sure why, is there no cycle detection for that ?)
09:58:45*rokups quit (Quit: Connection closed for inactivity)
09:59:12skelettI don't know about the internals of docopts (only read the description), but what I do is: I define a tree with a cli argument grammar which then can be used to implement things
09:59:51skelettI'm trying to rebuilding an old c project of mine
10:01:02miranAraq: any info on when 0.18 might be out?
10:01:03*yglukhov quit (Ping timeout: 248 seconds)
10:03:19PMunchskelett, kinda what docopts is doing, but it parses what you write as your "help" message as it's a pretty standard format by now
10:05:15PMunchIn Python (from which it originated), and the current Nim implementation, this is just dumb as it means your script will have to parse a potentially large amount of text every run just in order to decide what it's supposed to do. But if someone were to implement this on compile-time in Nim it would allow both the ease-of-use of docopts, and the speed of writing it manually :)
10:06:15skelettI just skimmed over the docopts source. The thing I'm currently building is definitly going in that direction
10:06:42skelettBut it's slightly different in the way the grammar is used
10:07:54skelettthe real grammar carries some callbacks to the used functions
10:08:06skelettIt's a bit hard to describe mit setup in words
10:08:43PMunchYeah, docopts could really do with some callbacks
10:09:42PMunchI was trying to rewrite it when I first started using Nim, but I might have another go at it now. Doesn't seem like it would be that hard now that I actually know how to write macros and parsers :P
10:11:22skelett:D my nim knowledge is still pretty limited unfortunately
10:11:38PMunchDon't worry, you'll get there :)
10:11:41PMunchAnd it's worth it
10:11:52*yglukhov joined #nim
10:11:53skelettWouldn't you need compile time pegs to implement sth like this at compiletime?
10:12:04skelettI thought pegs is runtime only
10:12:07PMunchNot with my combparser library ;)
10:12:15FromGitter<survivorm> :) I beg to differ. Anyone's way's different
10:13:06FromGitter<survivorm> but none's worse
10:17:51skelettPMunch: If you need help, from a c point of view, feel free to ask. Maybe we can even use the implementation I'm currently writing, for docopts too.
10:27:36*radagast_04 joined #nim
10:28:41*Vladar joined #nim
10:45:35PMunchYeah maybe I could just write a macro that converts from the docopts text to your grammar :)
10:45:51PMunchGoing to finish the protobuf implementation first though
10:46:56skelettAnd I mine :) I can only work after work at it
11:01:34*skelett quit (Ping timeout: 265 seconds)
11:13:50FromGitter<gogolxdong> How to set a timer?
11:14:40FromGitter<gogolxdong> like daily.
11:16:16euantorcron would be the best way. You could use `asyncdispatch` with `sleepAsync` if you need to do it inside application code
11:16:22euantorhttps://nim-lang.org/docs/asyncdispatch.html#sleepAsync,int
11:18:43FromGitter<gogolxdong> looks what we want ,thanks
11:19:00PMunchOnly works on Linux (and Mac?) of course
11:19:19euantorCron you mean? Windows has scheduled tasks to implement the same thing
11:22:17FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a7ae168b3c4a0d376f0c9b6]
11:22:44FromGitter<gogolxdong> How to make it right?
11:25:44euantor`sleepAsync` returns a `Future[void]`, not a `Future[bool]` so you can't use it like that
11:26:24euantorhttps://play.nim-lang.org/?gist=07a170d8a1e07b13291b8fa11c47a269
11:26:28FromGitter<gogolxdong> Yes, then how do I put it in a daily loop
11:26:49euantorplay.nim-lang.com will time out eventually, letting you see the full output
11:26:59FromGitter<gogolxdong> I see.
11:31:34FromGitter<gogolxdong> Does sleepAsync mean a idle thread ?
11:35:54euantorit uses a timer using epoll/kqueue/whatever internally I believe
11:37:01FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a7ae4dd86ef1bb1417be76f]
11:37:31euantordon't use `waitFor`, use `asyncCheck`
11:39:21*radagast_04 quit (Remote host closed the connection)
11:39:46FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a7ae58186ef1bb1417beb1a]
11:41:28euantorhttps://play.nim-lang.org/?gist=8bf7b0b8d5f4a7cfbd23cc77388d53b5
11:41:33euantorYes, something like that
12:15:40*Arrrr joined #nim
12:15:41*Arrrr quit (Changing host)
12:15:41*Arrrr joined #nim
12:16:56*dddddd joined #nim
12:21:13*zahary_ joined #nim
12:23:14FromGitter<alehander42> can I get arguments in emit similarly to imporcpp ?
12:23:20FromGitter<alehander42> importcpp*
12:26:06*Snircle joined #nim
12:29:04FromGitter<tim-st> Would be good if this works: `echo "abc" in "abcdef"`
12:31:02PMunchtim-st, what would you expect that to do?
12:31:07PMunchWrite out true?
12:31:38FromGitter<tim-st> sure, the same as in python
12:32:18FromGitter<tim-st> the same for `notin`, I prefered `not in` but `notin` is better than `not contains`
12:32:46dom96!eval import strutils; echo "abc" in "abcdef"
12:32:49NimBottrue
12:32:54PMunchIt works if you import strutils
12:32:57PMunchYeah..
12:33:10FromGitter<tim-st> oh ok, I didnt know that. Thanks
12:33:30PMunch"in" just calls contains, and cointans for strings is implemented in strutils
12:34:07dom96I wonder how hard it is to implement a proc search in the compiler to suggest to the user that they can import `strutils` for example
12:34:08FromGitter<tim-st> Yes, I'm facing missing imports for string quite often
12:35:01FromGitter<tim-st> A bit too difficult. I would add some string functions to system, because the string type is available by default
12:35:08PMunchNot in appears a bit more clunky: https://www.youtube.com/watch?v=np8GaFHD9Lg
12:35:29PMunchdom96, ooh that would be cool
12:35:56dom96the system module is too bloated
12:36:14PMunchtim-st, you quickly get used to importing strutils if you want to use string functions :)
12:36:23FromGitter<tim-st> at least do the line `from strutils import the most needed`
12:36:26PMunchTripped me up a bit at first as well :P
12:36:44FromGitter<tim-st> I'm working with str functions since like 4 months
12:37:06PMunchAnd you didn't need strutils until now?
12:38:11FromGitter<tim-st> I always need it, I called the main proc from another module and did `assert "..." notin var` and didnt think about importing something for this
12:39:05FromGitter<tim-st> I only had this import problems with strutils, this is the reason I'm writing it here
12:39:22PMunchHmm, I've run into similar things with sequtils
12:39:30PMunchI guess it all depends on the problem you're working on
12:40:08FromGitter<tim-st> Everyone will run into it. If I call assert "x".editDistance("...") of course I know this proc needs to be imported first
12:40:41FromGitter<tim-st> at least the sugar procs should be available for std types IMO
12:40:57PMunchI personally think the better solution would be to do something like what dom96 mentioned. Have the compiler suggest modules to import based on the error message
12:41:03PMunchBut that might be a PITA to implement
12:41:16PMunchtim-st yeah that's fair
12:41:24PMunchThe contains should at least be in system
12:41:29FromGitter<tim-st> that will take a long runetime or it will have a static map with lookup table
12:41:50PMunchBut putting all of strutils in system is a bit overkill
12:42:09FromGitter<tim-st> yes :(
12:42:29PMunchtim-st, well if it's only for the standard library (which makes sense), then it could be compiled in :)
12:42:54FromGitter<tim-st> for me it was only string. I never had problems with sets, tables, etc
12:43:12PMunchSo it would be static, and you only need to do lookup for it whenever you have a bug so I don't think performance for that isn't as important
12:43:29FromGitter<tim-st> I had one problem when calling toSeq from iterator
12:43:32FromGitter<tim-st> ok, yes
12:43:44PMunchIMHO having the compiler take a sec longer on errors but give me a vastly more useful error message would be a fair compromise.
12:44:37FromGitter<tim-st> yes, if it's guarranteed to be always a maximum that's good
12:48:16*radagast_04 joined #nim
12:49:06radagast_04Hi, I haven't done anything as such before, but what libraries should I look into if I want to play an audio file on a Linux system?
12:49:42PMunchdom96, if you could somehow generate a static table of "proc name" -> "module" then modifying this: https://github.com/nim-lang/Nim/blob/f3a895f04321853f32b571a1f314d72c73274ff6/compiler/lookups.nim#L259 to create an error should be easy
12:50:32yglukhovradagast_04: sdl2, or sound if you don't mind using openal
12:50:46PMunchradagast_04, depends on the sound format
12:51:56PMunchIf you just need to play a chime or something then I guess there's a terminal program for that which you could just staticExec
12:51:59radagast_04It could be any format, really. It's like an alarm.
12:52:29PMunchhttps://askubuntu.com/questions/920539/how-to-play-a-sound-from-terminal
12:53:11radagast_04I guess I could just call mpv, but is calling other programs considered a good habit?
12:53:19PMunchThen in Nim just do staticExec("play <filename>")
12:53:29PMunchWell, depends really
12:53:43PMunchIf you're just making a simple application then it's fine
12:53:52PMunchBut don't try to use it for a game or something
12:54:50PMunchOr yglukhov's library: https://github.com/yglukhov/sound
12:54:58PMunchThat should be cross platform :)
12:56:00radagast_04https://github.com/yglukhov/sound is exactly what I wanted. Thanks.
12:57:27PMunchBe warned though, the "proper" linux way would probably be to fire of a notification. But that depends a bit on what you're trying to do.
13:00:08ArrrrIs this lib able to open wav?
13:00:29ArrrrFrom the description doesn't seem to.
13:01:02radagast_04https://github.com/FedericoCeratto/nim-libnotify Now I am finding out if I can receive user inputs from notifications.
13:09:00PMunchhttps://stackoverflow.com/questions/37932966/action-callback-for-libnotify-not-working
13:09:12PMunchlibnotify certainly has support for it
13:09:51federico3radagast_04: user inputs?
13:11:45federico3I wonder if common notification daemons support it
13:12:05PMunchWell the Gnome and Ubuntu ones have some support for it
13:12:15PMunchI remember seeing music controls in a notification
13:12:42federico3d'you have to quickly press buttons before it disappears?
13:14:10PMunchhttps://bbs.archlinux.org/viewtopic.php?id=172965
13:14:53radagast_04Hi, federico3. I was going to make a toy alarm app. By "user inputs" I meant reading options like stop/snooze etc. I was going to test those but for some reason, in my arch system, even though lib2 is installed in my system I cannot use the library :( Says "glib2" not found at https://github.com/FedericoCeratto/nim-libnotify/blob/master/libnotify.nim#L13
13:16:36FromGitter<survivorm> did you install dev-files for the library too?
13:17:09FromGitter<survivorm> It's often a problem, if i undestand your case correctly
13:17:11radagast_04>https://bbs.archlinux.org/viewtopic.php?id=172965
13:17:12radagast_04It appears that it may not be supported
13:17:32PMunchFor notify-send
13:17:59PMunchBut the libnotify standard supports it I think
13:18:52federico3radagast_04: do you have the gtk2 pkg installed?
13:19:46PMunchhttps://developer.gnome.org/libnotify/unstable/NotifyNotification.html#notify-notification-add-action
13:20:44radagast_04federico3: I didn't have it installed, installing it works! Thanks.
13:20:58federico3radagast_04: my bad, I'll add the dependency
13:24:03PMunchDoes libnotify depend on Gtk?
13:26:07radagast_04Looks like it does, PMunch
13:29:01*skelett joined #nim
13:30:12FromGitter<alehander42> hm, is there a equivalent to header pragma
13:30:41FromGitter<alehander42> which doesn't hide the function declaration? I want to have a function body, but to still define that it depends on a header
13:35:22federico3PMunch: it needs glib
13:36:33PMunchAh right..
13:36:48PMunchI mean most people will have gtk installed anyways, for one thing or another
13:43:33*endragor quit (Remote host closed the connection)
13:54:06*Arrrr quit (Read error: Connection reset by peer)
13:55:59PMunchAraq, is there a way to create a mapping "proc name" -> "module" easily?
13:56:24PMunchFor implementing "you might find this in X" hints for undefined symbol errors
13:59:57AraqPMunch, nah
14:03:12dom96so you're saying it's impossible? :)
14:03:18dom96or just really difficult
14:04:54PMunchdom96, nothing is impossible! You could parse them out or list them manually :P
14:08:40Araqit's not even that difficult
14:08:46Araqrecompile the file that fails with
14:08:50Araqinclude prelude
14:08:52Araqat the top
14:09:09Araqand say that in the error message
14:09:38PMunchprelude?
14:09:49Araqbut it's another hack in the compiler and 'include prelude' is not that specific
14:10:26FromGitter<GULPF> @PMunch: https://github.com/nim-lang/Nim/blob/devel/lib/prelude.nim
14:10:37dom96My solution is more generic
14:10:47dom96It could find procedures in Nimble packages for example
14:11:13Araqwhat is your solution?
14:11:17PMunchOh you wanted to actually search it on runtime?
14:11:32PMunchruntime of the compiler, compile-time of the program
14:11:51PMunchI was thinking just generate and include a static table in the compiler for the stdlib
14:13:39Araqand when is that table consulted?
14:14:07PMunchhttps://github.com/nim-lang/Nim/blob/f3a895f04321853f32b571a1f314d72c73274ff6/compiler/lookups.nim#L259
14:14:08PMunchThere
14:14:29PMunchOr rather the line below
14:14:35Araqnot good enough. 'in' template fails because of missing 'contains' procs
14:14:40Araqbut a good start.
14:14:51Araqthat one and when overloading resolution fails.
14:16:15PMunchHmm, yeah. In fails with wrong arguments
14:18:41PMunchBut with the mapping it should be easy to add new candidates here: https://github.com/nim-lang/Nim/blob/2199f8328059ffa62400acc7342b36dd50aed7e2/compiler/semcall.nim#L175
14:19:05PMunchSomething like "contains (from strutils module)"
14:19:48PMunchOr create another section "Could be missing one of the following imports:\nstrutils"
14:21:08Yardanicomaybe nimsuggest can be used to scan all stdlib and produce static map needed for this suggestion?
14:21:30Yardanicoah, this won't easily work for nimble packages :)
14:22:55dom96I want to have various hints in the compiler
14:23:26dom96This could be one of them. If an overload for a procedure isn't found, scan all the modules in Nim's module path for a procedure overload that does match it
14:25:53PMunchWell, I'd say stdlib is "good enough", Nimble packages would be nice, but when you're using a package from Nimble you're probably aware of it
14:26:19PMunchJust stdlib would help with stuff like 'in' missing contains(string, string) from strutils
14:29:12FromGitter<alehander42> ah, I wanted to suggest some kind of better formatting for overloads (orthogonal to dom96's idea):
14:29:16FromGitter<alehander42> https://gist.github.com/alehander42/5616d1800a883ed043585625e4ecd13b
14:30:11dom96PMunch: I'd imagine if you can get it to work for the stdlib then getting it to work for Nimble would be trivial.
14:30:34FromGitter<alehander42> overally to somehow limit duplicated information and to group based on which arg doesn't match (because currently there is too much noise I think)
14:32:11PMunchdom96, that might be true. But for stdlib could be done on compile-time by using a stand-alone script for example
14:32:44dom96alehander42: that looks quite similar to what I suggested yesterday as well
14:33:09dom96https://irclogs.nim-lang.org/06-02-2018.html#12:44:26
14:33:42FromGitter<alehander42> ah, not really familiar with clang errors, but I'll check them out
14:34:48FromGitter<alehander42> I agree about ^___, in this case I want to also focus on not duplicating "but expression .. is of type .." for each overload (as sometimes you have >10 overloads and you just get a giant unindented wall of text)
14:34:55dom96I might be misremembering how it works in clang actually, but the example I give below shows what I have in mind
14:35:30PMunchYeah, it should at least group by argument position and indent the groups
14:37:54PMunchTurning it into something like this: http://ix.io/Fq7/
14:39:57Araqwell I implemented the logic foundations, now you can tweak it endlessly with PRs
14:40:25Araqextra points if the implementation requires less lines than the existing compiler
14:41:10FromGitter<alehander42> @dom96 almost, but ^___ and deindenting "but expression ' is of type:" to show once in the bottom of each group seems most clear to me (with the least amount of visual noise)
14:41:26FromGitter<alehander42> yeah, PR-s are the way
14:42:00FromGitter<krux02> Well I am pretty happy with Nim error messages.
14:42:35FromGitter<krux02> not to long, and always about what the problem is.
14:42:46FromGitter<krux02> Maybe a bit too technical for newcomers
14:43:07FromGitter<krux02> but for me, I never had the problem where I just didn't know what the problem was
14:43:16FromGitter<krux02> just the stack trace in Nim was a bit weird to me
14:43:59FromGitter<krux02> it was upside down, and somehow I had the impression the locations of function calls was off by a line
14:44:03FromGitter<krux02> but I got used to it
14:44:56*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
14:46:42FromGitter<alehander42> they still can show the same info in a bit optimal way sometimes, it's not only about seeing what the problem is, but seeing it extra quickly
14:46:49FromGitter<alehander42> bit more*
15:06:17FromGitter<tim-st> Another thing which is imo missing for nim is a *tour* like golang has: https://tour.golang.org/ for me this was very helpful and the reason Iearnt golang some time ago
15:06:43FromGitter<k0pernicus> An interactive tutorial ?
15:07:26FromGitter<tim-st> yes, exactly, starting with very trivial things for each type and important module
15:07:47FromGitter<tim-st> going over passing a var type to a proc
15:07:52FromGitter<k0pernicus> I agree that an online tutorial can be very cool to apprehend the language...
15:07:52FromGitter<tim-st> and so on
15:10:33FromGitter<tim-st> if such a tour would be available, someone could create a pdf presentation like golang has or a youtube video, show the cool features of nim and than just link to the tour, and the users will be there^^
15:11:57PMunchHmm, shouldn't be too hard to implement over play.nim-lang.org
15:13:16FromGitter<tim-st> the biggest problem for people searching for a language is, that they have a massive amount of options, they dont want to install a big gcc and difficult things, before they dont know if they like the language
15:13:35livcdwell there is nim by example right
15:13:38PMunchYeah, I typically check out learnxinyminutes.org
15:13:50PMunchErr. com
15:14:25FromGitter<tim-st> No, nim by example is *not* interactive,
15:14:59FromGitter<tim-st> it has to be like a game imo, to bind the user, not to show him massive code
15:17:39*yglukhov quit (Remote host closed the connection)
15:18:15*yglukhov joined #nim
15:19:37dom96yep, the playground has an API so you can easily use it to make a tutorial
15:19:42*yglukhov quit (Read error: Connection reset by peer)
15:20:00*yglukhov joined #nim
15:20:40FromGitter<tim-st> I would add a beginner chapter to make sure it is really step by step on a low dummy level
15:23:07PMunchdom96, link to the repo?
15:23:34PMunchI tried to look for it but "Nim play" wasn't very helpful when there is a game called Nim as well :P
15:23:34dom96https://github.com/zacharycarter/nim-playground
15:24:26*yglukhov quit (Ping timeout: 255 seconds)
15:25:22FromGitter<Quelklef> https://play.nim-lang.org/
15:25:26FromGitter<Quelklef> wait
15:25:28FromGitter<Quelklef> ignore me
15:25:35FromGitter<Quelklef> sorry folks
15:28:32dom96I need to get zacharycarter to host it on our VPS
15:30:24PMunchWhere is it hosted now?
15:32:32*skelett quit (Ping timeout: 260 seconds)
15:53:18*clyybber joined #nim
16:05:04*natrys joined #nim
16:05:23*natrys is now known as ImranKhan
16:05:51*floppydh quit (Quit: WeeChat 2.0.1)
16:09:31*Jesin joined #nim
16:10:18PMunchOh, you can just send a post request to the live version, cool!
16:10:36PMunchThat makes it real easy to make something like the golang tour
16:11:35dom96yep, that's how !eval works
16:11:45dom96It's hosted on his personal VPS IIRC
16:12:45PMunchHmm, is it just me though or does it strip newlines from the compiler log?
16:12:54PMunchOh no wait
16:12:58PMunchIt just encodes them as \n
16:16:37*vivus joined #nim
16:23:28*Jesin quit (Quit: Leaving)
16:24:41*yglukhov joined #nim
16:29:05*yglukhov quit (Ping timeout: 240 seconds)
16:37:09ieatnerdsWhat's everyone working on today?
16:37:54PMunchStill tinkering with my protobuf implementation
16:38:27PMunchNested messages seems to be a problem with how the parser is implemented
16:44:05FromGitter<mratsim> are you implementing protobuf in pure Nim or just wrapping the C implementation?
16:44:12PMunchPure
16:44:27PMunchAs a macro, so it will read the .proto file on compile-time
16:44:35PMunchAnd create the stuff you need to use it
16:45:37FromGitter<mratsim> I see: you might be interested in checking: FlatBuffer: https://github.com/Skrylar/skflatbuffers/blob/master/skflatbuffer.nim and NESM if you didn’t already see those: https://github.com/xomachine/NESM
16:49:48PMunchOh yeah, this is for protobuf compatability
16:50:04PMunchIt's pretty popular so I thought I'd implement it :)
17:03:37*PMunch quit (Quit: Leaving)
17:05:57FromGitter<andreaferretti> @PMunch very useful indeed!
17:07:14*rinzai joined #nim
17:07:42*Trustable joined #nim
17:12:41rinzaihi everyone. is there a way to unit test methods not exported with `*`?
17:13:17FromGitter<andreaferretti> you can `include` your module in your tests
17:13:40rinzaiandreaferretti, thanks!
17:25:04*endragor joined #nim
17:34:21*yglukhov joined #nim
17:38:41*yglukhov quit (Ping timeout: 248 seconds)
17:46:27*ImranKhan quit (Read error: Connection reset by peer)
17:52:03*yglukhov joined #nim
17:52:55*yglukhov quit (Read error: Connection reset by peer)
17:53:28*yglukhov joined #nim
18:20:55*kunev_ joined #nim
18:20:56*kunev quit (Ping timeout: 276 seconds)
18:24:03*Trustable quit (Remote host closed the connection)
18:39:02*fvs joined #nim
18:41:49*endragor quit (Remote host closed the connection)
18:43:07fvshowto pass filename with spaces to fileExists?
18:45:53fvsmy bad - it works OK
19:02:37*fvs left #nim ("ERC (IRC client for Emacs 25.3.1)")
19:08:06*zolk3ri joined #nim
19:28:47*vivus quit (Ping timeout: 255 seconds)
19:34:51*xincognito10[m] joined #nim
19:36:24xincognito10[m]hey guys, theoretically speaking, would it be possible to recode the linux kernel in nim? theoretically?
19:39:25*yglukhov quit ()
19:40:47*yglukhov joined #nim
19:43:15dom96yep
19:43:33dom96See nimkernel for proof
19:44:54xincognito10[m]cool! so would i be better off learning nim rather than C and C++?
19:49:48FromGitter<Quelklef> It depends on what your goal is
19:50:11FromGitter<Quelklef> Generally, the higher level a programming language is, the easier it will be to use but the slower it will be
19:50:39xincognito10[m]hmm
19:50:42FromGitter<Quelklef> Nim is designed to be fast, but no compiler will ever be smart enough to outperform handwritten code in the language it compiles to
19:50:56FromGitter<Quelklef> (Given that the programmer is experienced in that language)
19:51:39FromGitter<Quelklef> (Also, the one exception I know of is that some optimizers will outperform handwritten assembly, see https://theory.stanford.edu/~aiken/publications/papers/asplos13.pdf)
19:52:35FromGitter<Quelklef> ("... [STOKE is] able to produce programs which either match or outperform the code produced by gcc -O3, icc -O3, and in some cases, expert handwritten assembly.")
19:52:54xincognito10[m]so what about compiling to c and then compiling that c into binaries?
19:53:20FromGitter<Quelklef> That's currently one way to compile Nim to an executable
19:54:38xincognito10[m]but it wouldnt have the same performance would it?
19:54:47FromGitter<Quelklef> I very, very highly doubt it
19:55:29FromGitter<Quelklef> Of course, it depends on the situation. But generally, writing it yourself in C will create a faster result (if you're good enough)
19:55:38xincognito10[m]ahh okay
19:56:20xincognito10[m]okay so if i had to choose between C, C++ and Nim, which combinations would be best to learn?
19:56:33FromGitter<Quelklef> Depends on what you're doing
19:56:43skrylarburn c++, maybe learn C
19:57:41skrylaractually learning C can't hurt. it will never die, it's everywhere, and it's not that bad (until you need an object model for something)
19:58:10xincognito10[m]yeah
19:58:52FromGitter<Quelklef> if you're just trying to learn a language for fun, though, go for Nim
19:58:59FromGitter<Quelklef> less painful
19:59:11xincognito10[m]yeah
19:59:24dom96Quelklef: I think you're overestimating C's performance a bit
19:59:41FromGitter<Quelklef> hows that
20:00:06dom96Nim really doesn't introduce much overhead, and if you're a good enough Nim developer you can also optimise the code just like you can in C.
20:00:31*rinzai quit (Ping timeout: 248 seconds)
20:01:50FromGitter<Quelklef> hmmmm
20:02:00*BitPuffin quit (Remote host closed the connection)
20:02:32FromGitter<Quelklef> I trust you. The point still stands that any Nim program has an equal-functionality but >=speed C counterpart
20:02:59skrylarthe issue with using a neolang for learning is that nim has less educational resources than others
20:03:00FromGitter<Quelklef> So it speed a concern then getting as low level as possible is a good idea
20:03:53*endragor joined #nim
20:04:59skrylaram not actually sure what books they recommend for people who don't know any computer science; have seen a lot of "how do java in 12 minutes lol" books but then the person doesn't understand linked lists and stuff. bleh.
20:05:22FromGitter<Quelklef> Consider that `for x in 0..100: echo x` compiles to 11k lines of C
20:05:42skrylarisn't that mostly boilerplate
20:05:52FromGitter<Quelklef> Probably, lemme inspect the actual output more
20:05:59FromGitter<Quelklef> I'd bet most of it isn't called
20:06:12skrylarA lot of that is runtime stuff. Same issue as with Dephi/FPC
20:06:44skrylarDelphi/FPC and others carry their baggage so hello world is big but complex apps are the same size, whereas C has a tiny hello world and then balloons in size
20:07:02skrylarjust add one boost lib and watch your code boom, compile time and all
20:07:25*clyybber quit (Ping timeout: 260 seconds)
20:07:31FromGitter<Quelklef> actually iirc Nim's pretty good about that
20:07:44FromGitter<Quelklef> only compiles procs that are actually used i think
20:07:47*clyybber joined #nim
20:08:09skrylaryou can enable dead code elimination, yes. there is still a set amount of runtime, and baggage. some of those "11k lines" are just line pragmas
20:08:40skrylarif you were to look at scala or kotlin they carry the same in their runtimes
20:11:05FromGitter<Quelklef> although maybe most of the nim overhead is reduced by the actual C compiler
20:11:28FromGitter<Quelklef> so it's not actually a big deal. IDK, at this point Araq or dom should be asked
20:16:18*yglukhov quit (Remote host closed the connection)
20:16:52*yglukhov joined #nim
20:17:48FromGitter<Quelklef> Also, come to think of it, I wonder if the flexibility introduced by Nim outweighs the small overhead
20:18:30FromGitter<Quelklef> like, in reality, people don't have infinite time to do projects. So maybe Nim'd outperform C where it actually matters, when deadlines and stuff are concerned
20:18:48xincognito10[m]yeah
20:19:23xincognito10[m]do you guys think nim is fast enough to code a full scale modern os kernel with decent performance?
20:21:25*yglukhov quit (Ping timeout: 260 seconds)
20:21:37FromGitter<Quelklef> why, are you planning to?
20:22:55xincognito10[m]yeah, ive been thinking about it
20:22:57xincognito10[m]like in the distant future
20:23:09xincognito10[m]once i know nim...and kernels...
20:23:46FromGitter<Quelklef> :)
20:23:58xincognito10[m]xD
20:30:59FromGitter<zetashift> @xincognito10[m] : you could check out: https://github.com/dom96/nimkernel
20:31:05xincognito10[m]ill take that as a yes!
20:31:21xincognito10[m]okay i will!
20:36:42*rinzai joined #nim
20:38:11*yglukhov joined #nim
20:39:17*clyybber quit (Ping timeout: 255 seconds)
20:40:57*rinzai quit (Ping timeout: 240 seconds)
20:45:24*xet7_ joined #nim
20:46:05*xet7 is now known as Guest90278
20:46:23*xet7_ quit (Remote host closed the connection)
20:46:46*xet7_ joined #nim
20:46:53*Guest90278 quit (Ping timeout: 265 seconds)
20:48:20*xet7_ is now known as xet7
21:04:13*nsf quit (Quit: WeeChat 2.0.1)
21:19:34*darithorn joined #nim
21:21:11*rinzai joined #nim
21:40:27*radagast_04 quit (Ping timeout: 240 seconds)
21:49:41*PMunch joined #nim
21:50:53*sleepyqt quit (Quit: Leaving)
21:51:58PMunchFor survivorm whenever he comes back: http://ix.io/Frq
21:52:18PMunch(Partially so I can find that link in the log tomorrow and send it to him)
21:52:39*PMunch quit (Client Quit)
22:14:35*solitudesf quit (Ping timeout: 260 seconds)
22:20:10*Vladar quit (Quit: Leaving)
22:24:36*yglukhov quit (Remote host closed the connection)
22:25:10*yglukhov joined #nim
22:27:45*MJCaley joined #nim
22:29:36*yglukhov quit (Ping timeout: 256 seconds)
22:42:05*Snircle joined #nim
22:42:12*MJCaley quit (Quit: MJCaley)
23:01:30FromGitter<Quelklef> Out of curiosity, what was Nim written in before bootstrapping started? C?
23:02:22xincognito10[m]bootstrapping? nim is coded in nim?
23:02:51FromGitter<Quelklef> Right. But the initial compiler had to be written in something else
23:03:22xincognito10[m]ahh
23:16:57Araqit was Pascal/Delphi, or rather a subset of it that pas2nim could handle
23:25:36*peppe__ joined #nim
23:31:25*peppe__ quit (Ping timeout: 260 seconds)
23:55:11*gokr left #nim (#nim)