<< 16-09-2016 >>

00:01:16rudi_sI wouldn't call it horseshit, but it's true that it has many issues as well.
00:03:15FromGitter<Araq> and it's very ironic that Linus rants about how you cannot "fix CVS" (referring to SVN) when he did the very same. you cannot fix Unix, you start from scratch to design an OS that makes sense. or you fail and produce something worse, but at least it would have been something interesting.
00:06:02Trixar_zaYou're on Gitter too?
00:06:38FromGitter<Araq> my IRC client thinks it's OK to reconnect every 5 secs
00:06:44FromGitter<Araq> so yes.
00:09:35*elrood quit (Remote host closed the connection)
00:09:38Trixar_zaMy friend that works on WSE dragged me on it - it's not bad for what it is. I didn't expect a transport bot though
00:18:15*PMunch joined #nim
00:22:59*Demon_Fox quit (Quit: Leaving)
00:24:39*chemist69 joined #nim
00:33:14*PMunch quit (Quit: leaving)
00:33:31*PMunch joined #nim
00:41:41*Demon_Fox joined #nim
00:42:31*PMunch quit (Quit: leaving)
00:44:28*PMunch joined #nim
00:53:23*libman quit (Remote host closed the connection)
01:19:06*nsf quit (Quit: WeeChat 1.5)
01:19:46*PMunch quit (Quit: leaving)
01:19:52*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
01:20:12*PMunch joined #nim
01:39:15*Jesin quit (Ping timeout: 260 seconds)
01:42:54*Jesin joined #nim
01:58:21*girvo joined #nim
01:58:58*girvo waves
02:00:06*chemist69 quit (Ping timeout: 265 seconds)
02:02:05*PMunch quit (Quit: leaving)
02:02:57*ftsf joined #nim
02:13:16*chemist69 joined #nim
02:31:37*jivank_ quit (Ping timeout: 248 seconds)
02:36:37*niv quit (Remote host closed the connection)
03:12:56*desophos quit (Read error: Connection reset by peer)
03:15:53*brson quit (Ping timeout: 248 seconds)
03:19:15*ThisIsZenified quit (Ping timeout: 272 seconds)
03:19:39*ThisIsZenified joined #nim
03:58:31*Sentreen quit (Ping timeout: 265 seconds)
04:10:07*Sentreen joined #nim
04:53:59*pie__ quit (Changing host)
04:53:59*pie__ joined #nim
05:01:25*pleiosaur quit (Remote host closed the connection)
05:27:09*lxdong joined #nim
05:33:25*rtr_ joined #nim
05:47:21*xet7 quit (Quit: Leaving)
05:48:09girvoHey all, question:
05:48:12girvoresult, or return?
05:48:53FromGitter<endragor> girvo: the answer is here: http://nim-lang.org/docs/nep1.html
05:49:38girvoOMG I've been hoping for something like this!
05:49:39girvoThanks!
06:23:51*xet7 joined #nim
06:30:10*GustavoLapasta joined #nim
06:31:33*rtr_ quit (Remote host closed the connection)
06:39:15*brechtm_ quit (Read error: Connection reset by peer)
06:39:21*brechtm joined #nim
06:44:56girvoReally dumb q: quickly dumping a text representation of a ref object?
06:45:43FromGitter<Araq> $x[] # deref the 'ref' and call $
06:45:54FromGitter<Araq> repr x # sooo popular I cannot kill it
06:48:50*girvo thinks he should move to Gitter
06:49:11girvoCheers Araq; I need to define `$` on this type first. Brain fart!
06:49:19*Trustable joined #nim
06:51:48FromGitter<Araq> well $ is predefined for 'object', but not for 'ref object'
06:52:12girvoOh right! That makes sense
06:57:11*yglukhov joined #nim
07:02:49*yglukhov quit (Ping timeout: 272 seconds)
07:10:35girvoLastly, safely accessing a string value from a JsonNode, where the key might not exist? I can't see anything in the json module's docs, but I'm prolly just missing it
07:10:47girvo(Ideally without needing an intermediate variable)
07:13:33*csoriano_ joined #nim
07:13:39*csoriano_ is now known as csoriano
07:14:29*space-wizard quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:14:39FromGitter<endragor> @girvo getOrDefault?
07:21:25girvoendragor: Thats what I was trying to use, but I can't understand how to use it properly
07:22:03girvoSay I have a "conf" JsonNode, with an "example" key (and "test" value for that key), I dont' really get how to use getOrDefault
07:22:25girvoconf["example"].getOrDefault()? Doesn't that still throw a KeyError?
07:22:33girvoraise* not throw
07:27:26flyxgirvo: no, it will never throw a KeyError
07:28:46girvoflyx: well I am an idiot then :)
07:29:00FromGitter<endragor> conf.getOrDefault(“example”) - I guess this is what you mean
07:29:16flyxah yes
07:29:20flyxI misread it
07:31:02girvoYeah it sort of is, except I want the "default" in this case to be an empty string instead of "nil", my reading of the docs is that it will be "nil"?
07:32:05*rtr_ joined #nim
07:32:11girvoAh wait!
07:32:26girvoI combine it with getStr and I should be fine
07:32:39girvoconf.getOrDefault("example").getStr("default val if needed")
07:33:03girvoOr.. wait, shit, won't that possibly call "getStr" on nil?
07:33:22girvoNope, it will work; "Returns default if n is not a JString, or if n is nil."
07:33:26girvoCool :)
07:33:27FromGitter<endragor> getStr on nil is fine
07:33:30FromGitter<endragor> right
07:34:12FromGitter<Araq> @endragor json.nim needs to support blobs, it should use \x, old serializations use \u, problem solved, backwards compatibility restored
07:34:22ldleworkAnyone in SF and want me to buy them a ticket to the roguelike developer conference this saturday?
07:34:34ldleworkthey are sold out but I got a hold of the coordinator
07:34:53FromGitter<endragor> @Araq there is no `\x` in JSON
07:35:09FromGitter<Araq> yes, it would be a nim specific json extension
07:36:21girvoAw getStr won't work with "string not nil" heh
07:36:30FromGitter<endragor> the grammar strictly defines what can follow `\`. `x` is not in the list
07:37:07FromGitter<endragor> other parsers may not work with that. are you fine with that?
07:38:29FromGitter<Araq> yes. do you have an alternative?
07:40:47*rtr_ quit (Ping timeout: 244 seconds)
07:46:33FromGitter<endragor> well, the array of charcodes was backward-compatible. I guess your approach is the only viable if we want to keep backward compatibility AND produce human readable strings in marshal.
07:48:23FromGitter<endragor> as another option, array of charcodes could be used only when the string contains at least a single invalid UTF-8 sequence
07:48:47*Andris_zbx joined #nim
07:49:14FromGitter<endragor> that would produce array only for binary, non-UTF-8 data
07:51:21flyxI suggested some days ago to introduce a `blob` type as distinct string so that blobs can be handled differently. I believe I did not get any feedback on that
07:59:26FromGitter<endragor> @Araq needs to comment on that. It makes sense, but it still leaves possibility of binary strings that people (and stdlib) will have to deal with. That would make more sense if the language guaranteed that `string` is always a valid UTF-8 sequence (unless unsafe operations are used). Is `blob` the right term here? It’s usually realted to databases.
08:02:03flyxI think blob is totally fine and is not related to databases (they use it there, but it does not originate from there)
08:03:22flyxconcerning string safeness, I think we get enough safety by returning and using blob as type everywhere where the data is not necessarily a valid UTF-8 string.
08:04:12flyxthe only way the user can then create an invalid string is to add a char which is greater than 0x7F
08:06:30flyxI believe a lot of other functionality will break too if an input string is not valid UTF-8, so we can either define that it is not necessarily UTF-8, or we define it is and the user is at fault if he inserts invalid sequences
08:08:17*Raaaa joined #nim
08:10:06*yglukhov joined #nim
08:14:24*elrood joined #nim
08:22:00*nsf joined #nim
08:22:16Araqflyx: we have TaintedString, maybe that's already a Blob?
08:22:42Araqit's an Input string, so it's not guaranteed to be UTF-8
08:22:57*bjz joined #nim
08:23:41flyxAraq: well, conceptually it may be, but it surely would be confusing for readers if some proc that expects binary data defines its input type as TaintedString
08:24:21*girvo quit (Ping timeout: 265 seconds)
08:25:02flyxalso, TaintedString depends on a compile-time switch. I believe blobs should always be distinct.
08:34:05Raaaa+1
08:37:40*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
08:48:05*spindle joined #nim
08:54:19Araqif blob == "abc"; blob.add("foo"); blob[1..4]; blob =~ re"foo"; is there some string operation that 'blob' doesn't support? I think it's a bad idea
08:54:56*bjz joined #nim
08:55:29Araqand if you add a converter from blob to string nothing is gained.
08:55:29flyxthose in unicode obviously. also, I do not think that blob should support regex
08:56:06Araqtype ReallyUtf8 = distinct string makes more sense then
08:56:13flyxI only wanted a converter from string to blob because that's safe
08:56:21Araqwith a converter to string
08:56:57Araqand Unicode working on ReallyUft8, wait no, because unicode is also about validating the unicode.
08:58:27flyxwell, if there is a string type, no-one would think of using ReallyUtf8
08:59:23flyxI think we should make the string type our ReallyUtf8 type (as the documentation already suggests). the blob type should be incorporated somehow, and I guess superclassing string will break everything
08:59:59AraqI think json needs to support blobs and marshal.nim needs to use that and the rest is fine
09:00:19flyxI will have the same problem in NimYAML
09:00:46*Trustable quit (Ping timeout: 255 seconds)
09:01:04AraqNimYAML needs to support lossless input/output, just like anything else
09:01:37flyxand if I remember correctly, there was also some discussion about using strings in async modules (I do not remember the details)
09:02:48Araqmaybe we need to change the docs that string==blob
09:03:57Araqthe only place where the stdlib converts strings to utf-16 is for the windows api with filenames and paths where it is fine to do so
09:04:30flyxthat, along with declaring an actual UTF8 string type, would conceptually fix the problem, but I worry about the naming. people *expect* a textual sequence when they read "string" as type name
09:05:19FromGitter<dom96> @ldlework aww man, I wish I was in SF for that.
09:05:24euantorI must agree it feels a bit odd having the socket stuff return strings when working with binary protocols
09:05:35euantorIt works, just feels different
09:05:47*fredrik92 joined #nim
09:05:54FromGitter<dom96> @Araq @endragor is readability of the marshall output really that necessary?
09:06:08flyxI would probably go for `type blob` as base and `type string = distinct blob` if there was no backwards compatibility to be considered.
09:06:34Araqdefine "binary". it's all bits and bytes in computers.
09:06:58flyxdom96: I think the discussion about the marshaling is just a symptom of the actual problem, which is having the `string` type used for semantically different things
09:07:09FromGitter<dom96> @euantor why does it feel different? Different from what? I'm fairly sure that most languages use strings by default.
09:07:09flyxdom96: if we just fix marshal, the problem itself remains
09:07:33euantorRemember I come from C#. There we pass in a byte array of fixed size
09:07:50euantorSame with Java if I remember correctly
09:08:05FromGitter<dom96> @flyx hrm, I'm not entirely clear on what problem we are trying to fix in marshal.
09:08:45euantorEg: https://msdn.microsoft.com/en-us/library/8s4y8aff(v=vs.110).aspx
09:09:01AraqC# and Python were a constant pita with their unicode exceptions
09:09:06Araqfor me.
09:09:11euantorI know `string` is basically the same thing, the naming is just different for me
09:09:13flyxdom96: I think the problem is „there can be non-UTF8 content in a string and this is considered an actual use-case because at some places, string is used for non-UTF8 data“
09:10:41euantorAnd yes, Araq, the string handling can be annoying. Constantly having to use things like `System.Encoding.UTF8.GetBytes()` or `System.Encoding.UTF8.GetString()` does lead to a lot of code smell
09:11:15*Trustable joined #nim
09:12:00flyxI agree that we do not need an enterprisey solution and UTF-8 as implicit default is fine.
09:12:54FromGitter<dom96> @flyx okay, but why is that a problem?
09:13:30FromGitter<endragor> @dom96 re readability: my first PR was to encode each string as array of charcodes, while loading strings the old way for backward compatibility. Araq rejected that. Now I suggest that we put array only for non-UTF-8 strings - readability is kept, performance-wise it adds one additional string traversal to validate UTF-8. ⏎ ⏎ re other languages and strings - I must agree other languages use string only as "sequence of
09:13:30FromGitter... **characters**”. sockets and files usually work with byte arrays.
09:14:03*nairobi joined #nim
09:14:58*nairobi quit (Remote host closed the connection)
09:15:01flyxdom96: because the semantic differences are carried as information along with the type. if any marshaling implementation, be it marshal or NimYAML or something else, encounters a string, it cannot know whether this is binary data from somewhere or an actual UTF8 string
09:15:02FromGitter<endragor> working with binary data doesn’t belong to JSON, as I think - JSON module should expect that user encodes binary data in some way. People often use base-64 for this.
09:16:07flyx… * are *not* carried along
09:16:59flyxchecking for non-UTF8 sequences in a string is just a heuristic that cannot tell if the data was *meant* as UTF8 string or binary data.
09:17:58flyxand in my opinion, semantic differences in data usage should lead to distinct types for each semantics, because that's why we have a static type system
09:18:51FromGitter<dom96> I agree, but we also need to consider the practicality of it.
09:19:35*girvo joined #nim
09:20:58*coffeepot joined #nim
09:21:32flyxthe main drawback I see for splitting string in two types is backwards compatibility. but other than that, I do not see a good argument for keeping one string type. how is it less practical to have a distinct blob type?
09:21:55FromGitter<dom96> We could force all strings to contain only valid UTF-8 sequences and perhaps introduce a ByteString type, but this would break a lot.
09:23:07Araqno, that's exactly what cause a constant pita in Python
09:23:15Araqstrings should be lossless.
09:23:38Araqenvironment variables, unix paths, they are all mostly blobs, not unicode
09:24:10*girvo quit (Ping timeout: 255 seconds)
09:24:52AraqPython 3 adds a "byte literal" string b"abc" because it doesn't work.
09:24:56yglukhovsorry guys, unintentionally forked facebook to nim-lang. removed already.
09:26:15Araqthe very idea of utf-8 was that most programs don't even care all that much about encodings as long as it's lossless
09:28:10*fredrik92 quit (Read error: Connection reset by peer)
09:29:39Araqthe application layer can also fix problems much better. when my program deals with german text, I know byte 196 means 'Ä', no need to crash with an UnicodeError
09:30:45*fredrik92 joined #nim
09:33:48flyxif we retrieve env variables as blobs, will they even work as intended if they contain non-ASCII? the Windows API has a function for retrieving env vars as UTF-8 for this reason, and ' a == "Ä" ' would fail in the code, which I think is undesirable
09:34:10*bjz quit (Read error: Connection reset by peer)
09:35:12flyxfor paths, I am also not convinced that they „just work“ if we ignore the encoding. however I do not know the details about that
09:35:13cheatfatedom96, could you please accept https://github.com/nim-lang/Nim/pull/4781
09:35:36*bjz_ joined #nim
09:36:26euantorcheatfate: might it be better to add a constant rather than the rather magic `0x7F000001`
09:36:32*bjz_ quit (Read error: Connection reset by peer)
09:37:08*bjz joined #nim
09:37:30flyxif I load the PATH env as non-UTF8 blob, and then add something like "/Äquator" to it, it will surely break.
09:38:06FromGitter<dom96> yeah, what euantor said.
09:38:14FromGitter<dom96> Add it to winlean/posix
09:38:51FromGitter<dom96> Actually, you should get @Wh1teDuke to test it first.
09:39:24cheatfatedom96, actually this test is works, and i will not patch stdlib because of test not working...
09:40:02Araqflyx: why? linux complains about non-utf8?
09:41:27cheatfatedom96, and actually i think all network communication tests can fail with not properly configured antiviruses and/or firewalls
09:41:32flyxAraq: if the loaded path itself contains a non-ascii char, the resulting string will contain two different encodings at the same time. so it cannot be used to access a file system resource
09:43:10FromGitter<dom96> cheatfate: it's a useful constant to have in the stdlib, others might want to use it in the applications.
09:43:28flyxand the user wonders why this happens because he loaded some Ä as byte 196 from the PATH, and then added some Ä encoding as UTF-8 to it, and then it fails.
09:43:47FromGitter<dom96> @cheatfate: I know that it works, but it might not fix @Wh1teDuke's issue.
09:44:11FromGitter<dom96> Don't change things just because you _think_ they fix something
09:44:26cheatfatedom96, then others can PR it and dispute with you why it is needed... maybe all constants http://lxr.free-electrons.com/source/include/uapi/linux/in.h will be added...
09:45:18FromGitter<dom96> Why are you so against adding a single constant?
09:45:34FromGitter<dom96> Jeez. Whatever.
09:46:16FromGitter<Araq> @dom96 he is not against adding a single constant, he is against this constant fight over minor details hampering his productivity
09:46:32cheatfatedom96, i think it will work because of this http://stackoverflow.com/questions/3375435/avoid-windows-firewall-popup-with-sockets-on-localhost, there no more reasons why recvFrom works on win64 and not works on win32...
09:47:06FromGitter<Araq> I like to give him write access for this reason, but he refuses and I dunno why
09:48:04FromGitter<dom96> Then he should just say that.
09:48:34FromGitter<dom96> All it takes is "I don't have time for this"
09:48:46cheatfateI dont want write access because i dont want to break anything, because i still don't understand git
09:49:17FromGitter<dom96> Instead of making me think that there is some other reason why he thinks the constant shouldn't be added.
09:50:09cheatfatedom96, other reason is what i heard somedays ago you want to make a plan to make stdlib more clean and pure
09:53:06FromGitter<dom96> Sure I do. But that doesn't mean we can't add things which are useful.
09:54:35cheatfatedom96, things becomes useful when somebody asks for them
09:55:25FromGitter<dom96> I agree, in this case you demonstrated a use for it and so it's useful to you.
09:58:10cheatfatedom96, adding one constant from 100 needed, is like paying $1 when you need to pay $100.
10:00:33Araqok, enough of this now. better stop here before it gets ugly.
10:01:16FromGitter<dom96> I'm sorry but I don't understand this analogy.
10:01:37FromGitter<dom96> We already have a couple constants, we add more as they become useful.
10:02:55*xet7 quit (Remote host closed the connection)
10:05:06euantorThe idea behind a constant as far as I see it is that if somebody comes along in a year to fix another bug, they don't have to Google what on earth `0x7F000001` means. It's not exactly a deal breaker, and can be added in later.
10:14:16*girvo joined #nim
10:20:51*girvo quit (Ping timeout: 248 seconds)
10:22:00*Demon_Fox quit (Quit: Leaving)
10:27:23*fredrik92 quit (Quit: Leaving.)
10:31:09cheatfateAraq, now i remembered why bitfields is not working... they breaking compilation
10:31:17cheatfatebecause of OFFSET(xxxx)
10:31:41Araqwe can fix that
10:32:15Araqeasily.
10:34:22cheatfateAraq, do you want me to make reproducible source?
10:39:59*foocraft joined #nim
10:42:09*fredrik92 joined #nim
10:45:26*brechtm_ joined #nim
10:45:56*planhths joined #nim
10:48:35*brechtm quit (Ping timeout: 248 seconds)
10:52:34*gernest joined #nim
10:56:11cheatfateAraq, and we already have this issue https://github.com/nim-lang/Nim/issues/3523
11:02:22*Snircle joined #nim
11:03:07*xet7 joined #nim
11:05:21*bjz_ joined #nim
11:05:29*bjz quit (Ping timeout: 240 seconds)
11:09:46*foocraft quit (Quit: Leaving)
11:11:49*fredrik92 quit (Quit: Leaving.)
11:13:27*fredrik92 joined #nim
11:14:12*girvo joined #nim
11:17:18*GustavoLapasta quit (Ping timeout: 264 seconds)
11:18:31*spindle quit (Remote host closed the connection)
11:38:13*niv joined #nim
11:43:05*Jesin quit (Ping timeout: 240 seconds)
11:43:58*brechtm_ quit (Remote host closed the connection)
11:44:37*brechtm joined #nim
11:50:00*Raaaa quit (Quit: Page closed)
12:11:12*lxdong quit (Ping timeout: 240 seconds)
12:14:31FromGitter<endragor> is there a pragma version of `—clib` compiler flag?
12:14:59cheatfateendragor {.passC:"".}, {.passL:"".}?
12:17:07FromGitter<endragor> yeah, but that requires `when defined(gcc): … elif defined(vcc): …` (for Windows), I thought perhaps there is a compiler-agnostic way
12:34:33*bjz_ quit (Quit: Textual IRC Client: www.textualapp.com)
12:35:11*bjz joined #nim
12:49:37ftsfmy nim synth is coming together =) https://www.youtube.com/watch?v=8M512ppoAJM
12:53:54FromGitter<dom96> @ftsf wow. That is awesome!
12:54:06FromGitter<dom96> When can I play with it?
12:54:32flyxdoes it support soundfonts?
12:54:45*flyx remembers his old days of fooling around with Mario Paint
12:54:53ftsfdom96, good question, it's still in a lot of flux and uses lots of undocumented controls, but once i've figured out what i'm doing i'll publish it and hopefully other people can contribute modules for it
12:55:12ftsfflyx, not yet, i just added a very basic drum sample player
12:55:24FromGitter<dom96> looks very powerful already
12:56:18FromGitter<dom96> Although I'm very much clueless about synths
12:56:34FromGitter<dom96> Any good tutorials about them?
12:57:44ftsfhmm i'm sure there are... probably some good stuff for Pure Data
12:58:38ftsfhttp://en.flossmanuals.net/pure-data/audio-tutorials/simple-synth/
13:08:17*planhths quit (Quit: Konversation terminated!)
13:36:51*vqrs quit (Max SendQ exceeded)
13:37:06*vqrs joined #nim
13:46:12*niv__ joined #nim
13:46:55*niv__ quit (Quit: kbye)
13:49:25*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
13:49:38*niv quit (Remote host closed the connection)
13:50:14*niv joined #nim
13:53:37*xet7_ quit (Remote host closed the connection)
13:53:47*niv quit (Remote host closed the connection)
13:54:02coffeepotftsf fantastic work! Very cool :)
13:54:08*niv joined #nim
13:57:33ftsfcheers
14:03:02*csoriano quit (Quit: csoriano)
14:03:52*planhths joined #nim
14:10:02ftsfflyx, soundfonts would be great addition, will have to look into that
14:10:10hohlerdeIn nim we don't have a global heap that can be shared between threads, at least not if we use types the GC is aware of. So, channels are an exception to this, aren't they?
14:10:23*planhths quit (Quit: Konversation terminated!)
14:10:48flyxftsf: I have used the fluidsynth library in the past, maybe you can get inspiration from that, it had a pretty clear interface
14:11:06ftsfflyx, cool, i'll check it out
14:14:22*xet7_ joined #nim
14:19:03Araqhohlerde: kind of
14:19:09*arnetheduck quit (Ping timeout: 244 seconds)
14:33:39*gernest quit (Quit: gernest)
14:49:05*foocraft joined #nim
14:52:00*vqrs quit (Max SendQ exceeded)
14:54:23*vqrs joined #nim
14:55:14*krux02 joined #nim
15:09:19*pie__ is now known as ie_
15:09:26*ie_ is now known as pie_
15:11:23*kafke joined #nim
15:18:09*Trustable quit (Remote host closed the connection)
15:40:21*Snircle joined #nim
15:44:44*PMunch joined #nim
15:49:13*PMunch quit (Client Quit)
15:49:23*PMunch joined #nim
16:22:24*brson joined #nim
16:23:58*vqrs quit (Max SendQ exceeded)
16:25:49*vqrs joined #nim
16:28:33*pregressive quit ()
16:31:35*rtr_ joined #nim
16:35:05*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:50:31*yglukhov quit (Ping timeout: 244 seconds)
16:51:24*yyy joined #nim
16:52:17*yyy quit (Client Quit)
16:53:18*libman joined #nim
16:57:31krux02is there a way do access an identifier from an outer scope?
16:57:53krux02I am in foo() and an identifier is hidden, how can I access the outer name for it?
16:59:54krux02the problem is I can't just do renaming, because there is a symbol automatically introduced with the same name as the symbol in outer scope, but I need to explicitly access the outer symbol
17:00:06*gehenna joined #nim
17:01:09*space-wizard joined #nim
17:05:16*Andris_zbx quit (Remote host closed the connection)
17:05:44dom96krux02: could you show us your code?
17:15:21*beaumonta quit (Remote host closed the connection)
17:15:47*girvo quit (Ping timeout: 248 seconds)
17:27:40*GustavoLapasta joined #nim
17:30:16FromGitter<Araq> module.outer
17:37:41*girvo joined #nim
17:37:48*yglukhov joined #nim
17:42:11*yglukhov quit (Ping timeout: 244 seconds)
17:44:43*nairobi joined #nim
17:51:21*gehenna quit (Ping timeout: 272 seconds)
17:51:48*libman quit (Read error: Connection reset by peer)
17:52:45*girvo quit (Ping timeout: 265 seconds)
17:55:25*nairobi quit (Remote host closed the connection)
17:57:13*ehmry left #nim ("matrix is my bouncer")
17:58:52*gehenna joined #nim
17:58:53*gehenna quit (Client Quit)
18:02:01*ehmry[m] joined #nim
18:08:22krux02Araq: thanks a lot it works now
18:08:53krux02I did not think that I automatically have a module name by file name, not that this name was available within that module
18:09:06*libman joined #nim
18:10:30krux02now I am on a very curiouse mission, I need arguments to a function that need to be known at compile time, because they are required to calculate the generic parameters of a result type
18:11:17krux02I have a type Tensor[depth : int, dimensions : array[depth, int]] that is very generic
18:13:37krux02I would like to write a transpose function that takes as a compile time argument a permutation like [1,2,0] and returns a tensor, where the result types has the dimension vector of the argument type permuted
18:14:45krux02transpose(tensor: Tensor, permutation: auto) : mypackage.Tensor[tensor.depth, permute(tensor.dimensions, permutation)] = ...
18:15:34krux02but permutation needs to be known at compile time otherwise I can't use it in the calculation for the result type
18:17:00*foocraft quit (Read error: Connection reset by peer)
18:37:23*foocraft joined #nim
18:39:39*girvo joined #nim
18:44:02*girvo quit (Ping timeout: 244 seconds)
19:01:41*yglukhov joined #nim
19:03:45*nairobi joined #nim
19:08:04*desophos joined #nim
19:11:17*pafmaf joined #nim
19:16:58*nairobi quit (Remote host closed the connection)
19:20:47*pafmaf quit (Ping timeout: 265 seconds)
19:41:28*spindle joined #nim
19:41:30*girvo joined #nim
19:46:00*girvo quit (Ping timeout: 260 seconds)
19:47:43flyxkrux02: you can do that with a macro.
19:48:23krux02flyx: can you be more specific?
19:48:53flyxmacro transpose(tensor, permutation: typed): typed
19:49:15flyxyou can then in the macro ensure that permutation is of kind nnkBracketExpr (I think that's what it is called)
19:49:37flyxand then its children count is then the length of the array you need to create
19:49:48*libman quit (Read error: Connection reset by peer)
19:50:46flyxfrom that information, you can construct and return an nnkObjConstr (again, that's what I think it is called) which creates the object you want
19:51:14krux02nnkBracketExpr is when you have something like this a[i]
19:51:22krux02I think you mean just nnkBracket
19:51:26flyxah yes
19:51:39flyxwell, you get what I mean
19:52:16krux02I know generally how macros work, but int his context it would be especially nice, if it would work without a macro
19:52:24krux02just by inference
19:52:34flyxbut is the type you output not the same type as the one you give in?
19:52:45krux02no it's not
19:52:59flyxhow does it differ?
19:53:05krux02you can imagine Matrix2x3 is not the same as Matrix3x2
19:53:54krux02A tensor is similar to a Matrix, just with the difference that it can does not have two dimensions, but an arbitrary amount of dimensions
19:54:04krux02and with a transpose the order changes
19:54:38flyxah okay, I see you switch those two
19:55:00*nairobi joined #nim
19:55:30flyxproc transpose[I, J](tensor: Tensor[I, array[J, int]], permutation: auto): Tensor[J, array[I, int]] =
19:55:30*nairobi quit (Read error: Connection reset by peer)
19:55:39flyx(not sure if that works, but I think it should)
19:55:48*nairobi joined #nim
19:56:49krux02I and J is the same
19:56:58krux02the length of the array does not change
19:58:19krux02permutation is an array of indices, for example [0,2,1] and then tensor dimensions from [5,6,7] should become [5,7,6]
19:58:22*PMunch quit (Quit: leaving)
19:58:31*PMunch joined #nim
19:58:44krux02the tensor itself then has in total 5*6*7 elements
19:58:48*nairobi_ joined #nim
19:59:13krux02thats 210 long array of scalar values
19:59:16*nairobi quit (Read error: Connection reset by peer)
19:59:31*nairobi_ quit (Remote host closed the connection)
19:59:59flyxhmm okay, I cannot imagine how that would be possible without a macro
20:00:45*nairobi joined #nim
20:01:36*nairobi_ joined #nim
20:04:32krux02I am thinking of passing the permutation array as a generic argument
20:04:35krux02something like this
20:05:11*nairobi quit (Ping timeout: 265 seconds)
20:05:49*nairobi_ quit (Ping timeout: 244 seconds)
20:05:56krux02transpose[permutation: static[openarray[int]](tensor: Tensor) : Tensor[tensor.depth, tensor.dimensions.permute(permutation)] = ...
20:06:10krux02but it doesn't compile yet :(
20:06:32krux02but yea, I think I need to sleep a night about it
20:06:50krux02for now it's enough for todayj
20:07:33*krux02 quit (Quit: Verlassend)
20:08:55*libman joined #nim
20:09:42*fredrik92 quit (Quit: Leaving.)
20:10:33*PMunch quit (Quit: leaving)
20:19:27*libman quit (Read error: Connection reset by peer)
20:22:42*nsf quit (Quit: WeeChat 1.5)
20:30:11*girvo joined #nim
20:35:23*girvo quit (Ping timeout: 272 seconds)
20:36:01*yglukhov quit (Remote host closed the connection)
20:38:13*libman joined #nim
20:38:57*libman left #nim (#nim)
20:40:08FromGitter<xxlabaza> Hi all! ⏎ Sorry for stupid question, but I really need help to understand in which case I should use ref object and when it is better to use 'simple' object or even tuple? ⏎ In ordinal languages, I was using heap like "shared zone" - any thread is able to read/write to objects in heap, and if I want not to share it I just not using heap ⏎ In Nim, as I understand, every thread has its own heap, so correct me, if I am not right: ⏎
20:40:08FromGitter... ... [https://gitter.im/nim-lang/Nim?at=57dc58a827a8458f7f1f94ce]
20:50:23FromGitter<Araq> @xxlabaza it's tough to answer your question since you conflate all things ;-)
20:53:03*fredrik92 joined #nim
20:56:40rudi_sAraq: Would you accept a patch which extends PathComponent with e.g. char-device and block-device so it supports all results of stat? - And would you accept a patch to add a wrapper for mkstemp to create temp files in a proper way. And if yes, what would be a good location for the proc? os?
20:57:52Araqrudi_s: that depends on whether both unix and windows are supported or not
20:58:28Araqos.nim is supposed to be the "least common denominator", os specific stuff goes to posix.nim or winlean.nim
21:02:56rudi_sAraq: For PathComponent there is AFAIK no windows equivalent, but it could be used on windows without issues (but will never result in char/block-device) so I guess that's fine for os.nim.
21:03:08*foocraft quit (Quit: Leaving)
21:03:23Araqso it would always be false?
21:04:04rudi_sAraq: No. It's just that PathComponenent never evaluates to pcBlockDevice or pcCharDevice on windows.
21:04:09*girvo joined #nim
21:04:24*yglukhov joined #nim
21:05:23FromGitter<Araq> @xxlabaza objects are as fast as tuples and the heap is not necessarily slower than the stack, CPU caches don't know about the stack vs heap distinction
21:06:11FromGitter<Araq> and if you need to share between threads, there is a allocShared0
21:06:39Araqoh wait, that's an enum.
21:06:48Araqno chance of getting that into os.nim then, sorry.
21:07:05Araqwould break every exhaustive 'case' statement
21:07:23rudi_swtf.
21:08:17*girvo quit (Ping timeout: 240 seconds)
21:08:36rudi_sSo any enum in the stdlib which is usable in a switch can't ever be changed?
21:09:13Araqwell every change is a breaking change, yes
21:11:03*yglukhov quit (Ping timeout: 240 seconds)
21:12:21rudi_sI see. I can understand the reasoning, but won't that hurt extending the language? - Well, I'll have to use the posix part then.
21:17:08*yglukhov joined #nim
21:18:16FromGitter<xxlabaza> @Araq ok, I see, but anyway, I don’t understand when I should use “ref object”, “object” and “tuple”? ⏎ ⏎ Ok, I understand the difference between object and tuple - tuple it is just a “values-holder” and object can do OOP things (encapsulation, polymorphism and inheritance). Am I right? ⏎ ⏎ But what to do with "ref object" and "object"? What the pros and cons of allocating memory in stack or in heap within Nim
21:18:16FromGitter... language? [https://gitter.im/nim-lang/Nim?at=57dc6198c3e7045a30568d5a]
21:20:38FromGitter<Araq> same as everywhere else really. try to create a tree on the stack. won't work
21:21:09FromGitter<Araq> in general you start with 'object' until you hit some limitation
21:21:21FromGitter<Araq> and then you make it 'ref object'
21:21:56FromGitter<Araq> many people coming from Python start with 'ref object' though, because that's what they are familiar with
21:22:02*yglukhov quit (Ping timeout: 265 seconds)
21:26:38rudi_sAraq: Just noticed that symlinks to dirs are not handled correctly in getFileInfo(): They are reported as pcLinkToFile.
21:27:33*Ven_ joined #nim
21:28:16*yglukhov joined #nim
21:32:17*yglukhov quit (Ping timeout: 240 seconds)
21:32:31rudi_sThe issue, also present in walkDir, is that files in posix have a single type (e.g. link or dir). Therefore either S_ISDIR or S_ISLNK is true, but never both.
21:33:30*yglukhov joined #nim
21:37:49rudi_sSo a (second) stat is necessary to check where the symlink points to.
21:38:00*yglukhov quit (Ping timeout: 260 seconds)
21:40:21Araqfine with me.
21:40:59rudi_s"Find with me" as in "not a bug" or "send patch please"?
21:42:28Araq"send patch please"
21:42:39*GustavoLapasta quit (Quit: Leaving)
21:43:26rudi_sWill do.
21:43:27*yglukhov joined #nim
21:47:53*yglukhov quit (Ping timeout: 264 seconds)
21:53:27*yglukhov joined #nim
21:54:33*Ven_ quit (Ping timeout: 240 seconds)
21:57:21*Ven_ joined #nim
21:58:09*yglukhov quit (Ping timeout: 276 seconds)
22:02:05*yglukhov joined #nim
22:06:14*girvo joined #nim
22:06:33*yglukhov quit (Ping timeout: 248 seconds)
22:09:45*Ven_ quit (Ping timeout: 248 seconds)
22:10:42*girvo quit (Ping timeout: 264 seconds)
22:11:19*yglukhov joined #nim
22:11:47rudi_sJust tried running the testsuite and I see quite a few FAILs but the exit code of ./koch tests is 0, is this expected?
22:11:47*dyce quit (Quit: WeeChat 1.0.1)
22:11:50*girvo joined #nim
22:12:38Araqthere is a --pedantic switch for that or something
22:12:52Araqtests are green on travis though
22:13:31rudi_sAraq: Where can I see the travis output?
22:15:09*Ven_ joined #nim
22:15:31*yglukhov quit (Ping timeout: 244 seconds)
22:16:11dom96rudi_s: https://travis-ci.org/nim-lang/Nim
22:16:17*girvo quit (Ping timeout: 240 seconds)
22:16:36dom96I've set up GitLab CI for us recently and am getting some failures still on Linux
22:16:50dom96so maybe you are running into the same problem
22:18:40dom96https://gitlab.com/nim-lang/nim/builds/4141792
22:19:06dom96coro and tostring failing there
22:19:44dom96coro is likely due to a dependency being missing
22:20:03dom96toString leaves me puzzled, the difference in output is "inf" vs. "-inf"
22:20:16Araqno, it's nan vs -nan
22:20:30Araq-nan makes no sense, seems some libc discrepancy
22:20:38dom96oh yes
22:21:20dom96I guess we should relax that test to accept -nan
22:21:23*yglukhov joined #nim
22:23:19*Trustable joined #nim
22:23:36*Ven_ quit (Ping timeout: 250 seconds)
22:23:40Araqno way, fix the stdlib
22:23:55Araqit has all sort of hacks for producing consistent nan results already
22:24:38AraqMS for instance thinks +00.NAN.bananajoe is a useful way to write nan
22:25:28Araqwhat's a negative Not-a-Number? an "almost number"?
22:25:49*yglukhov quit (Ping timeout: 255 seconds)
22:27:38*yglukhov joined #nim
22:29:17*Ven_ joined #nim
22:36:10*yglukhov quit (Ping timeout: 250 seconds)
22:40:20*Ven_ quit (Ping timeout: 265 seconds)
22:41:50*Ven_ joined #nim
22:43:06*yglukhov joined #nim
22:46:10rudi_sI'm looking at template rawToFormalFileInfo() in lib/pure/os.nim: Why is sometimes result used and sometimes formalInfo? E.g. result.permissions = {fpUserExec..fpOthersRead} but in the if it's formalInfo.permissions = ...
22:51:47*yglukhov quit (Ping timeout: 248 seconds)
22:52:50*Ven_ quit (Read error: Connection reset by peer)
22:53:22*Ven_ joined #nim
22:53:23*yglukhov joined #nim
22:53:32rudi_sShouldn't this always assign formalInfo?
22:54:39*elrood quit (Remote host closed the connection)
22:56:24*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:58:31*yglukhov quit (Ping timeout: 272 seconds)
23:02:13*yglukhov joined #nim
23:06:14*girvo joined #nim
23:06:59*yglukhov quit (Ping timeout: 265 seconds)
23:07:43rudi_sWhy does existsFile() return false for files which are not symlinks nor directories but also not regular files (like a fifo or a char-dev), but getFileInfo will state that it's a file?
23:08:10rudi_sShouldn't the check in existsFile() be changed from return stat(filename, res) >= 0'i32 and S_ISREG(res.st_mode) to !S_ISDIR() to be consistent?
23:08:51*yglukhov joined #nim
23:10:36*PMunch joined #nim
23:10:47*Matthias247 joined #nim
23:10:47*girvo quit (Ping timeout: 265 seconds)
23:13:40*yglukhov quit (Ping timeout: 265 seconds)
23:17:40*bjz joined #nim
23:22:10*yglukhov joined #nim
23:23:47*Ven_ quit (Ping timeout: 248 seconds)
23:25:39*Trustable quit (Remote host closed the connection)
23:26:18*yglukhov quit (Ping timeout: 244 seconds)
23:27:15*Ven_ joined #nim
23:28:32*yglukhov joined #nim
23:35:58*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
23:36:06*yglukhov quit (Ping timeout: 244 seconds)
23:41:52*yglukhov joined #nim
23:42:05rudi_sAraq: ^
23:54:30*girvo joined #nim
23:55:13*yglukhov quit (Ping timeout: 244 seconds)
23:58:41*girvo quit (Ping timeout: 240 seconds)