<< 07-08-2017 >>

00:00:42*Jesin joined #nim
00:00:42*vivus quit (Quit: Leaving)
00:10:03*Sentreen quit (Quit: WeeChat 1.6)
00:10:32*couven92 quit (Ping timeout: 260 seconds)
00:11:13*Sentreen joined #nim
00:19:37*Sentreen quit (Quit: WeeChat 1.6)
00:20:03*Sentreen joined #nim
00:23:43*Sentreen quit (Client Quit)
00:26:21*Sentreen joined #nim
00:29:22*Sentreen quit (Client Quit)
00:29:46*Sentreen joined #nim
00:30:02*endragor joined #nim
00:34:05*endragor quit (Ping timeout: 240 seconds)
00:36:15doznJesus, you guys have a nim playground and don't even talk about it on the homepage? The example at the very least should have a link to the playground =b
00:36:55doznI was looking for "nim online compiler" the entire time
00:41:10*mahmudov quit (Quit: Leaving)
00:41:23*mahmudov joined #nim
01:06:04*chemist69 quit (Ping timeout: 276 seconds)
01:19:20*chemist69 joined #nim
01:34:05*jinshil_ joined #nim
01:34:45*jinshil quit (Quit: Good-bye!)
01:34:45*jinshil_ quit (Client Quit)
01:34:59*jinshil joined #nim
01:46:38mahmudovhttps://play.nim-lang.org/ has paste api ?
02:05:46FromGitter<Sud0nim> @dozn Totally agree - I use and abuse that thing daily at the moment, but it's hard to find
02:21:35FromGitter<vegansk> @TiberiumN , yes it's possible, but I'm not using jnim on Android so can't help you with it, sorry
02:23:06FromGitter<zetashift> can somebody help me doing the Nim-way of the toString method of : http://craftinginterpreters.com/scanning.html#location-information
02:23:49FromGitter<zetashift> I can't figure out how to concatenate the enum and string; Should I overload the '&' operator?
02:27:33FromGitter<zetashift> currently have only " proc toString*(token: Token): string = " and then I'm hopeless!
02:32:41FromGitter<Sud0nim> Unless I'm misunderstanding what you need, you should be able to say: $enumType & "hello"
02:33:02FromGitter<Sud0nim> So just put a '$' in front of the enum to convert it to a string
02:33:22FromGitter<zetashift> oh sweet
02:33:57FromGitter<zetashift> it even works for the literal field which is a RootObj!
02:34:12FromGitter<zetashift> Thank you. :)
02:34:20FromGitter<Sud0nim> Nim is full of awesome surprises
02:34:50FromGitter<zetashift> Feels spartan and rewarding
02:39:52*arnetheduck quit (Ping timeout: 260 seconds)
03:00:29*pilne quit (Quit: Quitting!)
03:05:15*mahmudov quit (Remote host closed the connection)
03:07:56*endragor joined #nim
03:37:38*def-pri-pub quit (Quit: leaving)
04:26:10*rauss quit (Ping timeout: 240 seconds)
04:28:21*rauss joined #nim
04:35:04*rauss quit (Quit: WeeChat 1.9)
04:35:25*rauss joined #nim
04:51:58doznYeah, it's such a different type of language from what I'm used to, but the experience has been very rewarding
04:52:20doznI do hope v1 will bring on a slew of people who enjoy it as well
04:52:55doznI'm a patient man though, I'd rather the language be exactly where Araq wants it, so the first impression is a good one
04:56:20doznForward declarations are a big one personally, I enjoy reading code top-down
04:56:37doznI can deal with it regardless of course, but it would be fantastic =)
05:30:54*Trustable joined #nim
05:30:58*rauss quit (Quit: WeeChat 1.9)
05:31:41*Trustable quit (Client Quit)
05:36:24*tdc joined #nim
05:41:01*dankrad quit (Ping timeout: 276 seconds)
05:48:17*Vladar joined #nim
06:06:24*sz0 joined #nim
06:20:20*yglukhov joined #nim
06:24:22*nsf joined #nim
06:24:28*yglukhov quit (Ping timeout: 240 seconds)
07:09:23*skrylar joined #nim
07:10:14skrylarbson module reads all the things now afaik
07:10:27skrylarjust needs some more unit tests
07:15:42*Ven joined #nim
07:16:06*Ven is now known as Guest15800
07:19:50*Guest15800 quit (Ping timeout: 240 seconds)
07:25:44*yglukhov joined #nim
07:30:13*yglukhov quit (Ping timeout: 255 seconds)
07:31:25*yglukhov joined #nim
07:39:39FromGitter<TiberiumN> skrylar did you see bson from nimongo?
07:39:58skrylari saw there was some binding to a c lib in some subproject
07:40:06skrylarbut nothing in nimble
07:40:22skrylarthis is 100% native nim
08:03:38FromGitter<TiberiumN> well there's pure nim
08:03:48FromGitter<TiberiumN> https://github.com/SSPkrolik/nimongo/blob/master/nimongo/bson.nim
08:04:02FromGitter<TiberiumN> it doesn't depend on any other modules rather stdlib
08:04:20FromGitter<TiberiumN> well it does (just on simple timeit module)
08:04:46*couven92 joined #nim
08:05:26*skrylar shrug.
08:05:30dozntoml v4 would be important
08:06:15doznv0.4*
08:10:04skrylartoml is ok. bit weird.
08:13:17skrylari need to store neural networks on disk and it was either this or ebml
08:29:23*sz0 quit (Quit: Connection closed for inactivity)
08:32:05*nattefrost joined #nim
08:36:14*flyx quit (Quit: ZNC - http://znc.in)
08:36:49*flyx joined #nim
08:37:08*flyx quit (Client Quit)
08:37:29*flyx joined #nim
08:44:34FromGitter<TiberiumN> hmm, wait, so concepts can be used instead of classes in some cases?
08:44:53*tankfeeder joined #nim
08:45:28tankfeederhi all
08:45:55FromGitter<TiberiumN> hi!
08:45:59couven92hi tankfeeder
08:48:22tankfeederhttps://pastebin.com/SjhdwzVh
08:48:28tankfeederthis is pseudo like code
08:48:43tankfeederis it possible to implement for strings and seq?
08:49:01tankfeederin one function
08:49:20FromGitter<TiberiumN> generics?
08:49:24tankfeederdo ord only when input is string
08:49:32FromGitter<TiberiumN> well
08:49:35FromGitter<TiberiumN> what is data_size?
08:49:44tankfeeder3
08:49:53FromGitter<TiberiumN> oh wait
08:49:54tankfeedermike("abc", 3)
08:50:01tankfeederforget to write
08:51:13couven92tankfeeder couldn't you use a concept for that?
08:51:21FromGitter<TiberiumN> hmm
08:51:22FromGitter<TiberiumN> it works
08:51:26FromGitter<TiberiumN> but
08:51:44FromGitter<TiberiumN> https://gist.github.com/zacharycarter/4b3c8e56220d696e12d5997fd7d18bd2
08:52:00FromGitter<TiberiumN> so I added "string | seq" and "when data is seq"
08:52:04FromGitter<TiberiumN> because this would be compile-time check
08:52:30tankfeederTiberium: oh, how it named? i want find it in documentation
08:52:55FromGitter<TiberiumN> what do you want to find?
08:52:58tankfeederthis thing "string | seq"
08:53:03FromGitter<TiberiumN> it's a generic
08:53:15FromGitter<TiberiumN> https://nim-lang.org/docs/tut2.html#generics
08:53:27FromGitter<TiberiumN> https://nim-lang.org/docs/manual.html#generics
08:53:35FromGitter<TiberiumN> The is operator checks for type equivalence at compile time. It is therefore very useful for type specialization within generic code:
08:54:35tankfeederi dont see | operator in documentation
08:54:48tankfeederhttps://nim-lang.org/docs/manual.html#pattern-operators-the-operator
08:54:50tankfeederthis one /
08:54:52FromGitter<TiberiumN> Nim also allows for type classes and regular types to be specified as type constraints of the generic type parameter:
08:55:11FromGitter<TiberiumN> scroll a bit after https://nim-lang.org/docs/manual.html#generics-type-classes
08:55:51tankfeederok
08:56:12couven92it's actually very nice how C# recntly changed the switch statement to do pattern matching instead... Even though the type checking is done at runtime, not at compiletime :)
08:56:38*couven92 quit (Quit: Client disconnecting)
08:57:00*couven92 joined #nim
08:57:01FromGitter<TiberiumN> I actually realized now that this code (mike) looks like usual python code with "isistance" checks lol
08:57:12FromGitter<TiberiumN> but everything is checked at compile-time and everything is type safe :)
08:57:13*skrylar quit (Quit: My iMac has gone to sleep. ZZZzzz…)
08:57:30couven92yeah, it's fantastic! :D
08:57:37tankfeederfound
08:57:37tankfeederproc onlyIntOrString[T: int|string](x, y: T) = discard
08:57:41tankfeederok
08:57:44FromGitter<TiberiumN> yep
08:58:24*skrylar joined #nim
09:01:31*Ven joined #nim
09:01:55*Ven is now known as Guest81141
09:04:37*smt quit (Ping timeout: 246 seconds)
09:05:55*jinshil quit (Quit: Good-bye!)
09:06:40couven92@TiberiumN, I have looked over your Android test results BTW... First, you haven't installed some of the nimbles that testament uses (zip, opengl and jester) look at .travis.yml for reference... Some of your test failures come from a missing internet connection, some are boehm GC and coro which Araq said we shouldn't bother with yet
09:07:34FromGitter<TiberiumN> ok, I just didn't knew because I didn't test Nim before
09:08:09FromGitter<TiberiumN> well IDK about internet connection
09:08:20FromGitter<TiberiumN> maybe termux went to some state of "sleep" so internet was disabled
09:08:27FromGitter<TiberiumN> because I've used my phone at the same time
09:08:34*skrylar quit (Quit: My iMac has gone to sleep. ZZZzzz…)
09:08:35*Guest81141 quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:09:06couven92yeah... maybe... anyways, from what I can see only 3 of your 18 fails are actually relevant for us right now! That's nice! :)
09:10:01couven92`coroutines/twait.nim`, `newconfig/tfoo.nim` and `stdlib/tnre.nim`
09:10:12FromGitter<TiberiumN> nre
09:10:22FromGitter<TiberiumN> probably because I didn't had pcre installed?
09:10:37couven92Oh, yeah that might be! :)
09:10:47couven92Okay, down to two then! :D
09:11:41FromGitter<TiberiumN> https://nim-lang.org/docs/nre.html
09:11:48FromGitter<TiberiumN> I don't know if we can install nre on termux
09:11:53FromGitter<TiberiumN> *pcre
09:12:00FromGitter<TiberiumN> ah
09:12:02FromGitter<TiberiumN> it seems we can
09:12:58FromGitter<TiberiumN> yes
09:13:03FromGitter<TiberiumN> I just ran tnre test itself
09:13:07FromGitter<TiberiumN> everything is OK
09:13:13couven92great! :)
09:14:08FromGitter<TiberiumN> on "tfoo" it says that createDir is undeclared at lib/pure/ospaths.nim(548, 12)
09:14:31couven92yeah... I have a feeling where that is coming from...
09:14:38FromGitter<TiberiumN> elif defined(android):
09:14:41FromGitter<TiberiumN> yep
09:15:59couven92yeah... that's my wrong-doing... uhm...
09:17:07*mahmudov joined #nim
09:20:11couven92Uhm, Araq, how should I deal with createDir not being declared yet in ospaths.nim for android? Remember I try to create the temp dir when it's not there?
09:21:19*Ven_ joined #nim
09:35:51*Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:45:41*Arrrr joined #nim
09:45:41*Arrrr quit (Changing host)
09:45:41*Arrrr joined #nim
09:47:39ArrrrAre exceptions for bad engineers?
09:54:48Araq_no, they are for IO failures
09:56:11couven92Araq_, actually regarding the createDir not being declared... Is that maybe because of nimscript?
09:56:25*Arrrr quit (Read error: Connection reset by peer)
09:57:15couven92because stuff like nimble compiles fine, but running for example `nim e tests/test_nimscript.nims` fails...
10:01:25Araq_I'm not sure but os.nim needs to be fixed, it imports ospaths and includes it at the same time
10:02:23couven92yeah... I'm trying to circumvent createDir with `when declared(os):` for now... that should help
10:02:34couven92btw, what's up with your nick Araq_?
10:06:18*Araq_ is now known as Araq
10:06:42couven92now that's much better! :)
10:25:45couven92Araq, what is coro? and why doesn't it work on Android? Or rather, why did you say that we shouldn't worry much about that?
10:43:30*arnetheduck joined #nim
10:45:41*haha_ joined #nim
10:48:46Araqcoroutine support for Nim
10:49:05Araqbut it's broken on OSX as well and nobody is working on it, unfortunately
10:49:49FromGitter<TiberiumN> coroutine like in go and another languages?
10:50:58couven92okay... not my area of expertise, so I'll pass on that, too... sorry... What about VM not being great on x86? I'm cross-compiling Nim right now on Windows to produce x86 Nim and going to run testament for that to see if the same error occur outside of android as well
10:53:06FromGitter<TiberiumN> are these coroutines multithreaded? so they can run on different threads?
11:03:15FromGitter<TiberiumN> lol
11:03:16FromGitter<TiberiumN> When comparing D vs Nim, the Slant community recommends Nim for most people. In the question“What is the best programming language to learn first?” Nim is ranked 20th while D is ranked 21st. The most important reason people chose Nim is:
11:03:25FromGitter<TiberiumN> https://www.slant.co/versus/118/395/~d_vs_nim
11:03:30FromGitter<TiberiumN> but we can add a lot to "pros" :)
11:06:24FromGitter<TiberiumN> omg, almost everything from D cons can be added to nim
11:16:15*dddddd joined #nim
11:51:45*enthus1ast- quit (Remote host closed the connection)
11:52:32*maxcroud joined #nim
11:53:15*krux02 joined #nim
11:54:42krux02Araq: How do you think to fix the echo with binary zeros in the string?
12:02:23*Nimbecile joined #nim
12:03:40maxcroudHello. I've tried to wrap C printf function. Then I've faced with absence of C variadic arguments in Nim. Is there a better way to implement such a procedure? My option uses emit pragmas to operate with varargs list. https://pastebin.com/7C4TtJeL
12:03:58*Nimbecile left #nim (#nim)
12:04:16FromGitter<TiberiumN> there are variadic arguments
12:04:16couven92maxcroud, use echo?
12:04:36FromGitter<TiberiumN> also yes, why not echo?
12:04:52couven92why would you explicitly want to printf?
12:05:08maxcroudBecause echo doesn't support complex formatting. Look at the code example
12:05:16FromGitter<TiberiumN> use strutils
12:05:24FromGitter<TiberiumN> and logging library
12:06:07FromGitter<TiberiumN> but I don't know about stuff like %08x
12:06:14maxcroudOkay. I didn't find in strutils or logging supporting such stuff %08x
12:06:41FromGitter<TiberiumN> there is however third-party library if you're ok with that
12:06:57FromGitter<TiberiumN> nimble install strfmt
12:06:59FromGitter<TiberiumN> https://bitbucket.org/lyro/strfmt/src/f8afe166924f479e99ad08ecebda51585c8bb744/strfmt.nim?at=default&fileviewer=file-view-default
12:07:18FromGitter<TiberiumN> The syntax of the format specification string is similar to ⏎ ⏎ ---`Python's Format Specification Mini-Language--- ⏎ ⏎ ---<https://docs.python.org/3.4/library/string.html#formatspec>`_.--- [https://gitter.im/nim-lang/Nim?at=598857f5614889d47526b089]
12:12:50AraqformatFloat is better than weird chars in the format string and the precision is not related to i18n anyway, so it's a mistake to conflate these two things
12:13:24Araqkrux02: there is a github issue for that, describing the implementation
12:16:52couven92Araq, should I make issues for the 32-bit VM failures? I get them also when I run testament on x86 Windows
12:17:04couven92just so that we remember doing that?
12:17:10Araqyes me too, I tried to tell you yesterday
12:17:25AraqI'm aware of them but an official bug report cannot hurt
12:17:41Araqin fact, these are regressions
12:18:14couven92yeah, I just wanted to make sure we get exactly the same error outside of Android... To make sure we're not hitting some weird Android-only issues as well
12:18:36couven92one test too many can never hurt, right ;)
12:19:13krux02Araq: what should `$` on an array of '\0' characters become?
12:20:17krux02I think "[,,,,,]" is fine and very distinguishable from "[ , , , , , ]" (array of spaces)
12:21:27*dozn quit (Ping timeout: 240 seconds)
12:23:31Araqwell the \0 in general should be some Unicode blank/filler
12:24:03Araqit's not different from \1 or any ascii control char really
12:25:08Araqand I don't want $ to handle it, that's the terminal emulator's business
12:25:36Araqand if it fails, I can still redirect the output to an editor that can show it properly
12:25:53krux02ok I think I understand
12:26:11krux02at the moment echo redirectos to printf (afaik)
12:26:38krux02I see if printf has something that does not stop printing at \0
12:27:35*mahmudov quit (Ping timeout: 240 seconds)
12:28:55Araqfputs() could also be used
12:30:09*Nimbecile joined #nim
12:36:19NimbecileI'm struggling a bit with user defined operators...what is their scope? I see examples where inside procedures the "." is treated as a object dereference operator...the custom definition does not seem to apply. Outside the proc, the custom definition applies.
12:41:15Nimbecileif the "signature" for the custom operator is the same as the built-in, how does compiler decide which to use?
12:44:37krux02Araq: fwrite is the function to be used
12:46:48Araqkrux02: please check it has the right buffering behaviour too
12:47:13Araqand Windows probably has its own buffer behaviour, ignoring what Ansi C says :P
12:48:32FromGitter<timmyjose> @Nimbecile That is a cool name! :D
12:50:34AraqNimbecile: hmm? what's the question? the rule is: the types are used to figure out the "best" match
12:51:06Araqif there are 2 best matches but one is the module's own, then this is picked
12:51:33Nimbecile@FromGitter one of my few creative moments :) it also accurately indicates my level of proficiency
12:51:34FromGitterNimbecile, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/nim-lang/Nim
12:52:58FromGitter<timmyjose> Hahaha
12:54:27*Snircle joined #nim
12:55:24maxcroudIs it possible to cast NimNode to varargs[untyped] in macro?
12:56:06maxcroud```macro debug(format: string{lit}, args: varargs[untyped]): untyped = result = strVal(format).fmt(args)```
12:58:19Nimbecilearaq my question relates to the winim module...it creates a custom "." definition that takes a com object, a method, and optional args and calls invoke. If I want to dereference the com object to get it's "disp" member, the compiler applies custom operator and thinks I want to invoke "disp" method which does not exist. Can I tell the compiler which operator I want to use?
13:04:46Araqmaxcroud: they are NimNode in the macro body
13:05:19AraqNimbecile: ugh, tough nut, winim shouldn't have used overloaded '.' (I don't like these at all)
13:05:59Araqin fact, this whole project is a pain, it's not its job to make Nim look like VB
13:06:10maxcroudAraq: yes, they are. But how I can wrap `fmt` macro?
13:07:00Araqthat's not how macros work, better use a template until you're enlightened :P
13:07:21Araqyou don't call 'fmt', you create an AST that calls 'fmt'
13:12:02Araqbut it's easier to do in a template
13:13:07NimbecileAraq when they pass a com object as a parameter to a procedure, within that procedure it appears to treat the "." as a dereference operator. Does the procedure scope exclude custom definitions? I can tell you don't like talking about winim, but just trying to understand programming concepts exposed there.
13:13:48AraqI think it's this:
13:14:01maxcroudYes. Thank you Araq! I did it. I I did not even think about the templates, because I got confused about what is being expanded earlier
13:14:32Araqproc foo*(o: Obj): T = o.foo # foo is a private field in 'Obj'
13:15:07Araqthe rule is "builtin dot access preferred" but when you're outside the module, the private field is invisible and so the foo getter is called instead
13:17:14NimbecileAraq Thanks!
13:31:59*krux02 quit (Remote host closed the connection)
13:39:24*rauss joined #nim
13:53:14*salewski joined #nim
13:55:47salewskiWhen I have a macro similar to https://github.com/StefanSalewski/gintro/blob/master/tests/gen.nim#L947
13:56:01salewskiwith first parameter: widget: gobject.Object;
13:57:04salewskiIt is possible to write something like "if widget is Button:" at the beginning of the macro?
13:57:42salewskiOf course that makes not much sense, as widget is a NimNode in the macro, I know.
13:58:11salewskiBut later in the quote do: section I can cast to the real widget type.
13:58:25salewskiBut I want to get the exact type earlier.
13:58:38*Nimbecile quit (Ping timeout: 240 seconds)
14:01:32Araqlet x = widget.getType()
14:01:57Araqif sameTypes(x, bindSym"Button"): ...
14:02:22salewskiThanks.
14:06:50salewskiAraq, works great. But name is sameType() without terminating s.
14:07:49Araqright
14:08:32salewskiI have seen your forum comment to my latest thread. But I think I will just use a array of strings and do a search.
14:08:35salewskiBye.
14:09:04*salewski quit (Quit: WeeChat 1.4)
14:12:27Araqyou should really get a bouncer
14:16:02couven92Araq, I opened https://github.com/nim-lang/Nim/issues/6197 for the vm issue... I have written my findings from running testament on Android ARMv7 and x86 Windows. There might be more, but we can add that as this gets adressed?
14:18:09Araqsure
14:28:42FromGitter<cooldome> Hi Araq, I have posted a question on TIdTables in compiler on the forum. If you could please have a look
14:28:59FromGitter<TiberiumN> is there any good IRC clients for mac?
14:29:44*couven92 quit (Quit: Client disconnecting)
14:30:21flyxTiberiumN: Textual
14:30:27FromGitter<TiberiumN> ok, thanks
14:30:42flyxopen source if you can build it; can also be bought for money
14:30:58FromGitter<TiberiumN> yeah I saw that, pretty common thing
14:31:03FromGitter<TiberiumN> even on android
14:31:07FromGitter<TiberiumN> or mac :)
14:33:49Araqcooldome: idTableGet() (sucks, I know, the compiler predates generics)
14:35:59yglukhovdom96: pls check out https://github.com/nim-lang/nimble/pull/385
14:38:44*mahmudov joined #nim
14:40:33*adeohluwa joined #nim
14:42:40FromGitter<cooldome> @Araq: it is clear that it is old code and not type safe, just please explain how to contruct a key for now
14:43:02Araqlet concrete = PType(idTableGet(key))
14:43:13Araqyou can find an example in sigmatch.nim
14:44:56FromGitter<cooldome> this piece is clear, I don't undestand how to get key in your example
14:46:26Araqwell you need to "have" it just like for every other lookup data structure
14:46:28FromGitter<cooldome> the key for the return type
14:47:56*nattefrost quit (Remote host closed the connection)
14:48:21FromGitter<cooldome> It is clear that the key is somewhere in TCandidate, but I don't know the code well enough get to the actual answer
14:59:56*PMunch joined #nim
15:08:30*Tiberium joined #nim
15:09:48*Tiberium quit (Client Quit)
15:10:00*Tiberium joined #nim
15:14:35*endragor quit (Remote host closed the connection)
15:14:53*Trustable joined #nim
15:18:43Araqthe return type of a proc is t.sons[0]
15:19:00*Tiberium left #nim ("Textual IRC Client: www.textualapp.com")
15:19:13*Tiberium joined #nim
15:20:13Tiberiumflyx, thanks for suggestion, compiled and installed it :)
15:20:26*endragor joined #nim
15:23:45*dave24 quit (Ping timeout: 248 seconds)
15:24:35*dave24 joined #nim
15:24:49*endragor quit (Ping timeout: 248 seconds)
15:29:23*v17d joined #nim
15:32:02dom96yglukhov: Reviewed. Iterators plz.
15:32:23yglukhovdom96: thats what i wanted to do, but they can't be recursive :(
15:33:25dom96D:
15:37:15*krux02 joined #nim
15:37:22krux02Araq: http://ix.io/yWR
15:37:29krux02what do you think?
15:38:09krux02with that code a string "abc\0def" is printed with 7 characters
15:38:56Araqthat's not threadsafe
15:40:59*ofelas joined #nim
15:41:11krux02what do you mean?
15:42:03*smt joined #nim
15:42:30krux02was printing from different threads ever threadsafe?
15:44:55Araqthe point is that:
15:45:06Araqthread A: echo "a", "b"
15:45:13Araqthread B: echo "c", "d"
15:45:21Araqnever can produce as output:
15:45:27Araqacbd
15:45:56Araqonly abcd or cdab are allowed
15:46:45Araqyou need to do some explicit file locking for your solution to work
15:47:00Araqposix flock call or whatever
15:47:53Araqnote that echo "a", "b" is different from echo "a"; echo "b" even if ignore the different newlines
15:48:33*ofelas quit (Quit: shutdown -h now)
15:49:57krux02http://ix.io/yWT
15:50:39Araqthat doesn't work if the argument passed to 'echo' raises an exception :P
15:50:40*ofelas joined #nim
15:50:48Araqbetter use an AST rewrite internally
15:50:59*yglukhov quit (Remote host closed the connection)
15:51:23krux02wat?
15:52:56krux02how about putting the implementation in sysstr.nim?
15:52:56subsetparkdom96: a while ago we had been talking about how to run multithreaded code within a jester handler... seems like the solution we had come up with doesn't actually work as intended
15:53:57Araqkrux02: sysio sounds better for that
15:53:58subsetparki have a while(true) checking for flowVar.isReady, and if not `yield sleepAsync 1` - but it never actually kicks control back to the event handler loop that way
15:57:26subsetparkAny other thoughts?
15:58:44subsetparkor Araq too - generally, how to dispatch a thread in an async proc, check for result of the flowVar, and efficiently yield to the event handler if not ready?
15:59:56Araqsubsetpark: wait for the next upcoming version of 'spawn' or create your own thread pool (not that much work), sorry.
16:00:22subsetparkah :) its not in devel is it?
16:00:23Araqspawn currently is not good at concurrency, it is allowed to block
16:01:25Araq"would my code work as 'foo()' instead of 'spawn foo()'?"
16:01:41Araqif yes, you have parallelism in your code. if no, you have concurrency.
16:01:51Araqand spawn wasn't written for concurrency.
16:02:10subsetparktrust me, i know the difference... in this case i am simply trying to combine the two
16:03:20Araqit's not in devel but yglokhov has it and is usually around. (but not right now)
16:04:06*yglukhov joined #nim
16:04:47*yglukhov quit (Remote host closed the connection)
16:06:40*Ven joined #nim
16:07:03*Ven is now known as Guest63750
16:07:19dom96You can ensure that a `^` won't block on a FlowVar by using `isReady`
16:07:24dom96so spawn can be using with async
16:07:52dom96subsetpark: Maybe you should yield a longer sleepAsync time interval?
16:07:55Araqdom96: that doesn't work according to him though
16:09:28*Nimbecile joined #nim
16:10:06*Nimbecile left #nim (#nim)
16:10:38*arnetheduck quit (Ping timeout: 240 seconds)
16:11:17Tiberiumparallel testament is pretty fast: tests/testament/tester_parallel 268,56s user 25,25s system 213% cpu 2:17,90 total.
16:11:33Tiberiumbut low cpu is probably because SQLite
16:11:37subsetparkIt doesn't seem to have anything to do with the interval - even sleeping on 100 still only ever runs one thread at a time
16:12:01*Guest63750 quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:14:36*Ven_ joined #nim
16:16:03dom96It definitely works because I am using this in my book's chat application.
16:16:12dom96Can you take a look at that?
16:16:15subsetparkthe spawn() itself is not blocking though - i am able to get into the while true: block.
16:16:21subsetparkyes, dom96, that's what i use for my model
16:16:38subsetparkis it possible that something in the fact that it's a jester handler is gumming up the works
16:16:39subsetpark?
16:16:56subsetparkWhereas in your example you're calling poll() directly
16:17:18krux02Araq: Is there any reason not to implement "echo" with "write" in system.nim?
16:17:48krux02and what does benign mean?
16:18:49dom96subsetpark: possibly. Can you come up with a small example that fails?
16:20:19*yglukhov joined #nim
16:22:30subsetparksure...
16:25:04*maxcroud quit (Ping timeout: 260 seconds)
16:25:12krux02Araq: well I give up for today, if you want echo to behave the same way as ststem.write, maybe you should implement it.
16:25:47Araqkrux02: the issue description had an implementation ready to go
16:25:54Araqiirc
16:28:08*Tiberium quit (Quit: Textual IRC Client: www.textualapp.com)
16:31:41subsetparkdom96: https://www.irccloud.com/pastebin/pCXcYeEE/
16:32:51krux02well my implementation for echo: http://ix.io/yWY
16:33:14krux02no magic no fuzz
16:33:48FromGitter<TiberiumN> xd ;)
16:34:39*dankrad joined #nim
16:34:40krux02it works, I tested it
16:35:11krux02the debug echo could be a problem though
16:37:06Araqthat is not threadsafe
16:37:41subsetparkdom96: here's how I'm testing:
16:37:49*Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:37:58subsetparkhttps://www.irccloud.com/pastebin/FmCFx7WE/
16:38:56subsetpark(the second line is echoed by httperf; you can ignore it)
16:39:12subsetparkbut it produces output like this:
16:39:16subsetparkhttps://www.irccloud.com/pastebin/2QyBEWft/
16:40:09subsetparkWhere a new request handler is never started before the previous one fully completes
16:44:53*ofelas quit (Quit: shutdown -h now)
16:49:23*adeohluwa quit (Quit: Connection closed for inactivity)
16:55:13*yglukhov quit (Remote host closed the connection)
16:57:04krux02Araq: how is that not thread safe?
16:57:30*yglukhov_ joined #nim
17:00:11*PMunch quit (Quit: leaving)
17:01:35*yglukhov_ quit (Ping timeout: 240 seconds)
17:09:15*krux02 quit (Remote host closed the connection)
17:12:07*Jesin quit (Quit: Leaving)
17:12:59subsetparkdom96: any thoughts?
17:13:52*Ven joined #nim
17:14:15*Ven is now known as Guest88849
17:15:07*ofelas joined #nim
17:17:37*Jesin joined #nim
17:33:03*couven92 joined #nim
17:33:21*yglukhov_ joined #nim
17:35:06*sakalli joined #nim
17:37:44*yglukhov_ quit (Ping timeout: 260 seconds)
17:38:11*Guest88849 is now known as Ven``
17:38:13*nhywyll joined #nim
17:42:50*Ven`` quit (Ping timeout: 240 seconds)
17:43:52*ipjk joined #nim
17:44:01*sakalli quit (Remote host closed the connection)
17:44:08*tdc quit (Ping timeout: 240 seconds)
17:44:45*Ven_ joined #nim
17:48:56*sakalli joined #nim
17:49:21*Ven_ quit (Ping timeout: 248 seconds)
17:58:51couven92Araq, geat! :)
17:59:26couven92I'll have testament ready in a minute now :)
18:00:19*endragor joined #nim
18:04:48*endragor quit (Ping timeout: 260 seconds)
18:12:59subsetparkwhat's testament, a new unit testing framework?
18:15:08*Ven joined #nim
18:15:31*Ven is now known as Guest20233
18:15:31*nsf quit (Quit: WeeChat 1.9)
18:20:57euantortestament tests the Nim compiler
18:21:05euantorand stdlib
18:21:13couven92euantor, yup
18:21:56FromGitter<TiberiumN> couven92: multiReplace can be very useful, thanks for it!
18:22:22couven92yup! :) My Testament upgrade will make use of it as well
18:22:30*yglukhov joined #nim
18:23:15FromGitter<TiberiumN> also I'm waiting for parallel testament upgrade
18:23:49FromGitter<TiberiumN> because I can run low-priority VM on Azure (with 16 cores and 56gb of ram) and run it here :) ⏎ but sadly low-priority VMs can be deleted in any time (but they're A LOT cheaper than usual VMs)
18:26:45subsetparkah ha, got it
18:41:56*Matthias247 joined #nim
18:42:26couven92okay, pretty testament HTML ready for review: https://github.com/nim-lang/Nim/pull/6058
18:56:36*Guest20233 quit (Ping timeout: 260 seconds)
19:01:33*ipjk quit (Quit: Leaving)
19:06:21*tankfeeder quit (Quit: Connection closed for inactivity)
19:16:29*tankfeeder joined #nim
19:19:25*Trustable quit (Remote host closed the connection)
19:23:16*couven92 quit (Ping timeout: 276 seconds)
19:24:22*mahmudov quit (Ping timeout: 260 seconds)
19:26:47*couven92 joined #nim
19:41:28*Nobabs27 joined #nim
19:46:25*nsf joined #nim
19:50:03*mahmudov joined #nim
19:50:05FromGitter<TiberiumN> https://www.reddit.com/r/nim/comments/6hiijm/implementing_sprintf_in_pure_nim/ ⏎ Oh, I didn't knew before how to use --gc:stack. ⏎ Maybe I should look at https://github.com/samanthadoran/Mero again
19:50:23FromGitter<TiberiumN> (btw, it compiles with latest nim without any issues IIRC)
19:51:18FromGitter<TiberiumN> and it also has it's own alloc
19:53:47*yglukhov quit (Remote host closed the connection)
19:55:41FromGitter<TiberiumN> hmm, a question - if I import some stdlib module from multiple modules would generated C code contain only 1 copy of stdlib module or many of them?
19:56:51*couven92 quit (Quit: Client Disconnecting)
19:58:15*Sentreen quit (Ping timeout: 268 seconds)
20:01:54*Nobabs27 quit (Quit: Leaving)
20:02:42*Vladar quit (Quit: Leaving)
20:12:03*Sentreen joined #nim
20:12:43*yglukhov joined #nim
20:16:20AraqTiberiumN: ONly once of course except for os.nim which currently has a bug (uses a wrong include)
20:17:28Araqcouven92: I can merge it now but this sqlite stuff needs to be rethought, see the parallel tester PR
20:23:08FromGitter<TiberiumN> yeah this tester raises A LOT of exceptions (unhandled)
20:23:14FromGitter<TiberiumN> about database being locked :)
20:25:42FromGitter<TiberiumN> but it would be very cool anyway
20:26:06FromGitter<TiberiumN> because almost every user nowadays has 4 or even 8-core CPU (for nim development and testing it will be much faster)
20:26:23FromGitter<TiberiumN> heck, even my phone has 8 cores and instead of 1 hrs and 30 minutes it can go under 30 minutes
20:34:38*Sentreen quit (Ping timeout: 268 seconds)
20:36:49*haha_ quit (Quit: haha_)
20:39:17FromGitter<faustinoaq> Hello people, I'm new in Nim, thanks for create this awesome language 
20:45:35*sakalli quit (Ping timeout: 240 seconds)
20:48:14*Sentreen joined #nim
20:50:42FromGitter<TiberiumN> hi :)
20:52:33FromGitter<TiberiumN> about question you asked to dom96: he's chatting via IRC, so you don't see him online at gitter (there's irc to gitter bridge here)
20:52:50FromGitter<TiberiumN> but sometimes he's using gitter too
20:53:33*Jesin quit (Quit: Leaving)
20:58:11*Jesin joined #nim
21:05:54*rauss quit (Quit: WeeChat 1.9)
21:08:19*ofelas quit (Quit: shutdown -h now)
21:09:21*dankrad quit (Ping timeout: 248 seconds)
21:11:22*dankrad joined #nim
21:24:44*PMunch joined #nim
21:26:21*tankfeeder quit (Quit: Connection closed for inactivity)
21:26:37*Matthias247 quit (Read error: Connection reset by peer)
21:27:49*Ven joined #nim
21:28:13*Ven is now known as Guest44413
21:28:20*Guest44413 is now known as Ven``
21:38:05*nhywyll quit (Quit: nhywyll)
21:50:20*yglukhov quit (Remote host closed the connection)
21:52:00*Nimbecile joined #nim
22:04:12*v17d quit (Ping timeout: 260 seconds)
22:08:03TheManiacHi all: does anyone understand enough about concepts to tell me what 'too nested for type matching means' as an error message?
22:08:42*TheManiac sent a long message: TheManiac_2017-08-07_22:08:41.txt <https://matrix.org/_matrix/media/v1/download/matrix.org/YhjFbliaZPYupTmcIJhLVkKV>
22:09:14TheManiac^-- I want a concept that describes a string, but also a seq[X] for some type X
22:10:01TheManiacI feel like I copied the Stack[T] example from the manual, but I must have missed something :(
22:13:05TheManiacThat much compiles, but if I call `proc foo[T](t: Text[T])` as foo("hello") it gives me a world of error messages
22:15:30NimbecileSeems simple but I haven't been able to find in documentation...how do you do a double dereference in Nim like **ptr in C++...I tried ptr[][] but it doesn't work.
22:17:40subsetparklike this? https://www.irccloud.com/pastebin/m4aVyNyw/
22:18:26NimbecileThank you!
22:28:27*mahmudov quit (Ping timeout: 240 seconds)
22:30:22Nimbecilesee if understand...line 5 and 6 are equivalent, right? when you say new(b) does compiler create Bar pointer Foo pointer and integer, then b[]=f makes copy of f?
22:31:44subsetparkah, you know what - line 5 is actually wrong, i meant to remove it
22:32:09subsetparkline 5 produces a type error, because you are trying to assign an `int` to a `ref int`
22:33:57subsetparknew(b) allocates space on the heap - before you do that, it's semantically meaningless to assign to b[]
22:34:34subsetparkhttps://www.irccloud.com/pastebin/FrI372QT/
22:36:01dom96subsetpark: hrm, interesting. Please submit it as an issue in Jester's repo
22:36:06dom96I will take a look at it tomorrow
22:36:17dom96Busy today with other things, sorry
22:36:18subsetparkdom96: awesome, will do
22:37:15subsetparkNimbecile: you can also do an allocation in one step - `var f = new(Foo)`
22:37:46subsetpark(or for that matter var f = Foo.new)
22:43:52*Ven`` quit (Ping timeout: 260 seconds)
22:46:32subsetparkdom96: no doubt painfully exhaustive: https://github.com/dom96/jester/issues/117
22:47:13dom96thanks
22:50:48*yglukhov joined #nim
22:54:22*rauss joined #nim
22:54:50*yglukhov quit (Ping timeout: 240 seconds)
22:55:11*PMunch quit (Quit: leaving)
23:05:47Nimbecile@subsetpark sorry, got sidetracked...thank you very much! Your examples were very helpful.
23:11:16subsetparkmy pleasure. i'm the 'advanced beginner'... once you start writing your own macros and opengl libraries, you'll be out of my league
23:17:14NimbecileI'd like to get there, but old dog new tricks ;-)
23:18:29*nsf quit (Quit: WeeChat 1.9)
23:42:12*jinshil joined #nim
23:53:16*mahmudov joined #nim
23:53:43FromGitter<zetashift> Having trouble figuring out how to handle 'nil' in nim while following this book: http://craftinginterpreters.com/scanning.html#the-scanner-class, I currently have: https://pastebin.com/ADnwSW7d
23:54:13FromGitter<zetashift> Defining the literal field as 'nil' gives me an error but saying literal: null doesn't :S
23:55:40*oddduck joined #nim
23:57:37*rosshadden joined #nim
23:58:24FromGitter<TiberiumN> just don't declare it?
23:58:49FromGitter<TiberiumN> well it would be with default values
23:59:57FromGitter<TiberiumN> also