<< 06-02-2018 >>

00:11:15skrylargvim seemed okay. mostly use emacs+evil now
00:17:29*endragor joined #nim
00:22:00*endragor quit (Ping timeout: 256 seconds)
00:36:55*yglukhov joined #nim
00:41:18*yglukhov quit (Ping timeout: 240 seconds)
00:51:37*MJCaley joined #nim
01:15:10*yglukhov joined #nim
01:19:18*yglukhov quit (Ping timeout: 240 seconds)
02:08:04*MJCaley quit (Quit: MJCaley)
02:24:20*chemist69 quit (Ping timeout: 252 seconds)
02:27:49*yglukhov joined #nim
02:30:14*gmpreussner quit (Quit: kthxbye)
02:32:27*yglukhov quit (Ping timeout: 256 seconds)
02:33:33*xkapastel quit (Quit: Connection closed for inactivity)
02:34:09*gmpreussner joined #nim
02:37:32*endragor joined #nim
02:38:48*chemist69 joined #nim
02:42:25*endragor quit (Ping timeout: 260 seconds)
02:44:13*endragor joined #nim
03:09:07skrylarhttp://www.aosabook.org/en/index.html neat.
03:12:18*radagast_04 quit (Quit: radagast_04)
03:22:21*dddddd quit (Remote host closed the connection)
03:40:33*yglukhov joined #nim
03:45:38*yglukhov quit (Ping timeout: 276 seconds)
04:16:21FromGitter<gogolxdong> How to do string sorting?
04:18:13FromGitter<Quelklef> wym?
04:20:35FromGitter<gogolxdong> sort string by dictionary order.
04:51:28*yglukhov joined #nim
04:56:33*yglukhov quit (Ping timeout: 268 seconds)
05:22:51*BitPuffin joined #nim
05:34:22FromGitter<gogolxdong> got it ,use orderedTable and cmp
05:54:27*ieatnerds joined #nim
06:12:39*nsf joined #nim
06:15:27*arecaceae quit (Remote host closed the connection)
06:16:19*arecaceae joined #nim
06:37:49*yglukhov joined #nim
06:38:21FromGitter<gogolxdong> Shouldn't utc(now()) return 2018-02-06T06:36:46Z rather than 2018-02-06T06:36:46+00:00?
06:42:37*yglukhov quit (Ping timeout: 260 seconds)
06:48:01FromGitter<GULPF> that's an issue with `times.format`, but yes I agree
06:54:05FromGitter<nitely> @gogolxdong for sorting use https://nim-lang.org/docs/algorithm.html#sort,openArray[T],proc(T,T)
06:55:12FromGitter<gogolxdong> yes, I figured it out according to our scenario.
06:56:45FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a7951ad7dcd63481f22e835]
06:58:45FromGitter<nitely> that too :)
07:03:33*solitudesf joined #nim
07:05:06FromGitter<gogolxdong> open file with fmReadWrite , readAll() after writing resulted in empty string.
07:05:52FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a7953cfa3447aac7548eff1]
07:10:34*rokups joined #nim
07:19:29FromGitter<survivorm> try `f.setFilePos(0)
07:19:40*fredrik92 is now known as couven92
07:19:50FromGitter<survivorm> before reading
07:20:06FromGitter<survivorm> @gogolxdong
07:21:23FromGitter<gogolxdong> yes, get your point
07:21:57*stisa joined #nim
07:40:41*yglukhov joined #nim
07:52:19*Yardanico_ joined #nim
08:04:31*gokr joined #nim
08:07:40*yglukhov quit (Remote host closed the connection)
08:14:03*Vladar joined #nim
08:15:46*Yardanico_ quit (Read error: Connection reset by peer)
08:34:23*floppydh joined #nim
08:35:33*vlad1777d joined #nim
08:44:50planetis[m]so concepts don't work with recursion?
08:44:53planetis[m]or a bug?
08:47:52FromGitter<tim-st> Is it the same to declare a variable (not with `*`) at top of a `file.nim` an access it without passing it as param using procs (without `*`) instead of passing again and again this variable to the proc as an param (regarding performance)?
08:48:10FromGitter<tim-st> with `*` I mean not public
08:53:06FromGitter<tim-st> https://gist.github.com/anonymous/c62d224708f31e32ef6eafb54b396172
08:54:01FromGitter<tim-st> especially for tuples with many fields it would make life easier, but I dont want to have performance loss
08:57:18planetis[m]I don't think so 'var' in a parameter is pass by reference
08:57:57FromGitter<tim-st> People told me "gcc is very clever"; if I would be a gcc developer I properly would have rewritten the code without performance loss
08:59:02FromGitter<tim-st> *probably
08:59:56*Vladar quit (Quit: Leaving)
09:01:19FromGitter<tim-st> Can I compile this and compare it somehow, if it's the same?
09:05:05planetis[m]you can compare the assebly generated
09:05:15planetis[m]well if you can grasp assembly
09:05:49planetis[m]personally I only understand human-resource-machine assembly :)
09:09:52*PMunch joined #nim
09:13:00planetis[m]regarding your question i prefer passing as arguments because redability
09:16:02FromGitter<tim-st> ok thanks, normally I do so, too, now I had a proc where this would be much easier
09:16:38FromGitter<tim-st> because it's called in different contexts
09:36:06PMunchI suspect it would be faster as it has to copy less data into the stack frame of the call
09:36:47PMunchBut you might benefit from cache-locality as it's close to the other parameters, so if it's only a pointer it's probably slower
09:40:47*yglukhov joined #nim
09:41:31*yglukhov quit (Remote host closed the connection)
09:41:47*yglukhov joined #nim
09:57:11Araqhttps://github.com/nim-lang/Nim/issues/7189
09:57:22Araqgitmate.io is doing some work...
09:57:36Araqbut er ... shitty work.
09:59:43FromGitter<survivorm> too "witty"? 😄
09:59:53PMunchHaha :P
10:04:23FromGitter<survivorm> It's interesting that you get tired of too "witty" tool much faster, than of too silly. If silly means it doesn't do anything at all if it's not completely sure what to do
10:16:26*rockcavera quit (Ping timeout: 256 seconds)
10:20:31dom96Araq: bleh, it's using your account
10:20:53*radagast_04 joined #nim
10:31:48*sleepyqt joined #nim
10:32:52*vlad1777d quit (Ping timeout: 256 seconds)
10:50:00*rokups quit (Quit: Connection closed for inactivity)
11:01:37*xet7 quit (Read error: Connection reset by peer)
11:02:43*xet7 joined #nim
11:10:45*xet7 quit (Read error: Connection reset by peer)
11:11:45*xet7 joined #nim
11:20:42*Vladar joined #nim
11:21:06planetis[m]do concepts work with recursion? or it's a bug?
11:21:31Araqrecursion?
11:22:06Araqprobably not.
11:22:34planetis[m]yes https://gist.github.com/konqoro/7756097a123c7397da2dc9db8b164048
11:25:51*Arrrr joined #nim
11:29:30ArrrrThe new error message you get from mismatches is more helpful now, but also too verbose. Is it not possible to handle it in a different way? For example https://pastebin.com/mw4RxnUQ
11:31:30ArrrrWhat is dislike is reading too many lines and too many words that after the first error you will memorize and will stop to provide new information.
11:34:41*xet7_ joined #nim
11:35:21AraqArrrr, make a suggestion
11:36:09FromGitter<alehander42> is it possible to sometimes use e.g. `<>` for clarifications (`'true' <bool>` instead of `'true' (bool)`, `<type1, type2>` instead of `(type1, type2)`) ? the braces seem a bit ambigious to me considering tuple types (but maybe that's just me)
11:36:17ArrrrYes, in my pastebin there is one.
11:36:55Araqhmm more ()
11:37:19*xet7_ quit (Read error: Connection reset by peer)
11:37:44Araqbut it's better than currently
11:37:47*xet7 quit (Ping timeout: 260 seconds)
11:38:02PMunchSo use alehander42's suggestion and swap some for <> :)
11:38:40*xet7_ joined #nim
11:39:05Araqok
11:45:58*MJCaley joined #nim
11:47:51*xet7_ quit (Read error: Connection reset by peer)
11:49:33ArrrrQuality of life improvement.
11:49:35*miran quit (Quit: Page closed)
11:50:55*xet7 joined #nim
11:50:57PMunchBut I'm happy with the information that got added, makes it a bit easier to find mismatches :)
11:55:20*miran joined #nim
11:55:57*MJCaley quit (Quit: MJCaley)
11:57:07*kier quit (Ping timeout: 268 seconds)
11:57:39FromGitter<alehander42> yeah, very nice improvement! (the only other thing is to maybe colorize/underline the erroneous args, but maybe that's a bit too far)
12:01:45Araqnot everybody likes [e340foobar in the redirected outputs
12:05:20*xet7 quit (Ping timeout: 260 seconds)
12:05:34*rockcavera joined #nim
12:06:29ArrrrBut it can be disabled
12:07:15*kier joined #nim
12:10:52Araqit's "friction"
12:19:51*xet7 joined #nim
12:32:52FromGitter<alehander42> hm, nim already produces a lot of colored '[Hint]' and warnings for me
12:33:45*rokups joined #nim
12:39:30FromGitter<alehander42> maybe ⏎ ⏎ ```(a, b + 2, x()) ⏎ ^``` [https://gitter.im/nim-lang/Nim?at=5a79a20193be87284d815a11]
12:40:58FromGitter<alehander42> ```(a, b + 2, x()) ⏎ ^``` [https://gitter.im/nim-lang/Nim?at=5a79a25a36de78850cfa187b]
12:40:59FromGitter<alehander42> (gitter's code blocks are weird ugh)
12:44:26dom96Just copy how clang does it
12:44:33dom96Rust does it the same way IIRC
12:44:40dom96Some ASCII art goes a long way
12:45:03dom96 ^----- Should be an `int`, got a `bool`.
12:45:33dom96Also please change "expression: ..." to "in expression: ...", small change but an important one I think
12:45:50dom96but overall, very nice improvement.
13:04:01arnetheduckwould be nice with some json or something based error messages that can be parsed easily by editors
13:04:08arnetheduckas an option
13:06:35*solitudesf quit (Ping timeout: 276 seconds)
13:06:53*solitudesf joined #nim
13:09:02dom96yep
13:09:07AraqI would prefer HTML over JSON
13:09:14dom96but let's not try to make the default error messages both human and machine readable
13:09:17Araqit's semi structured data
13:09:26AraqHTML makes more sense for that IMO
13:11:28dom96Can't tell if you're serious or not
13:11:57AraqI am.
13:12:17Araqthe json would have no structure
13:12:31Araqor let's see inconsistent structure
13:12:44dom96You can define a JSON structure
13:12:50Araqsome error messages have more than one line information, for example
13:12:55dom96but surely XML would be a better choice than HTML
13:13:35AraqXML/HTML, where is the difference. :P
13:13:49Araqmarkup for the text, not putting the text into quotes
13:14:22dom96HTML has a structure for the display of various multimedia
13:14:48dom96I guess it could be useful for error messages, if you want to bold certain parts
13:15:35dom96but you may as well just separate the data and allow anyone to format it whatever way they want
13:15:55dom96Maybe what you want is SGML? :P
13:16:06Araq? you can always format <b> any way you want anyway
13:16:32Araqthe point is that people will draw wrong conclusions from
13:16:46Araq[23, 2, "filename.nim", "error message"]
13:17:50dom96{ "line": 23, "col": 2, msg: "message" } is better than <span><i>Line: 23 Col: 2</i> Message</span>
13:17:57Araq[23, 2, "filename.nim", ["error message", [1, 1, "different file", "more information]]]
13:19:32Araq{ "line": 23, "col": 2, msg: "message" } is better than <span><i>Line: 23 Col: 2</i> Message</span> misses the point
13:19:51Araqthe point is, it is *not* msg: "message"
13:20:38dom96I don't get your point then
13:20:41Araqthe message itself is semi structured. xml was designed for this and json wasn't.
13:23:05dom96I don't think so, JSON is structured too if you use json objects.
13:23:09dom96No?
13:23:57dom96<errors><error line=23 msg="asd"></errors> vs. {errors: [ {line: 23, msg: "asd"} ]}
13:24:43FromGitter<andreaferretti> @Araq of course using only the array part of JSON will be inefficient and clumsy
13:24:57FromGitter<andreaferretti> I don't think anyone ever argued for this
13:27:20Araqnot sure how I can get my point accross.
13:28:23Araqthe concept of "semi structured" data seems to be lost on you. write the next HTML page in JSON instead then.
13:29:29FromGitter<andreaferretti> the concept is pretty clear, is just that JSON seems suitable for it
13:29:30*dddddd joined #nim
13:29:48FromGitter<andreaferretti> I mean, if I had to write my next page by hand, by all means I would write HTML
13:30:08FromGitter<andreaferretti> but if I have to generate it programmatically, HTML is not any easier that JSON
13:31:05FromGitter<andreaferretti> and JSON allows for arbitrary object keys, making it much easier to convey meaning without having to resort to a limited set of div, b, i and so on
13:31:29Araqyeah I give up. just try it.
13:31:42Araqit's not about syntax or named object keys.
13:31:57FromGitter<andreaferretti> maybe you can give an example which would be simple HTML but clumsy to express in JSON?
13:32:44FromGitter<alehander42> but why not xml then :?
13:33:23Araq<error line="3" file="stuff.nim" >some error message with <b>important</b> pieces</error>
13:35:42FromGitter<andreaferretti> I see what you mean
13:35:45PMunch{"level": "error", "data": { "line": 3, "file":"stuff.nim", "message": "some error message with <b>important</b> pieces"}}
13:35:56PMunchThat's how a typical JSON API would do it
13:36:14PMunchThe data field would be defined in terms of the level value
13:36:17federico3Araq: I might be mistaken but that is XML but not valid HTML (HTML being a subset of XML)
13:36:19AraqPMunch, yes indeed. so it's at best a hybrid.
13:36:37FromGitter<andreaferretti> I think it would be a pain to inflict that to a tool author, though
13:36:40*Snircle joined #nim
13:37:08FromGitter<andreaferretti> as anyone who has tried to parse custom HTML has realized
13:37:26Araqfederico3, yeah sure, so it's xml
13:37:45dom96{"level": "error", "data": { "line": 3, "file":"stuff.nim", "message": ["some error message with ", {kind: "important", msg: "important"}, "pieces"]}}
13:37:52FromGitter<alehander42> well you can have ⏎ 'message':..
13:37:57FromGitter<alehander42> yeah, the dom96 snippet
13:38:00PMunchAraq, well yeah. If you want human readable error messages then adding some kind of formatting options would be a good idea. But I think the idea was to have something like that without the error message
13:38:02Araqdom96, that's the solution I've been waiting for.
13:38:27PMunchSo all the information that went into the error message would be available but no actual human-readable error message was included
13:38:34PMunchOr at least optional
13:38:34*xet7_ joined #nim
13:39:12PMunchdom96, that's of course another way you could do the formatting
13:39:14dom96The only reason tools would embed HTML in JSON is if they are going to be run in a browser anyway
13:39:24PMunchYeah, I was just being lazy :P
13:39:35dom96html.append(json.message) // voila
13:39:37Araqso now your 'message' is a list of stuff and this stuff is nested and the nesting is not part of the data model
13:39:44Araqbut it's instead markup.
13:40:19dom96That's fine. There is no trouble with checking whether 'message' is a string or an array
13:40:22PMunchI think the original idea was to have error messages exposed in a purely computer-readable format. So I could write a tool that translated the error messages to whale sounds if I wanted to
13:40:44*xet7 quit (Ping timeout: 265 seconds)
13:40:56FromGitter<alehander42> well you can have {'kind': 'normal', msg: 'stuff'}, {'kind': 'important', msg: 'stuff'}
13:41:31Araqdom96, it's not fine, the idea of "this is semi structured" is part of xml and an alien concept for JSON
13:42:05dom96Araq: It's the exact same thing
13:42:08Araqbesides, the JSON is likely transformed into XML/HTML anyway so that the editor can render it
13:42:13dom96I'll have to handle the possibility of a <b> inside a message
13:42:36FromGitter<alehander42> you don't need it to be semi structured, you can map it to a strict schema
13:42:55PMunchSo all messages with "level": "error" would have line and file. But then it would have another object within it that contain "errorKind": "TypeError" for example and have the fields "got": [{"fieldName": "name1", "type": "bool"}] and "expected": [{"fieldName": "name2", "type": "string"}]
13:44:02PMunchThis way whatever tool that interfaces with the error could create the error message as it wanted to
13:44:07PMunchOr turn it into whale-sounds
13:45:13Araqoh the tool author has nothing to better to do to re-ensemble this mess into english
13:46:29dom96The tool author might need this information in a structure like that
13:46:45dom96otherwise why not just grab the compiler output?
13:46:52FromGitter<alehander42> well what if the tool author doesn't want to render html
13:47:15FromGitter<alehander42> if html is so important, you can just have a flag to output the html
13:47:24PMunchMy point is that english is unstructured, so parsing any information out of the english error messages would be a mess if they needed that data (not to mention it could break my someone rewording an error message. You could of course also include a "message" field on all errors if that is all they wanted
13:47:56PMunchSay I wanted to write a tool to output the error messages in Norwegian
13:48:29PMunchOr if my editor supported hyperlinks in error messages and I wanted to link specifically to a field?
13:48:35FromGitter<survivorm> I'd say json is more flexible
13:50:22FromGitter<survivorm> Yeah, @PMunch have a point. With json structure you may display error however you want, not just in one way error author deems "the right one"
13:51:42FromGitter<survivorm> And if you want to provide html, you may as well support msg and plainMsg in json as plain text
13:51:50PMunchI do feel the original error should be added as well though, in a "message" field. If all you wanted was the line and column numbers for example but keep the original message
13:52:27FromGitter<survivorm> because dom's variant is not looking good too
13:53:28FromGitter<alehander42> I think dom's variant is almost perfect if you wrap all the tokens in {kind: <kind>, token: <token>} form
13:53:57FromGitter<survivorm> I think it's a bit too verboose
13:54:19FromGitter<survivorm> imagine you're to raise such an error
13:54:38FromGitter<survivorm> information doesn't come from nowere
13:55:55PMunchI feel the most important part is to split the dynamic content (what made the error), and the static content (how the error is presented)
13:56:47PMunchSo the tool author is able to change the presentation without having to parse out the information
13:57:00PMunchHmm, do you get IRC formatting on Gitter?
13:57:15dom96My bet is no
13:57:39FromGitter<survivorm> Yeah, error author may play with several optional fields with "formatted" error representation
13:57:39dom96Bold?
13:57:46FromGitter<survivorm> Which ones?
13:57:48FromGitter<survivorm> yj
13:57:49dom96hrm, I think I failed there
13:57:52dom96There we go
13:58:02FromGitter<survivorm> still no
13:58:13dom96Yeah, FromGitter doesn't support it
13:58:14FromGitterdom96, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/nim-lang/Nim
13:58:20survivorm[m]and here - yes
13:58:41dom96would be nice to get support for it in irclogs https://irclogs.nim-lang.org/
13:59:08FromGitter<survivorm> for the formatting?
13:59:11dom96I have some nightmare memories trying to parse mIRC formatting before I knew how to properly parse things
13:59:36FromGitter<survivorm> Yeah, parsing is not an easy task
14:00:06PMunchThe IRC codes are pretty easy though. Just a byte that can't mean anything else
14:00:17FromGitter<survivorm> Btw, @PMunch - article's finished, care to help improving it?
14:00:39PMunchThe clear byte might be a bit of a pain though, you would need to keep track of all the current styles to properly end them in HTML
14:00:40dom96that was when I was parsing using `split` until Araq taught me The Way (TM)
14:00:52PMunchsurvivorm[m], sure, link?
14:00:58survivorm[m]t upset
14:01:05FromGitter<survivorm> Because as i've read english version againm i've got upset
14:01:15PMunchupset?
14:01:21PMunchAbout your own text? :P
14:01:34FromGitter<survivorm> https://docs.google.com/document/d/109ITPXUi1ywUHkEb7K_FMv6sMjBAXZgcrE2CuFPnWGA/edit?usp=sharing
14:01:45FromGitter<survivorm> About my translation
14:01:57PMunchdom96, I have to say thanks for setting me onto parsers. These combinational parsers are really cool and powerful
14:02:04PMunchOr whatever you want to call them..
14:02:18FromGitter<survivorm> or the google's, with some hand tweaks...
14:03:00FromGitter<survivorm> And anyone with skills in English is welcome to comment on the article too
14:03:13FromGitter<survivorm> it's even open for editing
14:03:25PMunchI'm at work right now, but I'll try to at least read through it tonight :)
14:03:40floppydhiterators aren't allowed to be recursive?
14:03:47FromGitter<survivorm> 'Cause I'm really-really upset about the text quality
14:04:55*Arrrr quit (Ping timeout: 256 seconds)
14:07:09FromGitter<survivorm> And, btw, what's the most popular english site, there programmers are posting big articles? I've found only dzone
14:10:56shashlick@honewatson: got airline color working on ubuntu, had to set t_Co=256. that doesn't work on windows though, makes the whole screen grey. using vim on msys
14:15:21*Arrrr joined #nim
14:19:06shashlickare there any good examples of using the pegs module? I'm using it (it works) but am sure it could be done better
14:22:13FromGitter<survivorm> And it would, hopefully. For me, now it's almost broken as it doesn't support nor AST, nor grammar construction to procs binding. I'll come to it eventually, but i plan to start on porting some BNF parser to nim (D-parser, maybe? or parglare from python, as it's decent tool too)
14:26:02PMunchsurvivorm[m], hackernews is pretty big
14:26:09PMunchAnd reddit.com/r/programming
14:26:18PMunchBut if you mean were to publish I have no idea :P
14:29:25FromGitter<survivorm> As far as i can see, reddit is for sharing and discussing
14:29:34FromGitter<survivorm> not for posting
14:30:47federico3survivorm: you mean a service to host articles/blogs like medium & co? GitHub or GH pages works
14:30:49FromGitter<survivorm> All of it's "posts" are essentially, links to foreign resources
14:31:28PMunchYeah, that's what I meant
14:31:39FromGitter<survivorm> Yeah, @federico3 something like that
14:31:41PMunchBoth hackernows an reddit are just linking to the actual article
14:31:50PMunchA nice way to let people know about it
14:32:39PMunchBut yeah for posting you would need to go somewhere else. If you want I could of course also guest-post it on my own page and you could share the link to that
14:36:49FromGitter<survivorm> That's interesting offer, and i may take it, but first i'll try to use somethere else. You see, russian community has https://habrahabr.ru/ as a well-known base for article sharing. It's programmer's site, it has ranking, posting is free, it's auditorium is big and it consists of the people you (as programmer) target. Benefits only
14:37:36FromGitter<survivorm> So' i've been looking for something similar in english web segment
14:38:16FromGitter<survivorm> So far - looks like to no avail. You have it, but not in one place
14:39:00FromGitter<survivorm> Like - post it on gh, link it to reddit, and see what happens
14:39:14federico3interesting how there aren't platforms to do that
14:39:25FromGitter<alehander42> posting on medium or your own blog and linking this on hacker news / reddit seems to be exactly the same, it's more flexible
14:39:54FromGitter<survivorm> May be. But flexible in exactly what?
14:40:02FromGitter<survivorm> Page setup?
14:40:46dom96wow, Rust is going to pay $100/hr to someone to design a new website: https://gist.github.com/ashleygwilliams/01f8a94a0c7627a796e223415b4404d2
14:42:33FromGitter<survivorm> looks like it's more about mentorship then of design
14:42:44*craigger quit (Quit: bye)
14:42:46PMunchDo you think they would like it if you did it in Nim? :P
14:42:53*craigger joined #nim
14:43:05*rokups quit (Quit: Connection closed for inactivity)
14:43:26miran@survivorm - post it on your github, and link it when posting on reddit/HN
14:43:49PMunchWell with your own site you have full control and are sure that your content is not taken down without your consent. It also means that you can take it down yourself at any time should you want to.
14:43:56federico3"your javascript looks machine generated" "nah, I just like weird variable names..."
14:43:59FromGitter<survivorm> They want someone to rule them all :) (One Ring to rule them all, One Ring to find them, ⏎ One Ring to bring them all and in the darkness bind them :D)
14:44:03PMunchfederico3, haha :P
14:44:37FromGitter<alehander42> @survivorm flexible, your content doesn't depend on some platform, it's just in your own blog, and it's separate from the places were it's posted, and each platform has different communities with different focuses which can lead to different discussions
14:46:42*endragor quit (Remote host closed the connection)
14:47:49FromGitter<survivorm> @alehander42 I need to think on it. Or more likely - to try all cycle myself and see, how it works. Because i like the idea, but don't know how it'll work out
14:50:34*gokr quit (Ping timeout: 256 seconds)
14:54:30*endragor joined #nim
14:59:41*endragor quit (Ping timeout: 276 seconds)
15:19:01*xet7_ is now known as xet7
15:25:57*arnetheduck quit (Remote host closed the connection)
15:32:32*arnetheduck joined #nim
15:41:09*fvs joined #nim
15:47:33fvsOver the years I've gotten into the habit of declaring my variables up front. Some languages enforce this (fortran, javascript?). With nim, this doesn't seem to matter and I can declare the variable if and when i need it. It impacts readability somewhat with vars and lets dispersed throughout the code, but so what.
15:48:33PMunchfvs, you are still free to declare them at the beginning
15:48:46PMunchBut you're right, Nim doesn't force it on you
15:49:23PMunchIMO it helps keep the definition close to the usage. Worst thing is having to scroll up through a 100 line long function looking for a variable just to figure out what type it is
15:49:58PMunchBut I guess it depends on what you're used to
16:04:05shashlickhttps://www.youtube.com/watch?v=48X4PeHxkNg
16:07:14PMunchOh yeah, I saw a guide explaining how to do that a while back
16:18:36*PMunch quit (Quit: Leaving)
16:20:30*yglukhov quit (Remote host closed the connection)
16:21:03*yglukhov joined #nim
16:21:53*miran_ joined #nim
16:28:02*yglukhov quit (Ping timeout: 256 seconds)
16:30:34*gokr joined #nim
16:40:27*natrys joined #nim
16:42:33Araqfvs: top level vars have real objective downsides. they are more error prone (use before definition, use of the wrong variable)
16:43:39Araqand readability is worse too, IMO. and in Nim you cannot use 'let' then.
16:43:47Araqjust say no. ;-)
16:47:36*gokr quit (Read error: No route to host)
16:47:47FromGitter<barcharcraz> That was an old optimization to make compilers simpler to write
16:48:21*floppydh quit (Quit: WeeChat 2.0.1)
16:51:06*rokups joined #nim
16:52:13*NimBot joined #nim
16:52:25FromGitter<krux02> well it's not hart for a compiler to determine all variable declarations within a block. So when a compiler thinks all variables should be declared at the top. The compiler can do that on it's own. I don't feel the need to help the compiler there.
16:54:02dom96unlike many languages, in Nim you can easily define all variables at the top of functions inside a single 'var' block
16:54:17dom96but I agree that doing so impacts readability considerably
16:55:22FromGitter<andreaferretti> it can do it on its own, but early compilers were pretty primitive
16:55:27FromGitter<andreaferretti> often one pass
16:55:34FromGitter<andreaferretti> not much ram to spare
16:55:46ieatnerdsIf I have a long module I'll put vars inside functions, but when its just a short one I tend to put them on top.
16:55:57*Trustable joined #nim
16:56:16FromGitter<krux02> yea but we don't need to compile on computers with just a few kilobytes of ram anymore
16:56:20*rockcavera quit (Remote host closed the connection)
16:56:48FromGitter<krux02> I make vars as local as possible
16:57:04FromGitter<krux02> sometimes I have global vars, but I try to keep them to an absolute minimum
16:57:52FromGitter<andreaferretti> yeah of course I agree, I was just explaining why it used to be a common restriction on early ompilers
16:58:19FromGitter<krux02> when I see that I have a single instance of something and I pass it down to every function but it's always the same instance. Then I often think, 'ah screw it, make it global'
16:59:40FromGitter<krux02> I do generalizations and abstractions like a compression algorithm.
16:59:58FromGitter<krux02> but sure.
17:00:07FromGitter<krux02> I am drifting away with the topic :P
17:03:03euantorTake the Ada route and have a section to declare all variables for a procedure before the procedure body ;)
17:04:25*rokups quit ()
17:04:58*rokups joined #nim
17:05:06*endragor joined #nim
17:26:48*pydsigner quit (Ping timeout: 240 seconds)
17:26:58*pydsigner joined #nim
17:27:34*yglukhov joined #nim
17:32:27*yglukhov quit (Ping timeout: 260 seconds)
17:39:54*endragor quit (Remote host closed the connection)
17:41:53FromGitter<krux02> I found something in the Crystal documentation that the Nim Language could learn from: https://crystal-lang.org/docs/guides/performance.html
17:42:17FromGitter<krux02> "Don't create intermediate strings when writing to an IO"
17:42:57ieatnerdsI'm liking the read so far, thank you
17:43:22FromGitter<krux02> In nim `echo` creates an intermediate string for each argument by default.
17:43:43FromGitter<krux02> I never liked that idea a lot
17:44:38ieatnerdsare there any pros to creating an intermediate string?
17:45:48FromGitter<andreaferretti> it is conceptually simpler to create a custom stringify operator `$` for a custom type
17:46:01FromGitter<andreaferretti> rather than having to make the type interact with output
17:46:28FromGitter<andreaferretti> other than simplicity for beginners, I'd say no advantages
17:47:37FromGitter<andreaferretti> but it's a big one - you don't want to explain to someone who is just starting how to optimize and reduce string allocations just to print stuff
17:48:43ieatnerdsfair
17:53:35*gokr joined #nim
18:16:30*Arrrr quit (Quit: Leaving.)
18:28:28FromGitter<krux02> well, when the only operation to implement would be `proc format(var output: sting; obj: MyType; form: string = "")` then this function could be used to implement writing to output, writing to strings, creating new strings, and formatting numbers. Even the form argument could be used to format the numbers in a vector for example.
18:30:42subsetparkHow often are you using `echo` and optimizing for performance in the same code?
18:30:47FromGitter<krux02> `echo` could have one internal buffer string, that would be reused each time
18:31:06FromGitter<krux02> so no new allocation and no extra overload just for echo and stream operations necessary
18:31:32FromGitter<krux02> subsetpark: well to be fair not at all. But it is bugging me all the time
18:32:00Demos[m]wowah what's up with the std namespace?
18:32:02FromGitter<krux02> it's just in my head and it doesn't really matter to me
18:32:18subsetparkSounds like the work is in your head, not the stdlib :)
18:32:44FromGitter<krux02> Demos[m]: this in Nim chat not c++
18:33:14FromGitter<krux02> subsetpark: well to be fair I don't do string processing
18:33:25Yardanicokrux02: this is nim
18:33:32Yardanicosha1 is now in std "namespace"
18:33:50FromGitter<krux02> I just do graphics programming and a little output
18:33:51Demos[m]yeah
18:34:02FromGitter<krux02> sha1? what is that?
18:34:22Yardanicohttps://github.com/nim-lang/Nim/commit/70e8640244e48e8d62c5af42101c9df2b57224d9
18:34:32Yardanicorenamed securehas
18:34:53Yardanicosecurehash* It makes much more sense with this name :)
18:35:20Demos[m]also securehash is a name that's asking for trouble down the road
18:35:54Demos[m]"secure_in_2017_hash"
18:37:19*vivus joined #nim
18:37:20*sleepyqt quit (Quit: Leaving)
18:37:26FromGitter<krux02> well security is relative
18:46:17*fvs left #nim ("ERC (IRC client for Emacs 25.3.1)")
18:46:57FromGitter<mratsim> @survivorm medium, dev.to or hackernoon to post stuff for dev
18:47:06federico3krux02: securehash is opaque, securehash_md5 is explicit
18:47:59*yglukhov joined #nim
18:49:44*yglukhov quit (Read error: Connection reset by peer)
18:50:19*yglukhov joined #nim
18:58:03FromGitter<krux02> well I think just call it the algorithm's name is best
18:58:18FromGitter<krux02> calling it secure is like calling it new.
18:58:32FromGitter<krux02> At some point the adjective might become wrong
18:58:53FromGitter<krux02> but it could be is a security stuff subfolder
18:59:10FromGitter<krux02> meaning it has the goal to be used for security
19:00:10federico3krux02 indeed "crypto[graphic]hash" would be more correct than "secure". Or just the name
19:05:44FromGitter<mratsim> md5 has been hackable in seconds for years
19:23:25*vivus quit (Quit: Leaving)
19:24:01*BitPuffin quit (Remote host closed the connection)
19:26:43federico3mratsim: yep, that's why the algo name should be explicit
19:48:27*rockcavera joined #nim
19:53:18*PMunch joined #nim
20:12:03*fvs joined #nim
20:13:31fvsit it possible to pass parameters to gcc from nim compiler e.g. -pg
20:16:13dom96--passC:-pg
20:20:31*Trustable quit (Remote host closed the connection)
20:56:19FromGitter<tim-st> I wouldnt call any of these functions *secure*. afaik none of these algorithms is proven to be secure
20:56:24Araqer, the advantage is that $ for types is generally useful and so 'echo' uses that
20:57:05Araqyou can call it a "generic" solution and then your C++ brain might enjoy it
21:04:32*rokups quit (Quit: Connection closed for inactivity)
21:07:39*yglukhov quit (Ping timeout: 256 seconds)
21:12:19*yglukhov joined #nim
21:26:56*fvs left #nim ("ERC (IRC client for Emacs 25.3.1)")
21:30:29*Ven`` joined #nim
21:39:22*nsf quit (Quit: WeeChat 2.0.1)
21:42:40*miran_ quit (Quit: Konversation terminated!)
21:48:12*Ven`` quit (Ping timeout: 256 seconds)
21:56:15*solitudesf quit (Ping timeout: 260 seconds)
22:13:15*natrys quit (Quit: natrys)
22:13:32*vlad1777d joined #nim
22:15:06*Vladar quit (Quit: Leaving)
22:45:49*PMunch quit (Quit: leaving)
22:55:35*vlad1777d quit (Ping timeout: 240 seconds)
23:02:36*xet7 quit (Remote host closed the connection)
23:06:30*xet7 joined #nim
23:23:48*rockcavera quit (Ping timeout: 240 seconds)
23:25:47skrylari see you are having the SHA discussion
23:26:12skrylari had a bit of a meh until i found out SHA is actually named "secure hash" which makes it.. odd
23:26:29skrylarthere should be a github issue suggesting to rename it 'sha1' or something
23:34:07*xet7 quit (Ping timeout: 260 seconds)
23:41:17*xet7 joined #nim
23:52:13FromGitter<zetashift> damn while I wasn't looking Haxe went ahead and compiled to C: https://hashlink.haxe.org/ , wonder how it fares up against Nim