00:03:58 | * | BitPuffin joined #nim |
00:09:02 | * | pdeuchler joined #nim |
00:09:07 | * | pdeuchler quit (Client Quit) |
00:10:22 | ldlework | Araq: devel crashes my app |
00:10:30 | ldlework | SIGSEGV: Illegal storage access. (Try to compile with -d:useSysAssert -d:useGcAssert for details.) |
00:10:38 | ldlework | this is the only output after the compilation hints, etc |
00:10:49 | ldlework | Araq: its an SDL app that uses the graphics module, etc |
00:11:05 | Araq | ldlework: last time I checked we had a bug tracker |
00:11:31 | ldlework | Sure just checking if you expect anything like that to be severely broken right now |
00:11:40 | Araq | and it's called "devel" for a reason |
00:11:52 | ldlework | Araq: should I step backwards until I find a commit that works? |
00:12:08 | ldlework | Araq: right, that's why I asked, to see if you knew something about devel that would obviously cause the issue |
00:12:17 | ldlework | "oh yeah we broke X for now" |
00:12:20 | * | fungos_ quit (Remote host closed the connection) |
00:12:21 | Araq | usually it's faster to just 'koch temp' it |
00:12:29 | gmpreussner | ugh... i can never figure out how to properly pull upstream changes without making a commit to my fork on github :( |
00:12:45 | ldlework | gmpreussner: add a remote to your checkout that points to Araq's repo |
00:12:50 | gmpreussner | i did that |
00:12:55 | ldlework | then do |
00:13:01 | ldlework | git pull araq devel |
00:13:03 | ldlework | or whatever |
00:13:11 | ldlework | that should just fast forward |
00:13:11 | gmpreussner | did that, too |
00:13:14 | gmpreussner | yep |
00:13:18 | ldlework | where does the commit come into play? |
00:13:20 | gmpreussner | how to push it back up to github then? |
00:13:30 | gmpreussner | at that point i have the changes only locally |
00:13:37 | gmpreussner | i want to push them to my github fork online |
00:13:44 | ldlework | gmpreussner: with your own changes? |
00:13:46 | ldlework | ontop? |
00:13:54 | gmpreussner | well, yeah, although i don't have any local changes of my own |
00:14:13 | gmpreussner | i basically want to bring both local and github to HEAD |
00:14:15 | ldlework | then just pushing to your fork should work |
00:14:30 | gmpreussner | it does perform the push |
00:14:35 | ldlework | if you didn't add any commits, etc |
00:14:42 | ldlework | (I mean it should work even if you did) |
00:14:42 | gmpreussner | but then on the website it says that i'm X commits ahead of Araq.nim |
00:15:02 | gmpreussner | like right now i'm 2 commits ahead, even though there are no changes |
00:15:05 | ldlework | gmpreussner: those are just the commits you've added that haven't been submitted back to his fork |
00:15:16 | gmpreussner | but the commits are empty :) |
00:15:21 | gmpreussner | that's what i'm saying |
00:15:29 | gmpreussner | if i create a PR, there's nothing in it |
00:15:37 | gmpreussner | next time i do a real PR, they will go away |
00:15:52 | ldlework | gmpreussner: right force pushing to your repo |
00:15:57 | ldlework | s/right/try |
00:16:07 | gmpreussner | ok |
00:17:01 | gmpreussner | Araq: by the way, i tried this: "Try to compile with -d:useSysAssert -d:useGcAssert for details" |
00:17:05 | gmpreussner | takes five days to compile |
00:17:14 | gmpreussner | and the resulting compiler is slow as molasses |
00:17:27 | ldlework | heh woops |
00:17:34 | ldlework | I've been passing those to "nim c" |
00:17:42 | ldlework | "huh wow these don't do shit" |
00:17:42 | willwillson | isnt that what you are supposed to do? |
00:17:47 | Araq | yeah, that is a typical "last commit before release" |
00:19:06 | Araq | in retrospect it was a bad idea to add that just to teach dom96 how to debug coredumps ... |
00:19:25 | ldlework | lol |
00:19:50 | Araq | the old message was much more useful for everybody else ... |
00:20:00 | ldlework | what was it |
00:20:11 | Araq | (attempt to read from nil?) |
00:23:18 | * | hasenj joined #nim |
00:23:53 | dom96 | Araq: The message should show both things. |
00:24:19 | gokr | Idiotic question: If I have a "proc foo[T](self: Bar): T" I can call it like "foo[Bar](b)" but not like "b.foo[Bar]()". So ... the dot call doesn't fly with generic procs/methods? |
00:24:35 | dom96 | Araq: Also nobody can remember it. |
00:24:37 | Araq | gokr yes. |
00:24:48 | gokr | "yes" as "it doesn't fly"? |
00:25:07 | gokr | It seems to start thinking I am doing [] access or something. |
00:25:30 | Araq | dom96: the asserts are not useful for newcomers at all |
00:26:01 | dom96 | Araq: Then why did *you* suggest adding that message? |
00:26:16 | gmpreussner | brb |
00:26:18 | Araq | gokr. yes. known gotcha. we can fix it but I don't like it |
00:26:24 | * | gmpreussner quit (Quit: Konversation terminated!) |
00:26:27 | * | saltylicorice joined #nim |
00:26:57 | gokr | Araq: I also discovered that its hard to define abstract methods using generics like that. |
00:27:09 | Araq | I'd rather introduce [. .] for disambiguation between array access and generics |
00:27:19 | ldlework | o.o |
00:28:13 | reactormonk | Araq, starting to run out of syntax? |
00:28:44 | Triplefox | (' . ') |
00:28:50 | * | gmpreussner joined #nim |
00:28:56 | Araq | gokr: yes, but subtyping with generics sucks anyway IMO |
00:28:58 | gokr | If I have say a method foo (like described above - returning a T), and add an abstract such method in the superclass (using say discard or something as body) - then... when calling it on a thingy of the superclass type, it will complain that it can't infer the return type (although it clearly is declared as T). |
00:29:52 | reactormonk | gokr, code please |
00:29:56 | gokr | I agree that I would ... probably not design it like this - but I am porting PP and its an interesting exercise in finding corner cases. |
00:30:03 | reactormonk | PP? |
00:30:07 | gokr | PetitParser |
00:30:31 | ldlework | I'd rather have <> for generics if collision with array access is a problem |
00:30:48 | Araq | ldlework: that's worse though |
00:31:05 | ldlework | Araq: asethetically, or in terms of collisions/ambiguities |
00:31:17 | gokr | reactormonk: I gotta hit the sack, I can come back to it |
00:31:25 | reactormonk | gokr, nope, now or never! |
00:31:32 | gokr | hehe |
00:32:20 | Araq | ldlework: it requires arbitrary lookahead in the parser |
00:32:39 | Araq | and that seems to be the *easiest* way to implement it |
00:32:47 | reactormonk | Araq, § already used? ^^ |
00:32:53 | reactormonk | or ° |
00:33:14 | Araq | reactormonk: no, but the language already has [. .] as tokens |
00:33:21 | Araq | and (. .) |
00:33:38 | Araq | pragmas use {. .} for a reason |
00:33:48 | * | saltylicorice quit (Quit: leaving) |
00:34:14 | reactormonk | Araq, so now we get the bro-operator with [. .]? |
00:34:35 | Triplefox | (. .);; |
00:35:02 | reactormonk | or maybe robot-operator? |
00:35:27 | Triplefox | They are all cute tokens. Make nim the cutest language |
00:37:19 | reactormonk | Let's see how long til the first JANH comes out |
00:37:45 | reactormonk | Araq, so dots for compile-time operations? |
00:38:42 | Araq | reactormonk: no, (. .) [. .] {. .} because () [] {} doesn't cut it for any modern statically typed language |
00:40:27 | reactormonk | Araq, dot-flavoured operators, if you wanna say so. And how come three parens aren't enough? |
00:40:30 | * | vendethiel- joined #nim |
00:40:37 | * | vendethiel quit (Ping timeout: 244 seconds) |
00:40:47 | * | Etheco- quit (Read error: Connection reset by peer) |
00:41:11 | * | Etheco joined #nim |
00:46:13 | * | Sphax joined #nim |
00:46:46 | * | Sergio965 joined #nim |
01:06:01 | ldlework | I do think it would be novel if dots signified compile-time operations |
01:06:13 | ldlework | since we have so much compile-time stuff in the language |
01:12:59 | areckizb | hello, is there a pretty-print procedure in nim for printing tables, other than the standard $ ? |
01:13:45 | reactormonk | areckizb, if there's nothing in the docs, probably not |
01:16:27 | flaviu | areckizb: If you haven't come across it yet, http://nim-lang.org/theindex.html is fairly useful |
01:18:04 | * | Sergio965 quit (Ping timeout: 264 seconds) |
01:20:51 | flaviu | gmpreussner: ping: https://gist.github.com/flaviut/0bfeca0cf9bc5fe53a51 |
01:21:38 | flaviu | gmpreussner: although you probably only care about the last bullet. |
01:22:52 | * | askatasuna joined #nim |
01:24:09 | willwillson | areckizb: repr |
01:25:17 | * | askatasuna quit (Client Quit) |
01:27:57 | gmpreussner | flaviu: thanks! i think --force will make the difference. i'll try it next time |
01:32:28 | * | VinceAddons quit (Read error: Connection reset by peer) |
01:32:52 | Araq | def-: meh, the 'm' prefix was picked after some thought |
01:33:29 | Araq | as it can stand for "I intend to *m*odify it" or "mutable" |
01:34:52 | * | vendethiel- quit (Ping timeout: 245 seconds) |
01:35:05 | * | vendethiel joined #nim |
01:38:34 | * | yglukhov_____ quit (Quit: Be back later ...) |
01:40:12 | Araq | good night |
01:42:38 | * | yglukhov_____ joined #nim |
01:43:03 | * | JinShil joined #nim |
01:45:53 | * | Sphax quit (Quit: CYA!!) |
01:46:54 | * | yglukhov_____ quit (Ping timeout: 245 seconds) |
01:47:39 | * | adam_s quit (Quit: Leaving) |
01:55:35 | JinShil | First time user of Nim here. Hello. |
01:55:53 | JinShil | I'm trying to do some experiments to obtain a small binary on Linux |
01:56:02 | flaviu | Hi JinShil, welcome. |
01:57:01 | * | z1y joined #nim |
01:57:12 | JinShil | I'm compiling with --opt:speed --deadcodeElim:on but the binary is still 95K. |
01:57:31 | JinShil | equivalent C code is only 6K. |
01:57:36 | JinShil | What am I missing? |
01:57:55 | flaviu | try -d:release |
01:58:04 | flaviu | that turns off stack traces, which are quite big. |
01:58:47 | JinShil | Better. But still 58K. |
01:59:04 | flaviu | JinShil: Also, please post your code. I'd like to try it myself I can iterate faster. |
01:59:12 | JinShil | echo "Hello" |
01:59:14 | JinShil | that's it. |
01:59:17 | JinShil | Love it. |
02:04:25 | dtscode | JinShil, there are quite a few compile time checks done |
02:04:31 | dtscode | oops |
02:04:35 | dtscode | run time checks doen |
02:04:41 | dtscode | or at least, there are switches for them |
02:07:15 | flaviu | dtscode: Nope. Turning all checks off doesn't make a huge difference |
02:07:47 | dtscode | i will be quiet then |
02:08:15 | * | BitPuffin quit (Ping timeout: 244 seconds) |
02:09:35 | JinShil | Thanks faviu and dtscode. I guess I'll try to analyze the generated C code and see what I can find. |
02:13:14 | flaviu | JinShil: Ok: https://gist.github.com/flaviut/0c3c0feae6b0b609cffd |
02:13:30 | flaviu | I got it down to 12976 bytes |
02:16:13 | JinShil | not bad. |
02:16:17 | flaviu | 11024 bytes! |
02:16:36 | flaviu | It's hardly usable at that point though. |
02:17:02 | JinShil | how so? It prints "Hello" doesn't it? |
02:17:30 | flaviu | Yes, but you have to do manual memory management and most the runtime is missing. |
02:18:19 | JinShil | That's ok. The reason I'm researching this is I want to try to use nim on a bare-metal resource constrained platform. So I'm ok doing all the low level stuff. |
02:18:50 | flaviu | https://github.com/dom96/nimkernel/ might come in useful as an example. |
02:19:38 | JinShil | Thanks. |
02:20:54 | * | gsingh93 quit (Quit: Connection closed for inactivity) |
02:30:14 | JinShil | flaviu, what is the command-line switch for osstandalone? |
02:30:28 | flaviu | --os:standalone |
02:30:39 | flaviu | nim c -d:release --gc:none --os:standalone --stacktrace:off ./small.nim; strip small; wc -c small |
02:31:59 | JinShil | Thank you. |
02:32:14 | dtscode | your welcome |
02:33:47 | flaviu | No problem, but I unfortunately need to sleep now :( |
02:34:20 | JinShil | goodnight! |
02:38:01 | * | areckizb quit (Ping timeout: 246 seconds) |
03:07:19 | * | EXetoC quit (Ping timeout: 245 seconds) |
03:09:12 | * | areckizb joined #nim |
03:20:19 | * | brson quit (Quit: leaving) |
03:31:29 | * | yglukhov_____ joined #nim |
03:34:23 | * | vendethiel quit (Ping timeout: 240 seconds) |
03:34:47 | * | darkf joined #nim |
03:36:03 | * | yglukhov_____ quit (Ping timeout: 264 seconds) |
03:48:07 | * | hasenj quit (Quit: hasenj) |
03:50:37 | * | AMorpork is now known as ZzZMorpork |
03:58:01 | dtscode | as someone who is a noob with character sets, whats the difference between unicode and decode? |
04:04:45 | * | z1y quit (Remote host closed the connection) |
04:05:33 | * | z1y joined #nim |
04:31:59 | * | kapil__ joined #nim |
04:32:05 | * | johnsoft quit (Ping timeout: 244 seconds) |
04:32:58 | * | johnsoft joined #nim |
04:33:21 | * | Sergio965 joined #nim |
04:38:49 | * | jefus_ joined #nim |
04:40:01 | * | willwillson quit (Ping timeout: 255 seconds) |
04:42:53 | * | jefus quit (Ping timeout: 265 seconds) |
04:54:29 | * | Demon_Fox quit (Ping timeout: 265 seconds) |
04:55:16 | * | Demon_Fox joined #nim |
05:04:26 | * | z1y quit (Ping timeout: 264 seconds) |
05:05:01 | * | z1y joined #nim |
05:14:01 | * | z1y quit (Remote host closed the connection) |
05:14:18 | * | adam_s joined #nim |
05:14:47 | * | z1y joined #nim |
05:20:21 | * | yglukhov_____ joined #nim |
05:24:27 | * | yglukhov_____ quit (Ping timeout: 245 seconds) |
05:28:42 | Varriount | dtscode: You still there? |
05:28:56 | dtscode | maybe. whos asking? |
05:29:18 | Varriount | dtscode: Are you talking about unicode in general? |
05:29:32 | dtscode | sure |
05:29:40 | dtscode | i really wouldnt know the differnece |
05:30:59 | Varriount | dtscode: Unicode is a standard, decoding is an action. |
05:31:10 | Varriount | dtscode: This is a good article on it: http://www.joelonsoftware.com/articles/Unicode.html |
05:31:17 | dtscode | ok. thank you! |
05:31:30 | * | brson joined #nim |
05:39:05 | * | dyu joined #nim |
05:40:01 | * | yglukhov_____ joined #nim |
05:41:57 | * | Sergio965 quit (Ping timeout: 245 seconds) |
05:44:45 | * | yglukhov_____ quit (Ping timeout: 265 seconds) |
06:01:10 | * | Demon_Fox quit (Quit: Leaving) |
06:01:14 | * | z1y quit (Remote host closed the connection) |
06:01:56 | * | z1y joined #nim |
06:06:32 | * | kniteli quit (Ping timeout: 245 seconds) |
06:21:14 | * | z1y quit (Remote host closed the connection) |
06:22:08 | * | z1y joined #nim |
06:29:36 | * | Demon_Fox joined #nim |
06:51:33 | * | kapil__ quit (Quit: Connection closed for inactivity) |
06:57:46 | * | kapil__ joined #nim |
06:58:34 | reactormonk | How do I slice of the first character off a string? Via substr? |
06:58:43 | * | khmm joined #nim |
07:01:14 | * | z1y quit (Remote host closed the connection) |
07:01:29 | * | khmm quit (Remote host closed the connection) |
07:01:41 | * | khmm joined #nim |
07:02:24 | * | z1y joined #nim |
07:07:40 | * | infrashortfoo joined #nim |
07:10:17 | dv- | i guess so. |
07:10:22 | dv- | "hello".substr 1 |
07:11:55 | * | adam_s quit (Quit: Leaving) |
07:15:20 | dtscode | reactormonk, are you familiar with perl shift? |
07:16:11 | dtscode | proc shift[T](input: var seq[T]): T = result = input[0]; delete(input, 0) |
07:16:47 | dtscode | proc shift(input: var string): char = result = input[0]; delete(input, 0, 0) |
07:17:58 | * | Demon_Fox quit (Quit: Leaving) |
07:18:55 | Varriount | dtscode: Hrm.. how fast is that? |
07:19:28 | Varriount | dtscode: I mean, in Nim, doing that moves the entire string left in memory |
07:19:54 | dtscode | well ive used it in nimbus, and it works pretty fast for me |
07:19:58 | dtscode | ill show you |
07:20:31 | Varriount | dtscode: Well, just be aware that the complexity is O(n) |
07:20:32 | * | Nimbus joined #nim |
07:20:56 | dtscode | while i agree that it could be better than O(n), it could be worse |
07:21:05 | * | Demon_Fox joined #nim |
07:21:11 | dtscode | execute order66() |
07:21:11 | Nimbus | dtscode: Killing all jedi... |
07:21:12 | Nimbus | dtscode: done. |
07:21:16 | Varriount | Hello Demon_Fox! |
07:21:43 | Demon_Fox | hi |
07:22:35 | dtscode | ~2 seconds to shift, compile, grab output, split output into a seq, test its length, and send each line of the seq to the server |
07:22:38 | * | nickles joined #nim |
07:22:47 | * | saml quit (Ping timeout: 245 seconds) |
07:23:09 | Demon_Fox | By chance, does nim have classes? |
07:23:32 | Varriount | Demon_Fox: You mean, java/python-like classes? |
07:23:36 | dtscode | i dont know if you can call them classes |
07:23:42 | dtscode | since there is no self/this |
07:23:50 | reactormonk | Demon_Fox, they're less classes, more like data containers. |
07:23:58 | dtscode | its more like a c struct than anything |
07:24:03 | Demon_Fox | I was thinking on the lines of |
07:24:19 | Demon_Fox | Sets of functions meant to operate on certain structures |
07:24:26 | Demon_Fox | Like this: |
07:24:31 | reactormonk | I have two vars of type array[0..2, int] - how would you take the dot product? |
07:24:40 | Demon_Fox | structure.function_specifically_for_this(); |
07:24:55 | dtscode | Demon_Fox, so heres how you do that: |
07:24:57 | Demon_Fox | Where any structure of a different type can use that |
07:25:08 | Demon_Fox | use that name, that is |
07:25:10 | Varriount | Demon_Fox: Nim's procedure calling syntax allows that will all procedures. |
07:25:16 | dtscode | ^ |
07:25:19 | dtscode | the UFI |
07:25:20 | reactormonk | Demon_Fox, we have unified function called syntax, aka structure.function_specifically_for_this() is equivalent to function_specifically_for_this(structure) |
07:25:36 | reactormonk | and please get those unseamingly ; out of here |
07:25:58 | * | Varriount gets the broom and sweeps the ';' away |
07:26:03 | dtscode | so if i have a string class for some reason, "foo".print() and print("foo") are the same |
07:26:03 | Demon_Fox | Will it use the structure specifically for that type? |
07:26:04 | reactormonk | thank you :-) |
07:26:14 | Varriount | Demon_Fox: Yep |
07:26:22 | * | dtscode starts throwing ;'s at reactormonk, the heathen |
07:26:24 | Demon_Fox | I wish C had that feature |
07:26:36 | * | reactormonk regrets dropping op for this channel |
07:26:39 | dtscode | that fucks up the abi though |
07:26:44 | Demon_Fox | It would stop names from getting really ugly |
07:26:48 | Varriount | dtscode: Howso? |
07:27:00 | Demon_Fox | By the way |
07:27:12 | dtscode | Varriount, am i wrong? its late and i have no beer in me, so i could be wrong |
07:27:25 | reactormonk | dtscode, nah, syntax doesn't mess with ABI |
07:27:27 | Demon_Fox | Does nim have name spaces? |
07:27:37 | dtscode | reactormonk, ah ok |
07:27:38 | Varriount | Demon_Fox: Not in the way C++ has them. |
07:27:39 | reactormonk | Demon_Fox, kinda. a file is a name space. |
07:27:42 | Demon_Fox | for libs or modules or wtf they are called |
07:27:55 | dtscode | Demon_Fox, think of the module as the namespace |
07:28:02 | reactormonk | there's no nested namespace. |
07:28:13 | Varriount | (yet) |
07:28:13 | Demon_Fox | mod.function() |
07:28:20 | dtscode | theres nested modules though :} |
07:28:29 | Varriount | dtscode: Huh? |
07:28:29 | reactormonk | dtscode, like? |
07:28:30 | * | saml joined #nim |
07:28:53 | dtscode | include some_other_nim_file # this goes in the module youre importing |
07:29:12 | Varriount | Demon_Fox: Also, you can import using file paths. |
07:29:25 | Demon_Fox | intersting |
07:29:28 | Demon_Fox | interesting* |
07:30:17 | * | dtscode goes back to rewriting Nimbus |
07:30:28 | reactormonk | And we have partial case sensitivity, aka Int and int are two different identifiers, but Int and INT are the same |
07:30:47 | Demon_Fox | ok |
07:30:49 | reactormonk | Sounds wierd, but it's really helpful with e.g. parseURL vs. parseUrl |
07:30:58 | Varriount | To clarify: The first letter of an identifier is case sensitive. |
07:30:59 | Demon_Fox | So, on that name space question |
07:31:07 | reactormonk | kinda |
07:31:07 | Demon_Fox | How does it affect function names? |
07:31:11 | JinShil | Demon_Fox, I'm new to Nim. Just wrote my first program today. But I found this useful in my study to see how Nim approaches OOP: http://nim-by-example.github.io/oop/ |
07:31:15 | reactormonk | Demon_Fox, no prefixes. |
07:31:26 | dtscode | by default |
07:31:42 | Varriount | Unless you need to specify a specific procedure to remove ambiguity |
07:31:49 | dtscode | from module import nil requires you to prefix with the module name iirc |
07:32:06 | reactormonk | dtscode, well, I'm talking about no prefixes for function names like e.g. in elisp |
07:34:35 | Demon_Fox | I kind of wonder |
07:34:44 | Demon_Fox | Is there a nim compiler written in nim? |
07:34:54 | Varriount | Demon_Fox: Uh, that's what we have. |
07:35:15 | dtscode | i think thats all we have |
07:35:19 | Varriount | Technically it's a transpiler, converting Nim to C, but that's close enough. |
07:35:31 | Demon_Fox | oh |
07:35:33 | dtscode | unless the nim -> executable compiler was finished |
07:35:38 | Demon_Fox | I was going to say: |
07:35:44 | Demon_Fox | What came first, the goose of the egg? |
07:35:55 | Demon_Fox | oops, I really messed that up |
07:36:01 | Demon_Fox | The chicken or the egg. |
07:36:11 | dtscode | i think it was first written in pascal, and then they bootstrapped it in nim |
07:36:17 | Varriount | ^ |
07:36:55 | * | dtscode still doesnt know what the c sources do |
07:37:09 | Varriount | Demon_Fox: Also, something to remember - avoid using inheritance with non-ref types |
07:38:12 | Varriount | dtscode: Technically it isn't needed, if you already have access to a Nim binary built for your system. |
07:38:26 | dtscode | oh duh |
07:38:47 | dtscode | is koch written in c? |
07:38:51 | reactormonk | what's the semantics for cmp in sort again? if x is bigger than y, should the int be positive or negative? |
07:38:53 | Varriount | dtscode: Nope. |
07:39:10 | dtscode | guess im still a bit confused on it then. ill figure it out in the morning |
07:39:20 | reactormonk | dtscode, nah, it's bootstrapping code, because you need something to compile your first nim compiler |
07:39:36 | dtscode | hmmmm |
07:39:46 | reactormonk | And instead of shipping a binary, we ship sources. |
07:39:52 | Varriount | reactormonk: go to #nim-offtopic |
07:40:01 | Demon_Fox | As where with gcc, it was written in C, hand compiled, then compiled. |
07:40:15 | Varriount | .eval cmp(1, 0).echo |
07:40:19 | Mimbus | Varriount: 1 |
07:40:56 | Demon_Fox | .eval cmp(1, 2).echo |
07:40:59 | dtscode | .eval echo((1.cmp 0)) |
07:41:00 | Mimbus | Demon_Fox: -1 |
07:41:02 | Mimbus | dtscode: eval.nim(3, 13) Error: ')' expected |
07:41:11 | dtscode | is echo built in? |
07:41:41 | Varriount | If you want to use the bot often, use it in #nim-offtopic , that way you won't clutter up the chat here. |
07:41:45 | Varriount | dtscode: Nope. |
07:41:59 | dtscode | why does it not need () then? |
07:42:17 | reactormonk | Varriount, I'll just use stock cmp |
07:42:27 | Varriount | dtscode: Unified calling syntax |
07:42:53 | Demon_Fox | did not know there was a bot |
07:43:09 | reactormonk | Demon_Fox, neither did I |
07:43:15 | Demon_Fox | I thought someone was being a smart***. |
07:43:19 | Demon_Fox | Guess I was wrong. |
07:44:33 | * | infrashortfoo quit (Remote host closed the connection) |
07:45:44 | Varriount | It's handy when testing out short code snippets, or when on mobile. |
07:46:21 | dtscode | .eval proc print(foo: string)= echo(foo); "test".print |
07:46:24 | Mimbus | dtscode: test |
07:47:07 | Demon_Fox | (This is why the terminator turned into a killer) |
07:47:14 | Demon_Fox | He was abused as a young IRC bot. |
07:47:37 | Varriount | Hah! But we cherish our Mimbus bot. |
07:47:49 | * | Varriount pets Mimbus |
07:52:18 | Varriount | Demon_Fox: I found you: http://tinyurl.com/n4y7n66 |
07:52:43 | * | brson quit (Ping timeout: 256 seconds) |
07:53:11 | Demon_Fox | lmfao |
07:58:11 | * | infrashortfoo joined #nim |
07:58:22 | * | gour joined #nim |
07:58:41 | * | infrashortfoo quit (Remote host closed the connection) |
07:58:48 | Demon_Fox | interesting |
07:58:50 | reactormonk | Varriount, hey, my image shows up pretty high on the google search for "reactormonk" |
07:58:55 | * | infrashortfoo joined #nim |
07:59:07 | reactormonk | well, image search. |
07:59:40 | ekarlso- | should one support uploading packages like tarballs ? |
07:59:48 | reactormonk | ekarlso-, where? |
08:00:09 | ekarlso- | packages.nim-lang.org ish in the future ;) |
08:00:45 | reactormonk | ekarlso-, hm, I'd go for git tags maybe |
08:01:03 | ekarlso- | reactormonk: it allows u to register that too atm |
08:01:15 | reactormonk | ekarlso-, ok, then tarballs are a good alternative |
08:01:16 | Demon_Fox | This is more like it (minus the naruto undertone): http://tinyurl.com/mkyr6wq |
08:01:29 | reactormonk | Demon_Fox, undertone? Overtone. |
08:01:45 | ekarlso- | POST /packages {"name": "mysql", "releases": [{"version": "0.0.1"}]} |
08:01:47 | ekarlso- | ish |
08:01:57 | ekarlso- | ehm, that's not a full example |
08:03:01 | reactormonk | I have seq[seq[int]], how do I ask if the inner seq has been initialized? |
08:03:09 | Demon_Fox | reactormonk, My bad |
08:03:58 | reactormonk | ah, isNil should o |
08:07:00 | * | MrOrdinaire joined #nim |
08:07:59 | MrOrdinaire | I'm trying to solve issue #1832 |
08:08:29 | * | nande quit (Remote host closed the connection) |
08:08:36 | Varriount | MrOrdinaire: Solve, or work around? |
08:08:45 | MrOrdinaire | Varriount: solve |
08:09:32 | reactormonk | why doesn't orderedTable have first? |
08:09:38 | MrOrdinaire | I've traced the code to compiler/ccgexprs.nim:1024 |
08:09:49 | MrOrdinaire | which is proc genSeqElemAppend |
08:10:29 | dtscode | anyone familiar with the asyncet module that i can talk to? |
08:11:02 | Varriount | dtscode: dom96 is the author of the module, but I may be able to help. |
08:11:26 | dtscode | Varriount, ok, firstly, what does the await keyword do? |
08:13:38 | reactormonk | Why is it possible to get an out of bounds error with a seq? |
08:14:02 | Varriount | dtscode: It's used to wait on the return value of a future. |
08:14:16 | Varriount | At least, in context of asyncio |
08:14:17 | MrOrdinaire | is getTemp the right call to put a temporary variable on the stack? |
08:14:32 | dtscode | Varriount, whats a future? |
08:15:10 | Varriount | MrOrdinaire: Unfortunately, I don't know off the top of my head. Araq is the main developer with regards to the compiler, and he's currently asleep. |
08:15:51 | MrOrdinaire | Varriount: when is he usually on IRC? |
08:16:06 | Varriount | MrOrdinaire: I do ask that, for any compiler procedures you touch, please add documentation and comments, so that others don't have to work their way through the compiler blind. |
08:16:20 | Varriount | MrOrdinaire: In about... 3-6 hours, ussually. |
08:16:37 | MrOrdinaire | Varriount: thanks |
08:16:41 | MrOrdinaire | Varriount: will do |
08:17:06 | Varriount | MrOrdinaire: Unfortunately, the compiler isn't as well-documented as the standard library. |
08:17:30 | Varriount | dtscode: A future is a yet-to-arrive value. |
08:17:51 | dtscode | hrrmm... ok. so its not an actual type in this context? |
08:18:05 | Varriount | dtscode: In context of asyncronous processing, a future is a temporary data structure that can be passed around and used in place of an actual result that has yet to come. |
08:18:22 | dtscode | ah |
08:19:43 | Varriount | dtscode: Say I call a read operation that returns a future that will (eventually) contain a string. The read operation may block behind the scenes, but using a future, the read procedure can immediately return with the future as the return value, and other procedures just pass around the future until the string is actually needed. |
08:20:28 | Varriount | dtscode: `await` is also used in threaded code to achieve a similar result. |
08:20:48 | dtscode | oh, ok. that makes sense. so await essientially turns on blocking for that one proc? |
08:21:48 | Varriount | dtscode: Sorta. |
08:22:04 | Varriount | dtscode: Read http://nim-lang.org/asyncdispatch.html carefully. |
08:22:12 | dtscode | ok |
08:22:44 | * | Sphax joined #nim |
08:23:00 | dtscode | since you said to read carefully: |
08:23:03 | dtscode | > async macro which allows asynchronous code to be written in a synchronous style with the await keyword. |
08:23:31 | dtscode | does this mean its still async code that looks sync? or its async code acting as sync? |
08:23:46 | dtscode | my guess is the former, but i just want to make sure] |
08:24:35 | Varriount | dtscode: The former |
08:24:58 | dtscode | awesome. thanks Varriount :) youre being a real life saver |
08:25:22 | Varriount | dtscode: The funny thing is, I haven't used the async* modules |
08:25:38 | Varriount | Well, I have one time, but that was to interface with it. |
08:25:55 | dtscode | o rly? you just have experience with async in general? |
08:26:20 | Varriount | dtscode: Yeah, I've used Python's Twisted web framework. It works on similar principles. |
08:26:34 | dtscode | oh well thats good to know at least |
08:27:04 | Varriount | dtscode: Whats funny (and kinda sad) is that I don't actually touch/write much Nim code... I'm more of a helper. |
08:27:12 | Varriount | :/ |
08:27:15 | dtscode | what do you mean? |
08:27:59 | Varriount | dtscode: I help people on IRC, answer questions on the forum, etc. |
08:28:27 | dtscode | ah. is there any reason you dont write nim code, or is that you just dont have the time? |
08:29:32 | Varriount | dtscode: Mostly time, somewhat inclination. |
08:29:56 | Varriount | dtscode: I'm either at work, working, or at home, sleeping/excercising |
08:30:10 | Varriount | Oh, or eating. |
08:30:15 | dtscode | :/ yeah that is a shame. i really rather like nim. |
08:30:59 | dtscode | see, my schedule is mostly like yours, except i did the smart thing and gave up excercising in exchange for writing nim code |
08:31:15 | dtscode | or rather, code in general |
08:31:43 | Varriount | dtscode: My family has a history of bad health. If I don't excersize, I stay up at night, worrying about heart attacks. |
08:31:54 | Varriount | *exercise |
08:31:59 | dtscode | im just hearing excuses |
08:32:12 | Varriount | :P |
08:32:22 | dtscode | hehe. i kid, i kid |
08:32:29 | Varriount | Now if only I could code while running on the treadmill... |
08:32:40 | dtscode | dragon?' |
08:32:47 | Varriount | Huh? |
08:32:57 | dtscode | the dictation software |
08:33:04 | dtscode | brb, chores |
08:33:08 | Varriount | I don't know if that would work too well. |
08:33:41 | dtscode | *note to self* tell dom96 he needs to write dictation software specifically for nim |
08:34:06 | Varriount | dtscode: Although, it is a thought. |
08:34:12 | * | MightyJoe quit (Ping timeout: 244 seconds) |
08:34:31 | * | BlaXpirit joined #nim |
08:34:39 | ekarlso- | how does one do a list comprehension ? |
08:34:43 | ekarlso- | in nim |
08:35:05 | ekarlso- | I have a seq of objects but I want to make a new seq out of a field out of all the objects |
08:35:24 | dtscode | i remember when i was in high school, i would write long parsers of all sorts on graph paper, and somehow find more bugs in them than when i went home and rewrote it. those were good days :} i was smarter and wrote much better code |
08:36:12 | Varriount | ekarlso-: 'for i in seqOfObjects: seqOfFields.add(i.field)` |
08:36:39 | ekarlso- | Varriount: but u can't do like |
08:36:42 | Varriount | ekarlso-: Nim doesn't have native list comprehensions, however there is a list comprehension in a macro in the 'future' library |
08:36:51 | * | MightyJoe joined #nim |
08:37:12 | ekarlso- | let mySeq = [i.fieldName for i in oldSeq] ? |
08:37:14 | ekarlso- | boo |
08:37:16 | Varriount | ekarlso-: It would be nice to have native ones, possibly something python-like, but... *shrug* |
08:38:53 | Varriount | ekarlso-: Unfortunately, there are far more important issues that need to be worked on. |
08:39:17 | Varriount | dtscode: Actually, I forgot, I am working on a filepath library in my spare time at work. |
08:40:00 | Varriount | dtscode: Strings as filepaths are ok, except when you need to calculate paths on one platform for another platform. |
08:44:05 | lyro | Hi, a have a problem. The following code crashes with 'Stack overflow' in nim 0.10.2 when compiling with 'nim c test.nim' and run with './test': http://pastie.org/private/0jk2gilb4nslmcg7nskd6w |
08:44:17 | lyro | is this a bug? |
08:45:17 | lyro | it's a simple doubly linked list which seems the cause problems in the gc |
08:45:25 | * | MightyJoe quit (Ping timeout: 264 seconds) |
08:45:28 | Varriount | lyro: I'm assuming you get a stacktrace? |
08:45:54 | Varriount | lyro: And what version of the compiler are you using? Latest stable, or development version? |
08:45:58 | lyro | a lot of lines with 'gc.nim(xxx)' |
08:46:05 | lyro | 0.10.2 |
08:46:18 | Varriount | lyro: Hm, interesting. |
08:48:00 | * | Varriount|Mobile joined #nim |
08:48:32 | Varriount|Mobile | lyro: Does it happen when the 10000 is decreased? |
08:49:35 | Varriount|Mobile | I'm not intimately familiar with the garbage collection internals, but I think I remember it using some sort of stack walking mechanism. |
08:50:09 | Varriount|Mobile | lyro: Oh, does this happen with the compiler, or the program? |
08:50:29 | * | MightyJoe joined #nim |
08:55:15 | * | SplinterOfChaos quit (Ping timeout: 264 seconds) |
08:56:23 | lyro | the program |
08:56:43 | lyro | when the 10000 is decreased then everything works |
08:57:13 | Varriount | lyro: Hm, probably a GC issue then. Could you file an issue on github? |
08:57:28 | lyro | sure |
08:58:52 | * | yglukhov_____ joined #nim |
08:59:21 | dtscode | Varriount|Mobile, interesting. is it going to be part of the stdlib? |
09:02:35 | * | yglukhov_____ quit (Client Quit) |
09:03:35 | * | JinShil quit (Quit: Konversation terminated!) |
09:03:45 | Varriount | dtscode: *shrug* |
09:04:04 | dtscode | ive been thinking of writing an ncurses wrapper |
09:04:04 | Varriount | lyro: Mention that it only happens with debug features enabled, not in release mode. |
09:04:23 | * | MightyJoe quit (Ping timeout: 240 seconds) |
09:04:37 | Varriount | *sigh*, relying on compiler optimization to optimize recursive procedures is a big no-no |
09:04:56 | dtscode | o rly? why is that? |
09:05:18 | dtscode | i would imagine that would be the place to do that, but im very new to the field of compilers |
09:05:38 | Varriount | dtscode: Because there's no guarantee that the compiler will always optimize the recursion away. |
09:06:41 | Varriount | dtscode: I'm guessing that the extra debug information is causing the C compiler lyro is using to not optimize away a recusive path in Nim's GC code. |
09:07:27 | Varriount | dtscode: Of course, there are some areas where recursion is suited, such as traversing an AST, however you need to expect how nested such procedures will be. |
09:09:03 | lyro | of course, but the point is that my code is not recursive (the gc code may be) and 10000 is not very large for a list |
09:09:46 | * | MightyJoe joined #nim |
09:10:09 | lyro | is it possible to compile the gc code in release mode but everything else in debug mode (as a temporary workaround)? |
09:10:43 | Varriount | lyro: Possibly, but that's taking the more convoluted route, I think. |
09:11:25 | Varriount | lyro: You can add a compiler flag to GCC to tell it to perform optimizations (assuming you're using gcc) |
09:11:51 | Varriount | lyro: You can also compile in release mode, and turn on debug flags |
09:12:47 | * | gokr quit (Ping timeout: 245 seconds) |
09:12:52 | Varriount | lyro: For example, I commonly compile the Nim compiler using the flags "-d:release --stacktrace:on --linetrace:on" |
09:13:08 | * | skyfex_ joined #nim |
09:13:12 | Varriount | You can add '--checks:on' for runtime checks. |
09:15:01 | * | skyfex quit (Ping timeout: 244 seconds) |
09:15:55 | * | gokr joined #nim |
09:16:02 | Varriount | Which.. hrm, is not much help when '-stacktrace:on' causes the recursion bug to appear. |
09:16:46 | Varriount | lyro: It's also possible to compile the runtime library as a dll, and have the program use that, but that option isn't tested often. |
09:17:51 | Varriount | lyro: On the other hand, if you want, it shouldn't be too hard to fix the recursion bug, depending on where it is in the gc code. Manually unrolling recursion is tedious, but not too hard. |
09:20:21 | * | vendethiel joined #nim |
09:21:15 | * | z1y quit (Remote host closed the connection) |
09:22:15 | * | z1y joined #nim |
09:22:49 | Varriount | lyro: Could you give me a gist/pastebin of as much of the stacktrace as possible? |
09:23:03 | ekarlso- | does nim let you do something like .iter().map(|foo| {}) in rust ? |
09:23:16 | Varriount | ekarlso-: What does that do in rust? |
09:23:23 | Araq | MrOrdinaire: what's the problem? |
09:24:20 | Varriount | Araq: He wants to know what getTemp does in the compiler. |
09:24:41 | ekarlso- | Varriount: takes a seq and iterates over each element |
09:24:45 | Araq | lyro, Varriount making the GC non-recursive is some work. you have to disable stack traces for now |
09:24:54 | ekarlso- | so within {} is a code block |
09:25:17 | Araq | ekarlso-: map, mapIt etc. anon procs etc. learn how to read |
09:25:31 | Araq | do your homework. |
09:25:37 | ekarlso- | Araq: be nice :/ |
09:26:26 | Triplefox | we don't all know rust here so direct comparison like that is kind of...putting a burden on the answerer |
09:26:54 | Araq | you always ask about Rust vs Nim and yet seem to use neither and only read some news articles |
09:27:23 | Triplefox | language window shopping :3 |
09:29:01 | Varriount | Araq: I don't seem to recall ekarlso- asking too many questions... |
09:29:26 | lyro | Varriount: I put the backtrace in the issue on github (the lines repeat over and over again) |
09:30:00 | * | gsingh93 joined #nim |
09:30:49 | gokr | ekarlso-: You can read my article on seq |
09:31:05 | gokr | It tries to cover "most" of seq behaviors |
09:31:23 | reactormonk | muh, hit https://github.com/Araq/Nim/issues/1741 again. I guess I should implement it. |
09:31:53 | Araq | Varriount it creates a temporary variable in the C code for further usage |
09:33:08 | reactormonk | Where does the mitems come from btw, iterator which passes var? I can't find it anymore in the index. |
09:33:24 | MrOrdinaire | Araq: i have `var tmp:TLoc; getTemp(p, b.t, tmp)` |
09:33:34 | MrOrdinaire | Araq: and then genAssignment(p, tmp, b, {}) |
09:33:57 | MrOrdinaire | but it seems `getTemp` does not fill `tmp.r` |
09:34:47 | MrOrdinaire | so when genAssignment calls rdLoc, it's empty, generating something like ` = value;` which throws off GCC |
09:35:49 | Araq | well my getTemp is in cgen.nim:403 and sets 'result.r' |
09:36:55 | dtscode | Varriount, sorry, was doing dishes. im back now. and ok. that makes sense |
09:37:45 | Varriount | Perhaps there is a field in 'tmp' that needs to be assigned to? |
09:40:15 | MrOrdinaire | Varriount: I guess, but I don't know which |
09:40:36 | MrOrdinaire | here's the diff of what I'm trying to do |
09:40:38 | MrOrdinaire | http://pastebin.com/cw1Srt7S |
09:41:40 | MrOrdinaire | the full code http://pastebin.com/wCyqB7Kd |
09:41:50 | Varriount | MrOrdinaire: Maybe initLocExpr? |
09:43:15 | * | Varriount|Mobile quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )) |
09:43:34 | * | vendethiel quit (Ping timeout: 245 seconds) |
09:45:39 | Araq | MrOrdinaire: strange, your code looks correct. but you can echo "TEMP ", tmp.r.ropeToString |
09:46:18 | MrOrdinaire | Araq: checking that |
09:47:21 | MrOrdinaire | I see ropeToStr but not ropeToString, using that instead |
09:47:30 | Araq | lol |
09:47:50 | Araq | that should be $ anyway |
09:51:12 | dtscode | i just found out about rope. it looks awesome |
09:51:13 | MrOrdinaire | I'm using `./koch boot -d:release --parallelBuild:1` and the output does not contain TEMP |
09:51:58 | Araq | that's not how we work here |
09:52:38 | Araq | use './koch temp c fileThatTriggersBug.nim' |
09:52:56 | Araq | don't bootstrap for the initial bugfix, that's crazy |
09:52:57 | MrOrdinaire | Araq: thanks |
09:53:06 | MrOrdinaire | okay |
09:53:50 | Araq | but yeah, you should check bootstrapping still works after you fixed the bug |
09:58:34 | * | VinceAddons joined #nim |
10:01:31 | reactormonk | What's the correct way to output a few variabels inside a string? "score(" & $juggler.id & ", " & $course.id, & ", " & $course.score & ")" apparently isn't |
10:01:56 | reactormonk | oh, wait, I got a "," over |
10:03:10 | * | AndroUser2 joined #nim |
10:03:42 | MrOrdinaire | Araq: you're right. It messed up with everything and now I can't compile normally anymore. Recloning everything... |
10:04:18 | Araq | I dunno how you managed to do that. 'koch boot' is a transaction |
10:04:33 | Araq | if it fails the old nim binary is not touched |
10:05:17 | MrOrdinaire | does it share nimcache between runs? |
10:05:29 | * | bjz joined #nim |
10:05:44 | Araq | yes |
10:06:01 | MrOrdinaire | my code touches the C code gen |
10:06:02 | * | bjz quit (Read error: Connection reset by peer) |
10:06:09 | Araq | but that's irrelevant. the nim binary doesn't depend on nimcache, it's a binary |
10:06:09 | MrOrdinaire | that might be the cause? |
10:06:12 | ekarlso- | var newTags: seq[Tag] = pkg.tags.map(proc(t: string): Tag = getOrCreateTag(conn, t)) < that was what I wanted to do ish |
10:06:30 | * | ekarlso- hails to Araq for slapping himself |
10:06:30 | gokr | Idiotic question #347: In Java I can have a var being of type "Object" and thus hold both domain objects or an ArrayList of such. What would a Nimmer do in Nim? |
10:06:36 | ekarlso- | slapping me that is :9 |
10:06:43 | * | bjz joined #nim |
10:06:54 | reactormonk | gokr, >:) |
10:07:17 | gokr | Come again? |
10:07:25 | reactormonk | that's an evil smilie. |
10:07:30 | Varriount | gokr: Well, first, the object has to be a ref type |
10:07:38 | Araq | ekarlso-: sorry for my grumpiness |
10:07:46 | ekarlso- | Araq: hah :p |
10:08:04 | Varriount | gokr: Then you just have the sequence hold RootRef instances |
10:08:23 | gokr | Varriount: I know that, but... a *var* that can hold both. |
10:08:39 | ekarlso- | is there a reason why getRow returns a row with empty strings vs a nil ? |
10:08:42 | ekarlso- | when there's no hit |
10:08:48 | Varriount | gokr: Have the var be of type RootRef? |
10:08:51 | gokr | In java I can have an instance var of type "Object". It can then hold either an ArrayList or a Banana. |
10:09:05 | gokr | But then it can't hold a seq, right? |
10:09:24 | Varriount | gokr: It should be able to hold a sequence... |
10:09:27 | gokr | Oh |
10:09:38 | Araq | right, you have to wrap the seq in some SeqObject |
10:09:45 | Varriount | Oh. |
10:09:51 | gokr | Good, was close to a face palm there. |
10:10:03 | Araq | you can 'cast' but this is not wise |
10:10:22 | Varriount | I guess this is because seq is one of the core types? |
10:10:22 | gokr | Araq: This is the issue I was kinda gunning for the other day when I was asking about "equiv of Java Object". |
10:10:37 | gokr | RootRef is not as wide a net as Object in Java. |
10:10:45 | BlaXpirit | list comprehensions can be made in a macro? miraculous. |
10:10:58 | gokr | Ok, packing up and going to ice rink, later |
10:11:07 | * | gokr quit (Quit: Leaving.) |
10:11:12 | MrOrdinaire | Araq: I get "compiler/ccgexprs.nim(14, 34) Error: undeclared identifier: 'PRope'" when running `./koch temp c compiler/ccgexprs.nim` |
10:11:14 | * | AndroUser2 quit (Remote host closed the connection) |
10:11:28 | * | AndroUser2 joined #nim |
10:11:48 | Varriount | MrOrdinaire: That's because many of the compiler files are `include`ed into a central file. |
10:11:58 | Varriount | And thus share the same namespace. |
10:12:06 | Araq | MrOrdinaire: fileThatTriggersTheBug is usally some small file that triggers the bug |
10:12:34 | MrOrdinaire | so not the file i'm modifying |
10:12:36 | MrOrdinaire | okay |
10:13:28 | Araq | you're working on https://github.com/Araq/Nim/issues/1832 right? |
10:13:39 | MrOrdinaire | yes |
10:13:39 | * | irrequietus joined #nim |
10:13:43 | ekarlso- | is there a efficient way to check if getRow actually returns something useful except checking each column in the returned row ? |
10:13:47 | Araq | so create a file with that content |
10:14:28 | nickles | Araq: (I) Returning to yesterday's static table question: In the manuals you write about the "syntactic sugar" notation for table constructors. |
10:14:35 | ekarlso- | smth like row.isLoaded or smth |
10:14:35 | Araq | ekarlso-: as I said the db_ modules need an overhaul, but if your data model has different semantics for NULL and "" it is broken |
10:14:38 | nickles | Araq: (II) This notation suggests, that using it you create a table; actually, the table is created only after a call to toTable() on that referred array. |
10:14:45 | nickles | Araq: (III) So - from my point of view - the sole purpose of the table notation is for it to be used with toTable()... |
10:14:51 | nickles | Araq: (IV) Wouldn't it be nicer then (also when it comes to evangelizing Nim) to implicate that call, resulting in a) a true table notation, and b) a way to have static, i.e. compile time tables? |
10:15:00 | nickles | Araq: (V) Right now big tables need to be created a run-time, probably consuming more time than necessary (as compared with static hashes/tables) on each run (think e.g. of a dir/ls implementation mapping extensions to colors). |
10:15:59 | Araq | nickles: but it's not obvious if you want toTable or toOrderedTable |
10:16:17 | Araq | which is why came up with the current design |
10:16:21 | * | gokr joined #nim |
10:16:24 | ekarlso- | Araq: no the question here is more like, SELECT * FROM tbl WHERE id = ? and if there's no hit it will return a row with all the columns "", what way to check if there was a hit or not ? |
10:16:54 | Araq | ekarlso-: it returns no row at all then? |
10:17:15 | nickles | Araq: I think, for most use cases (and if I look at other implementations) the unordered thingy would suffice. I could live with it |
10:17:24 | MrOrdinaire | Araq: it works |
10:17:26 | ekarlso- | Araq: retrieves a single row. If the query doesn't return any rows, this proc will return a TRow with empty strings < doc for that method |
10:17:34 | Araq | nickles: when you do the toTable too early the order is gone |
10:17:36 | ekarlso- | so it returns a TRow with all cols as "" |
10:17:48 | Araq | ekarlso-: ok, use some other proc then |
10:18:20 | Araq | but usually id cannot reasonably be "" so you can check that field |
10:18:37 | ekarlso- | Araq: yeah, i'll do that fow now ;P |
10:18:43 | * | yglukhov_____ joined #nim |
10:19:16 | * | gokr_ quit (Ping timeout: 264 seconds) |
10:19:18 | nickles | No need for any order, just lookup some static values is often required. |
10:20:21 | Araq | nickles: I disagree. Often 'dict' is picked without any thought and then later people regret it, for instance when generating some config file |
10:20:48 | Araq | where the order doesn't matter either but surely is convenient for the poor human being that likes to read the file |
10:22:02 | nickles | ;-) True but that doesn't invalidate the use case I mentioned, big static arrays a run-time... |
10:23:05 | * | repax joined #nim |
10:23:07 | Araq | .toTable will be available at compile time eventually |
10:23:27 | Araq | your use case doesn't argue for a syntax shortcut |
10:24:51 | nickles | I'm not so interested in a shortcut (though having one would be nice, especially when it comes to boasting with it), but in minimizing possible runtime overhead. |
10:25:31 | nickles | The guys in the D forums are heavily struggling with that ... |
10:27:09 | repax | How does D's ctfe compare to nim's? |
10:27:48 | * | minciue quit (Quit: minciue) |
10:29:09 | nickles | D has a hash notation for use in procedures => run-time. Globally they need static this() => also runtime. |
10:30:00 | Varriount | repax, nickles: Well, theoretically, any code which doesn't depend on outside OS procedures should work. Practically, the VM isn't perfect. |
10:31:23 | repax | I like the fact that files can be accessed at compile-time |
10:31:58 | Varriount | repax: Well yes, there are some interfaces to work with the outside environment, but not an entire one. |
10:32:11 | MrOrdinaire | Araq: what does needToCopy and afDestIsNil mean? |
10:32:54 | repax | Varriount, it's a useful one for parsing source that may not be "code" but perhaps some data format |
10:33:07 | nickles | Don't get me wrong. I don't criticize Nim. In fact, right now it's my #1 candidate for converting some of my C programs to a more sophisticated language. However nowadays tables (dicts) are so overly present that I would seem a shame not to have a static implementation in Nim. |
10:33:36 | nickles | I = it |
10:33:49 | repax | nickles, would it be difficult to implement, you think? |
10:34:17 | Varriount | nickles: As has been said, the only reason static tables don't work correctly is due to bugs. |
10:34:26 | repax | I see |
10:34:54 | nickles | repax: I don't know. But I guess it's absolutely possible. The data you throw in is static, and the algorithm is static... |
10:35:02 | Araq | Varriount: no, it's because you cannot have 'object' as a 'const'. that's not a bug, that's just not supported for now. |
10:35:14 | Varriount | nickles: Please know that there are many, many aspects of the language that need development, however the development team is small (about 4 people), and not all of us have the expertise to work with the compiler code. |
10:35:32 | Araq | I expect it to work out of the box once that feature is supported |
10:36:00 | nickles | Araq: Pardon, which feature? |
10:36:07 | repax | For a newb, what corner of the compiler is most accessible? |
10:36:16 | Varriount | repax: The parser |
10:36:21 | Araq | nickles: const foo = SomeObject(x: 1) |
10:36:58 | Varriount | repax: Technically, the compiler contains at least two parsers. It uses one for the Nim language, and one or two others for config files. |
10:37:45 | repax | I am going to try to familiarise myself with some corner |
10:38:10 | Varriount | repax: Make sure to document anything lacking needed documentation. |
10:38:11 | repax | So I'll look at the one of the parsers then |
10:38:34 | * | bjz quit (Read error: Connection reset by peer) |
10:38:37 | nickles | Araq: Have you already some time frame in mind/intention to implement that? |
10:38:42 | ekarlso- | when doing obj in objs is there a way I can make the hash a field of the obj ? |
10:38:53 | repax | Varriount, in source comments? |
10:38:58 | Varriount | repax: Yes. |
10:39:06 | repax | Right |
10:39:21 | Varriount | repax: Not every procedure needs documentation, just ones that... need it. |
10:39:30 | repax | Of course |
10:39:45 | repax | Some project wants less coments, some more |
10:40:18 | Araq | repax: read our internal docs. they suck but they tell you to read ast.nim first and that's still a good entry point |
10:40:27 | repax | Linux for example despises comments |
10:40:32 | nickles | Araq: It would also be nice for saving/restoring objects... |
10:40:51 | repax | Araq, thanks |
10:41:41 | Araq | they also tell you how to debug things in the compiler |
10:43:44 | MrOrdinaire | Araq: what does needToCopy and afDestIsNil mean? |
10:44:26 | Araq | MrOrdinaire: usually the codegen doesn't emit a full copy as it's unnecessary. needToCopy tells it it's really required. |
10:44:36 | * | gokr1 joined #nim |
10:44:41 | Araq | afDestIsNil means that you know that the destination loc is nil |
10:45:03 | Araq | this can be used to generate a faster write barrier but currently isn't used |
10:45:12 | MrOrdinaire | I see |
10:45:33 | MrOrdinaire | so for my code, it needs both flags, right? |
10:45:58 | Araq | you don't want needToCopy |
10:46:18 | Araq | if your code requires it, it's broken |
10:46:30 | Varriount | Araq: Howso? |
10:46:54 | Araq | Varriount: performance will suck and we lose benchmarks |
10:47:26 | Varriount | Oh! I thought needToCopy was a procedure, not a flag. Silly me. |
10:47:29 | * | bjz joined #nim |
10:49:18 | * | vendethiel joined #nim |
10:51:31 | MrOrdinaire | Araq: pushed and made a PR |
10:52:28 | Varriount | MrOrdinaire: Could you explain what the fix does? |
10:52:41 | MrOrdinaire | Varriount: it's in the PR |
10:53:03 | ekarlso- | meh, how can u solve a problem like bar = {"foo": 1} if "foo" in bar in nim ? |
10:53:59 | * | gokr quit (Ping timeout: 245 seconds) |
10:54:14 | ekarlso- | i've tried using a obj with a hash on the name field but doesn't seem to work :/ |
10:55:54 | Varriount | ekarlso-: Are you using a table, or just the sequence that the {} constructs? |
10:56:35 | ekarlso- | Varriount: I was using a set atm and a hash proc on the object |
10:56:36 | Varriount | MrOrdinaire: I guess I'm just concerned about the copying, since that effects every sequence construct... |
10:58:38 | Varriount | MrOrdinaire: Looking at the issue, it seems as if a better idea would be to grab s.high and store that in a temp variable. |
10:58:56 | Varriount | But that's specific to that case... |
10:59:19 | MrOrdinaire | Varriount: we can try to be clever and emit the copy only when the code has that template |
10:59:37 | MrOrdinaire | but that will only fix that case... |
11:00:46 | Varriount | MrOrdinaire: Yeah... I guess we should just hope that the backend eliminates the copy. |
11:00:58 | MrOrdinaire | yup |
11:01:31 | Varriount | Oh well. |
11:01:45 | Varriount | MrOrdinaire: Thanks very much for the help. |
11:03:00 | MrOrdinaire | Varriount: thanks :) |
11:04:21 | Araq | well what kind of copy does the codegen end up with? |
11:05:21 | Varriount | Araq: What do you mean? |
11:09:56 | MrOrdinaire | Araq: http://pastebin.com/XDZEaudx |
11:10:16 | MrOrdinaire | for the program included in the issue |
11:11:02 | * | vendethiel quit (Ping timeout: 264 seconds) |
11:11:07 | * | bjz quit (Ping timeout: 245 seconds) |
11:14:20 | ekarlso- | is it possible with a closure in nim to place a whole function block inside it ? |
11:14:35 | ekarlso- | like in rust |foo| {} you can place code inside the {} |
11:14:58 | Varriount | ekarlso-: You mean, put a closure in a closure? Or put a closure in a procedure call? |
11:15:50 | * | vendethiel joined #nim |
11:15:55 | Varriount | Hi vendethiel |
11:16:21 | * | gour_ joined #nim |
11:17:15 | ekarlso- | Varriount: I'm taking a wild guess that i'm approaching the problem wrongly but: https://bpaste.net/show/815a0985cd03 |
11:17:18 | ekarlso- | that example is bork |
11:18:15 | * | z1y quit (Ping timeout: 265 seconds) |
11:18:15 | ekarlso- | in python I could do something like a dict with the tag name as key and the tag as value but |
11:18:36 | Varriount | ekarlso-: Lemme see if I can make it work. |
11:19:49 | * | gour quit (Ping timeout: 245 seconds) |
11:19:54 | * | Demon_Fox quit (Quit: Leaving) |
11:20:29 | ekarlso- | Varriount: something in rust that does the same https://github.com/rust-lang/crates.io/blob/master/src/keyword.rs#L83-L85 seems to use a map with a closure where the result is a HashMap with the name as the key and the value the object |
11:21:24 | Varriount | ekarlso-: The only thing wrong in your example is that a uint can't be converted to a string via that syntax |
11:22:10 | ekarlso- | would be uber kinda if you could place a small function block in a nim closure |
11:22:25 | Varriount | ekarlso-: Still don |
11:22:53 | Varriount | I still don't get what you mean. A closure is a procedure |
11:23:45 | ekarlso- | hmmm lemme try again |
11:23:59 | ekarlso- | Varriount: but stringtable works only with strings as values no ? |
11:28:19 | Varriount | ekarlso-: https://bpaste.net/show/d283ca75a65a |
11:28:48 | ekarlso- | Varriount: ah, I tried var tagTable = newStringTable(tags.map((i: string) => (i, let i = create(i); $i.id)), modeCaseInsensitive) |
11:30:59 | Varriount | ekarlso-: Also, remember that 7.string won't work, because using a type like that is for conversion, when the type can be safely cast to another type. |
11:31:21 | * | Mimbus quit (Excess Flood) |
11:31:27 | * | Mimbus joined #nim |
11:32:46 | * | JinShil joined #nim |
11:34:47 | Varriount | Hi JinShil |
11:35:05 | ekarlso- | Varriount: too bad u can't do stuff like tags.map((s: string) => (let i = create(s); s; i.name)) ish |
11:35:23 | JinShil | Hi Varriout |
11:35:30 | ekarlso- | rust basically let's you declare a variable using the "let" inside the closure block |
11:35:36 | JinShil | with an 'n' |
11:36:47 | * | vendethiel quit (Ping timeout: 244 seconds) |
11:37:41 | * | gour_ quit (Remote host closed the connection) |
11:40:13 | * | nickles quit (Quit: Page closed) |
11:42:57 | * | repax_ joined #nim |
11:44:31 | ramnes | Araq: you should fetch/rebase instead of merging from origin to your repo, it would avoid useless commits |
11:44:54 | * | gour joined #nim |
11:45:48 | * | repax quit (Ping timeout: 265 seconds) |
11:46:42 | ekarlso- | will nim ever have a equiv of rust's HashMap a'la StringTable but allow for a value other then strings ? |
11:47:48 | Varriount | ekarlso-: Um, you did see the tables modules, right? |
11:48:22 | ekarlso- | no :| |
11:48:35 | * | ekarlso- goes back to RTFM instead of asking |
11:48:49 | Varriount | ekarlso-: Also, I really don't know rust, *at all*, so comparing Nim to that isn't very helpful. If you must compare Nim to something, use python, java, or possibly C++ |
11:49:04 | ekarlso- | ok :) |
11:49:33 | ekarlso- | yeah, tables was more useful1 |
11:49:41 | * | bjz joined #nim |
11:49:43 | flaviu | ekarlso-: for `=>`, there's the future module |
11:49:46 | areckizb | hello ! I wrote an implementation of a aho-corasick search algorithm in nim and I would be interested in gettng a peer review form anyone interested: https://github.com/arekzb/nim-aho-corasick |
11:49:53 | flaviu | although I don't know how well that works. |
11:50:22 | ekarlso- | flaviu: well what I meant was it would be awesome to be able to do something like a "let" inside a closure |
11:50:29 | Varriount | And for anyone who doesn't know what the aho-corasick algorithm is, it's a string matching algorithm. |
11:50:54 | * | gsingh93 quit (Quit: Connection closed for inactivity) |
11:51:00 | areckizb | because it is my first nim package, I'd like to get opinions on memory, syntax and overall design choice. thanks ! |
11:51:15 | areckizb | varriount: yes you are correct |
11:51:16 | Varriount | areckizb: I'm looking... |
11:51:35 | areckizb | awesome. i gotta jet to work, but i'll be back later |
11:53:11 | areckizb | i tried it on a very large set like a book and it gave an error: out of memory. other than that it works fine, but i have a feeling it is not most efficient |
11:53:12 | * | ZzZMorpork is now known as AMorpork |
11:53:31 | areckizb | bbl |
11:59:26 | * | vendethiel joined #nim |
12:02:14 | * | bjz quit (Ping timeout: 265 seconds) |
12:04:06 | * | Trustable joined #nim |
12:05:55 | Varriount | areckizb: Avoid using substr, it copies the input string. |
12:08:07 | Varriount | areckizb: Also, be aware that string assignment copies the string as well. Use shallowCopy to just copy the string reference. |
12:08:14 | * | z1y joined #nim |
12:11:05 | Varriount | areckizb: Those seem to be the two big things. |
12:11:38 | Varriount | areckizb: I would recommend simply passing around indice pairs of the source string, rather than copies of it. |
12:19:09 | * | Sphax quit (Quit: ZZZZZzzzzz) |
12:20:38 | * | bjz joined #nim |
12:21:53 | * | vendethiel quit (Ping timeout: 256 seconds) |
12:26:40 | * | gokr1 quit (Quit: Leaving.) |
12:31:04 | ekarlso- | Varriount: is it possible to foo.map((s: string) => (let i = s; s)) ? |
12:31:16 | ekarlso- | as in defined a var inside the closure |
12:32:12 | * | bjz quit (Ping timeout: 265 seconds) |
12:32:54 | Varriount | ekarlso-: Maybe not with the `=>` macro, but with the regular inline procedure syntax, I think so. |
12:33:18 | Varriount | ekarlso-: Although at that point, you may as well just define an actual procedure, separate from the line. |
12:35:28 | * | areckizb quit (Ping timeout: 246 seconds) |
12:35:52 | Araq | Varriount, MrOrdinaire that means the patch is not good enough. use the alias module to see if there is a conflict and only then do it via the additional temporary. Or cache s.high at the beginning. |
12:36:49 | Varriount | Araq: Is there a way to get a slice of a string without copying it? |
12:37:52 | Araq | Varriount: short answer: no. |
12:38:03 | * | Sphax joined #nim |
12:38:38 | Varriount | Hello Sphax |
12:38:54 | Sphax | Hi |
12:39:14 | * | zahary1 joined #nim |
12:40:07 | * | AndroUser2 quit (Read error: Connection reset by peer) |
12:44:01 | * | vendethiel joined #nim |
12:44:27 | * | repax_ quit (Quit: repax_) |
12:47:20 | * | EXetoC joined #nim |
12:53:09 | * | bjz joined #nim |
13:00:38 | * | bjz quit (Read error: Connection reset by peer) |
13:02:08 | ekarlso- | isn't var t = initTable[int, string]((1, "foo")) correct ? |
13:02:50 | ekarlso- | sorry newTable instead of the init |
13:02:59 | * | z1y quit (Remote host closed the connection) |
13:03:49 | ekarlso- | .eval newTable(@[(1, "foo")]) |
13:03:52 | Mimbus | ekarlso-: eval.nim(3, 0) Error: undeclared identifier: 'newTable' |
13:04:02 | ekarlso- | oh well, I found it anyways |
13:04:25 | * | z1y joined #nim |
13:05:38 | EXetoC | you can also do this: newTable({1: "foo", ...}) |
13:06:43 | * | vendethiel quit (Ping timeout: 255 seconds) |
13:08:08 | ekarlso- | meh, I ended up doing: let newTags = newTable(tags.map((s: string) => create(s)).map((t: Tag) => (t.id, t))) |
13:08:33 | ekarlso- | I forgot all about the chaining |
13:10:07 | * | keyle joined #nim |
13:12:16 | * | ekarlso- feels so stupid realizing how dead simple it was |
13:12:37 | Araq | ramnes: I use what git defaults to. |
13:13:03 | ramnes | Araq: well, you use git pull |
13:13:21 | Araq | yeah? |
13:13:42 | Araq | what should I use instead? |
13:14:08 | ramnes | git fetch and git rebase or git pull --rebase in this case |
13:14:25 | * | hasenj joined #nim |
13:18:32 | Araq | yeah I never got this rebasing stuff. or let's say it doesn't interest me at all so I never remember it |
13:19:03 | * | vendethiel joined #nim |
13:19:16 | ekarlso- | .evan {"foo": 1} |
13:19:19 | ekarlso- | .eval {"foo": 1} |
13:19:22 | Mimbus | ekarlso-: eval.nim(3, 0) Error: value of type 'Array constructor[0..0, tuple[string, int]]' has to be discarded |
13:20:22 | ekarlso- | can you do a map in tbl.values ? |
13:21:07 | * | repax joined #nim |
13:21:40 | * | saml_ joined #nim |
13:24:03 | ekarlso- | too bad you can't tbl.values.map() |
13:24:05 | * | z1y quit (Remote host closed the connection) |
13:24:06 | * | gokr joined #nim |
13:24:28 | Araq | toSeq(tbl.values).map() should work |
13:25:00 | * | z1y joined #nim |
13:25:42 | ekarlso- | .eval toSeq({"foo": 1}.values).map((i: int) => (i)) |
13:25:45 | Mimbus | ekarlso-: eval.nim(3, 16) Error: undeclared identifier: 'values' |
13:25:50 | ekarlso- | meh |
13:27:32 | JinShil | where is echo defined? |
13:30:43 | Araq | JinShil: system.nim |
13:31:06 | * | bjz joined #nim |
13:31:34 | ramnes | Araq: as you can see, each time you want to push but there already is some changes in the remote repository, you pull and it makes a merge commit |
13:31:49 | * | keyle quit (Ping timeout: 246 seconds) |
13:31:50 | ramnes | next time, instead of pull, just do "git fetch; git rebase" |
13:32:01 | ramnes | it will put your changes on top of remote changes |
13:32:02 | ramnes | that's all |
13:32:27 | ramnes | there really is nothing to understand |
13:32:36 | ramnes | git pull = git fetch + git merge |
13:32:42 | * | BitPuffin joined #nim |
13:32:48 | JinShil | Araq thanks, I see it now. That was the first placed I looked but just missed it. |
13:33:14 | * | keyle joined #nim |
13:33:21 | keyle | re. |
13:33:30 | ramnes | rebase just put your commits on top of the history instead of merging them |
13:33:31 | Araq | ramnes: ok. maybe i'll remember |
13:33:32 | ekarlso- | Araq: thnx |
13:33:33 | keyle | Error: undeclared identifier: 'await' - any clues what I'm missing? |
13:33:48 | ekarlso- | keyle: improt asyncdispatch ? |
13:34:08 | keyle | import asyncdispatch is there |
13:34:09 | hasenj | speaking of async, parts of the docs talk about it as if it's a keyboard |
13:34:11 | hasenj | err, keyword |
13:34:17 | kokozedman | how do I readFile("/proc/sys/net/ipv4/icmp_echo_ignore_all") and actually get the '0' content? |
13:35:03 | keyle | ekarlso-: even with import asyncdispatch I still get the same error |
13:36:20 | Araq | keyle: it only works in an .async proc |
13:36:38 | keyle | ah. Sorry. nim noob here :) |
13:37:04 | ekarlso- | keyle: i'm in the same boat as you so I dunno that much :) |
13:37:36 | keyle | so I'm guessing I need this signature {.async.} |
13:39:02 | gokr | Hmmm, object variants seem to not be able to have one of the variants have "no fields". |
13:39:32 | EXetoC | gokr: why not? have you tried with 'nil'? |
13:39:36 | keyle | works, thanks Araq |
13:39:59 | gokr | EXetoC: nil where? |
13:40:30 | EXetoC | gokr: as the only statement in the block |
13:40:49 | EXetoC | discard seems to make more sense, but it can't be used in this case |
13:40:49 | gokr | Doesn't fly |
13:41:07 | gokr | Or wait, perhaps it did |
13:41:16 | gokr | But that's not really intuitive |
13:41:34 | gokr | I would rather have had "no block" at all. |
13:42:15 | EXetoC | I don't see a problem with either mentioning it explicitly or having an 'else' block |
13:42:48 | gokr | I mean, the use of "nil" here seems counter intuitive. |
13:42:51 | * | vendethiel quit (Ping timeout: 264 seconds) |
13:43:05 | Araq | it's a leftover from Ada really |
13:43:10 | Araq | gotta go, see you later |
13:43:13 | gokr | sure |
13:44:21 | * | bjz quit (Read error: Connection reset by peer) |
13:44:34 | * | bjz joined #nim |
13:45:52 | * | willwillson joined #nim |
13:47:48 | gokr | I am guessing distinct types doesn't work for object types? |
13:49:53 | EXetoC | it seems to work |
13:51:27 | gokr | Ok, I did an object variant, then tried two distinct types of it |
13:51:59 | gokr | But then trying to compile a constructor it says "object constructor needs an object type" |
13:52:07 | * | keyle quit (Ping timeout: 246 seconds) |
13:52:22 | EXetoC | .eval |
13:52:25 | Mimbus | EXetoC: <no output> |
13:53:40 | EXetoC | .eval type; T = distinct U; U = object; case kind: bool; else: nil; discard T(U()) |
13:53:43 | Mimbus | EXetoC: <no output> |
13:53:57 | gokr | Hmmm, perhaps I have done something else that is wrong. |
13:56:22 | * | vendethiel joined #nim |
13:59:07 | * | JinShil quit (Quit: Konversation terminated!) |
14:02:10 | * | jm116 quit (Read error: Connection reset by peer) |
14:09:51 | * | MajorTennis joined #nim |
14:10:06 | * | MajorTennis quit (Changing host) |
14:10:06 | * | MajorTennis joined #nim |
14:10:20 | BlaXpirit | forum.nimrod-lang.org does not redirect, and has Nimrod in title |
14:14:44 | * | nickles joined #nim |
14:15:52 | nickles | *: How would I print the type of a variable? Didn't find it in the manuals. |
14:17:28 | * | vendethiel quit (Ping timeout: 244 seconds) |
14:20:50 | MajorTennis | what language? |
14:23:44 | gokr | meta question: How do I figure out how to copy a seq? |
14:24:19 | * | nickles quit (Ping timeout: 246 seconds) |
14:25:53 | BlaXpirit | gokr, i dunno |
14:25:56 | BlaXpirit | it's pretty obvious |
14:26:13 | gokr | Assignment? |
14:26:20 | BlaXpirit | .eval var a = @[1,2,3]; var b = a |
14:26:23 | Mimbus | BlaXpirit: eval.nim(3, 4) Error: invalid indentation |
14:26:29 | BlaXpirit | oh really |
14:26:35 | gokr | But, how would I know? |
14:26:44 | gokr | Note the "meta" in my question. |
14:26:55 | BlaXpirit | note the "i dunno" in my answer |
14:27:06 | gokr | Yes, I kinda thought you meant that |
14:27:10 | BlaXpirit | by learning the basics of the language? assignment copies... |
14:27:36 | gokr | Well, pretend it was a non basic type then. The meta question still stands. |
14:27:44 | gokr | IMHO I find it hard to find things. |
14:28:01 | BlaXpirit | yes, it is very hard to find things |
14:28:10 | gokr | Also, since a seq is a ref type (I guess) - its not apparent to me that it copies. |
14:28:19 | gokr | But I am just a n00b of course. |
14:28:21 | BlaXpirit | especially for me, who got used to clicking first result in google and almost always getting the answer |
14:28:38 | BlaXpirit | in what way is seq a ref type? |
14:28:50 | BlaXpirit | that can't be correct |
14:29:18 | gokr | Well, ok, I may be wrong. |
14:29:50 | gokr | I just meant... its dynamic in size. |
14:30:07 | gokr | So it must be using some kind of heap allocated area underneath, right? |
14:30:15 | BlaXpirit | probably |
14:30:45 | * | bjz quit (Read error: Connection reset by peer) |
14:30:59 | * | bjz joined #nim |
14:33:13 | gokr | So ok, let's say I have a seq coming in as a param, and I want to call a proc with a *copy* of it - then I need to use a var - and assign to it, in order to get a copy? |
14:33:32 | gokr | Feels a tad clumsy. |
14:33:56 | BlaXpirit | gokr, I actually still don't know how function arguments work |
14:34:06 | BlaXpirit | but i'm pretty sure it would be copied in some cases |
14:34:23 | BlaXpirit | gokr, also, you can call @ on the seq :| |
14:35:52 | * | vendethiel joined #nim |
14:39:15 | EXetoC | gokr: omit var and it will be copied |
14:40:39 | * | nickles joined #nim |
14:41:40 | EXetoC | .eval var x = @[1, 2, 3]; y = x; y[0] = 10; echo x, ", ", y |
14:41:43 | Mimbus | EXetoC: eval.nim(4, 0) Error: undeclared identifier: 'y' |
14:41:51 | EXetoC | .eval var x = @[1, 2, 3]; y = x; var y[0] = 10; echo x, ", ", y |
14:41:53 | Mimbus | EXetoC: eval.nim(4, 0) Error: undeclared identifier: 'y' |
14:41:58 | EXetoC | crap |
14:42:16 | EXetoC | .eval var x = @[1, 2, 3]; var y = x; y[0] = 10; echo x, ", ", y |
14:42:19 | Mimbus | EXetoC: @[1, 2, 3], @[10, 2, 3] |
14:42:23 | nickles | *: How would I determine the type of a variable? |
14:43:20 | EXetoC | nickles: I think the simplest way is to just do "type(x)" and then look at the error message |
14:43:47 | EXetoC | otherwise you have to import typetraits and do x.type.name |
14:44:07 | * | willwillson quit (Ping timeout: 256 seconds) |
14:47:12 | vendethiel | hi Varriount :) |
14:48:37 | nickles | EXetoC: Thanks. How did you find that? |
15:04:35 | * | gokr starting to remember why I am not fond of statically typed languages... |
15:05:07 | gokr | Today it has mostly felt like I am battling the compiler, no productivity at all. |
15:10:07 | gokr | "object constructor needs an object type".hmmm. |
15:14:15 | * | jefus joined #nim |
15:16:10 | * | jefus_ quit (Ping timeout: 244 seconds) |
15:17:57 | gokr | A pity I can't have methods called "and" or "or", "not" etc. |
15:20:27 | BlaXpirit | the text format that the forum uses is absolute garbage |
15:21:00 | BlaXpirit | rst by itself is bad, but it's not even rst, just a small broken subset of it! |
15:25:09 | * | nickles left #nim (#nim) |
15:29:53 | * | repax quit (Quit: repax) |
15:31:34 | * | kapil__ quit (Quit: Connection closed for inactivity) |
15:34:37 | EXetoC | gokr: are you trying to create a tuple? |
15:35:31 | * | jpoirier quit (Quit: Leaving) |
15:39:56 | * | bjz quit (Ping timeout: 244 seconds) |
15:51:25 | * | noam quit (Ping timeout: 255 seconds) |
15:54:42 | gokr | eh, no |
15:55:16 | gokr | It seems to me that generics and objects don't mix that well. |
15:57:26 | * | Sergio965 joined #nim |
15:58:03 | * | kniteli joined #nim |
16:01:39 | * | bjz joined #nim |
16:02:11 | * | MajorTennis quit (Read error: Connection reset by peer) |
16:09:13 | * | darkf quit (Quit: Leaving) |
16:17:24 | * | minciue joined #nim |
16:19:02 | EXetoC | gokr: some relevant code would be nice |
16:21:17 | gokr | EXetoC: Ok, http://pastebin.com/KRPHnsx5 |
16:22:00 | gokr | So... this is the current incarnation of some code I am porting from PP. I have gone down several pahts - and I am not that interested in talking "design", but if you try to compile it... |
16:22:36 | gokr | ...you get "object constructor needs an object type" on line 49 |
16:23:50 | gokr | The mixing of generics and objects... well, not sure if I have that code left... |
16:25:36 | EXetoC | this works: Context(...).Success |
16:25:43 | def- | Araq: I have a paper deadline next week, so I'm probably too busy to work on repl or idetools |
16:25:44 | gokr | Hmmm, that code I pasted was old and slightly goofy btw. |
16:25:45 | EXetoC | simply because of the fact that the types are distinct |
16:26:14 | lyro | I have another question. The following test code demonstrates a strange behaviour (IMO, of course) for tuples as table keys: http://pastie.org/private/7wdfsu9g0pfqk9hsgoaag |
16:26:25 | gokr | EXetoC: Ehm, can you explain that again? |
16:26:56 | lyro | for some reason the compiler seems to forget that the field of the key tuple of q is called 'x' and not 'a' |
16:27:03 | lyro | am I doing something wrong? |
16:27:10 | gokr | So... you use "Context" constructor - and then convert type? |
16:27:37 | gokr | So... there is no "Success" constructor... ahhh. eh. |
16:27:52 | EXetoC | .eval type T = distinct int; discard T(1) |
16:27:55 | Mimbus | EXetoC: <no output> |
16:28:32 | EXetoC | there's an implicit constructor introduced by distinct, I guess |
16:29:50 | * | MajorTennis joined #nim |
16:32:06 | * | bjz quit (Read error: Connection reset by peer) |
16:32:47 | EXetoC | .eval type T = distinct int; var x: T = 1 |
16:32:50 | Mimbus | EXetoC: eval.nim(4, 11) Error: type mismatch: got (int literal(1)) but expected 'T' |
16:33:02 | EXetoC | gokr: is it more clear now? |
16:33:52 | gokr | Well, not sure :) |
16:34:03 | * | bjz joined #nim |
16:34:48 | gokr | So a distinct type of a ref object does not get an object constructor. Is that the lesson? |
16:35:07 | gokr | I need to borrow perhaps. |
16:35:15 | EXetoC | it gets a constructor that takes the target type |
16:36:04 | * | khmm quit (Ping timeout: 245 seconds) |
16:36:11 | gokr | Oh. So its not a ... type conversion we do? |
16:36:56 | * | z1y quit (Remote host closed the connection) |
16:36:57 | EXetoC | .eval type T = distinct int; var x = T(1); echo x.int |
16:37:00 | Mimbus | EXetoC: 1 |
16:37:03 | * | z1y joined #nim |
16:37:42 | gokr | I thought the "T(1)" was a type conversion - not a call to a constructor. |
16:38:25 | EXetoC | maybe you're right |
16:38:43 | * | jefus_ joined #nim |
16:40:09 | gokr | Either way, I am not going to use distinct here, it feels wrong ;) |
16:42:51 | * | jefus quit (Ping timeout: 264 seconds) |
16:43:28 | EXetoC | sometimes it's better to do something like "type T = object\n handle: U". implicit conversions can be introduced with 'converter' though: "converter toBar(o: Foo): Bar = o.Bar", which should be done sparingly as I've said before |
16:47:20 | * | bjz quit (Read error: Connection reset by peer) |
16:49:00 | EXetoC | that last part was about converters, but converters can used for any types |
16:49:25 | EXetoC | *type |
16:50:40 | * | z1y quit (Quit: Leaving.) |
16:52:44 | * | repax joined #nim |
16:58:34 | * | z1y joined #nim |
16:59:12 | * | z1y quit (Client Quit) |
16:59:55 | * | bjz joined #nim |
17:02:01 | * | dyu quit (Quit: Leaving) |
17:15:25 | * | yglukhov_____ quit (Ping timeout: 264 seconds) |
17:16:02 | * | yglukhov_____ joined #nim |
17:17:41 | * | willwillson joined #nim |
17:21:33 | * | Varriount|Busy joined #nim |
17:25:08 | * | Sergio965 quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
17:30:05 | * | bjz quit (Read error: Connection reset by peer) |
17:37:30 | * | bjz joined #nim |
17:46:41 | * | bjz quit (Read error: Connection reset by peer) |
17:48:13 | * | jpoirier joined #nim |
17:48:54 | * | Matthias247 joined #nim |
17:52:41 | * | Sphax quit (Quit: ZZZZZzzzzz) |
17:56:06 | * | chroem joined #nim |
17:56:20 | chroem | Does nim support bitshift operations? |
17:56:29 | chroem | The manual didn't say anything |
17:57:39 | onionhammer | http://nim-lang.org/system.html#shl,int,int |
17:58:11 | chroem | Okay, thanks |
17:58:35 | onionhammer | yep |
18:02:36 | * | bjz joined #nim |
18:07:51 | chroem | Okay, sorry if this is a dumb question, but why is the compiler interpreting the stuff inside shr() as a tuple? |
18:07:56 | chroem | memory[i] = shr(number, num) |
18:08:07 | chroem | It's spitting out a type error |
18:11:41 | onionhammer | whats the error? |
18:11:46 | onionhammer | and what are number and num |
18:11:50 | * | infrashortfoo quit (Remote host closed the connection) |
18:12:01 | chroem | Both one is a byte, the other is an integer |
18:12:09 | onionhammer | also it's `shr` not shr(), so you should call it like x shr y |
18:12:16 | onionhammer | my guess is they have to be the same type |
18:12:20 | chroem | Oh |
18:12:54 | chroem | There we go |
18:12:55 | chroem | Thanks |
18:13:05 | onionhammer | np |
18:13:08 | chroem | Nim is cool but it's still pretty new to me |
18:13:19 | onionhammer | yeah, completely understandable confusion |
18:13:58 | onionhammer | for future reference if the procs name is proc `x`() as opposed to proc x() it means it's an operator |
18:14:24 | onionhammer | you can still call it like a normal procedure, but you have to use the ``'s, i.e. `shr`(x, y) |
18:15:25 | chroem | Okay, great |
18:15:30 | chroem | Off to class now |
18:17:05 | * | bjz quit (Read error: Connection reset by peer) |
18:19:52 | * | chroem quit (Ping timeout: 246 seconds) |
18:21:39 | * | bjz joined #nim |
18:22:08 | * | MajorTennis quit (Quit: Leaving) |
18:34:13 | * | bjz quit (Ping timeout: 265 seconds) |
18:36:00 | * | superfunc|busy joined #nim |
18:42:09 | BlaXpirit | I haven't seen fowl in like a week |
18:44:35 | * | Sphax joined #nim |
18:45:14 | ldlework | he's been around |
18:48:25 | Araq | BlaXpirit: the forum uses our RST parser that's also used for *all* of our docs and the only feature it doesn't support are ascii art tables |
18:48:44 | BlaXpirit | Araq, doesn't support combining markup |
18:48:51 | BlaXpirit | like, links inside bold or bold inside links |
18:49:25 | Araq | that might be an oversight or maybe a newer version of RST support that |
18:49:49 | * | Puffin joined #nim |
18:50:27 | * | bjz joined #nim |
18:51:31 | BlaXpirit | oh I'm sorry, Araq, it appears like just yet another limitation of rst |
18:51:37 | * | superfunc|busy quit (Ping timeout: 265 seconds) |
18:51:54 | * | BitPuffin quit (Ping timeout: 245 seconds) |
18:53:13 | * | Puffin is now known as BitPuffin |
18:53:45 | * | gokr_ joined #nim |
18:55:34 | BlaXpirit | It might not yet be too late to reconsider markdown :s |
18:56:22 | Araq | gimme a native markdown implementation, not regex based with Nim syntax highlighting and I'll consider it |
18:56:47 | BlaXpirit | Araq, what do you mean... |
18:56:57 | BlaXpirit | markdown implementation is not supposed to have syntax highlighting |
18:57:02 | BlaXpirit | it should be separate |
18:57:19 | Araq | github supports ```nimrod ... ``` |
18:57:40 | BlaXpirit | Araq, in general all that does is mark the <pre> with a class |
18:58:30 | BlaXpirit | stackoverflow uses javascript on client side for syntax highlighting |
18:58:46 | BlaXpirit | and it is easy to search in HTML for <pre class="nim"> |
18:58:53 | BlaXpirit | Araq, btw ```nim seems to work too |
18:58:55 | BlaXpirit | on github |
18:59:02 | Araq | yay |
18:59:10 | Araq | so they already updated it, nice |
18:59:16 | BlaXpirit | but didnt rename language |
19:00:17 | Araq | hrm JS on the client side for syntax highlighting ... nice idea |
19:00:34 | BlaXpirit | sure is... |
19:00:59 | BlaXpirit | ah but it may be problematic because there definitely are no JS libraries for Nim syntax :p |
19:01:19 | minciue | Github’s code should be reusable, I believe that part of their front-end is open source |
19:01:24 | BlaXpirit | Google Code Prettify or whatever it's called, claims to be able to highlight any language, but it may not work |
19:01:32 | BlaXpirit | minciue, we're talking about Nim implementation |
19:01:34 | BlaXpirit | of markdown |
19:01:44 | BlaXpirit | that's the main problem now |
19:02:14 | BlaXpirit | I dunno... if there is a C implementation, there shouldn't be a problem actually |
19:02:18 | BlaXpirit | and there is |
19:02:21 | * | bjz quit (Read error: Connection reset by peer) |
19:02:39 | Araq | well we also have 4062 posts in the old RST based syntax in the database but surely we can teach the forum about 2 different formats |
19:03:10 | Araq | BlaXpirit: I don't want a C implementation wrapper though. |
19:03:18 | BlaXpirit | I understand |
19:03:27 | BlaXpirit | I don't see anyone writing it from scratch though |
19:03:44 | BlaXpirit | Araq, it is not that difficult to add a markdown vs rst field in database |
19:03:51 | Araq | I know |
19:04:24 | Araq | but then we might as well allow both in the frontend |
19:04:32 | Araq | so users can pick their poison |
19:05:20 | BlaXpirit | > CommonMark is a rationalized version of Markdown syntax, with a spec and BSD3-licensed reference implementations in C and JavaScript. |
19:05:52 | BlaXpirit | if BSD3 is acceptable, a direct rewrite of either of these may be acceptable |
19:06:07 | * | NimBot joined #nim |
19:10:49 | BlaXpirit | Araq, is c2nim of a C implementation realistic? |
19:11:07 | Araq | IMO yes |
19:11:24 | BlaXpirit | then what are we waiting for :p |
19:11:26 | Araq | but I don't think many will agree :P |
19:11:45 | BlaXpirit | by the way, I don't think there are many Markdown implementations without regex |
19:11:46 | * | rpag joined #nim |
19:11:51 | BlaXpirit | even CommonMark uses regex |
19:12:22 | * | Varriount|Busy quit (Ping timeout: 246 seconds) |
19:12:44 | * | bjz joined #nim |
19:13:07 | BlaXpirit | (btw, I just noticed that re module has reEmail and it's horribly wrong) |
19:15:54 | * | superfunc|busy joined #nim |
19:17:57 | onionhammer | BlaXpirit there are js syntax highlighting for nim |
19:18:04 | BlaXpirit | how |
19:18:06 | onionhammer | at least one anyway |
19:18:08 | BlaXpirit | where |
19:19:05 | onionhammer | https://gitcandy.com/Repository/Commit/highlight_js/3c7af1af40226d75441bc018cc215aa53568a2f6 |
19:19:39 | * | infrashortfoo joined #nim |
19:20:58 | BlaXpirit | so that's that |
19:21:07 | * | VinceAddons quit (Ping timeout: 255 seconds) |
19:21:45 | * | rpag quit (Ping timeout: 252 seconds) |
19:21:56 | * | VinceAddons joined #nim |
19:23:35 | BlaXpirit | I don't understand compiler/llstream.nim(130, 4) Error: undeclared identifier: 'copyMem' |
19:24:27 | BlaXpirit | basically can't get c2nim to work |
19:26:41 | BlaXpirit | ah commit 18 hours ago? |
19:27:19 | * | minciue quit (Quit: minciue) |
19:27:52 | Araq | you have to install nim from devel and don't install it |
19:28:03 | Araq | and c2nim from master and don't install it |
19:28:15 | jpoirier | I don't understand why I get "array.nim(4, 9) Error: ambiguous identifier: 'array' -- use a qualifier" from "var arr: array[0..2, int] = [1, 2, 3]" because the file name is array.nim |
19:28:16 | Araq | and then c2nim compiles. simple. :P |
19:28:23 | BlaXpirit | Araq, what do these "and don't install it" mean??? |
19:28:29 | BlaXpirit | and is devel stable enough? |
19:28:41 | ldlework | jpoirier: because the module is magically a name. \o/ |
19:29:23 | Araq | ldlework: yeah and if you have an idea how to avoid this gotcha I'm all ears |
19:30:19 | Araq | BlaXpirit: it means to not install it in /usr/bin. add it to your path instead |
19:30:39 | jpoirier | lol, k. i guess i need to do some research; i had a similar problem when I named a file test.nim |
19:30:40 | BlaXpirit | that's... difficult |
19:30:48 | BlaXpirit | probably not gonna do that |
19:30:58 | dtscode | add it to your path? not that hard. its what i do |
19:31:15 | BlaXpirit | i have it in usr bin |
19:31:17 | BlaXpirit | .... |
19:31:47 | BlaXpirit | the hard part is building it |
19:32:05 | BlaXpirit | well maybe not, i'm just layz |
19:32:07 | BlaXpirit | lazy |
19:32:10 | dtscode | i just added export PATH=$PATH:~/.mini-bin to my bash rc, then install the Nimrod git repo to there, and make a symbolic link so that bin/nim is in ~/.mini-bin |
19:32:28 | BlaXpirit | that's ok |
19:37:54 | * | rpag joined #nim |
19:40:29 | BlaXpirit | what's result = x.firstName.hash !& x.lastName.hash |
19:44:39 | * | gsingh93 joined #nim |
19:45:08 | Araq | a hash computation |
19:46:19 | BlaXpirit | !& specifically, I can't find it anywhere |
19:46:50 | Araq | it's in hashes.nim |
19:46:53 | BlaXpirit | oh okay |
19:47:05 | BlaXpirit | no idea how to find that out on my own, seriously |
19:47:19 | dtscode | in the module asyncdispatch is TAsyncFD a type of socket? |
19:47:43 | Araq | oh common on now |
19:47:45 | Araq | http://nim-lang.org/theindex.html |
19:47:51 | Araq | CRTL+F !& |
19:48:02 | Araq | --> first and only hit: hashes module |
19:49:39 | BlaXpirit | Araq, you're forgetting that theindex.html is a top secret document that nobody knows about, because it is never mentioned |
19:50:04 | Araq | http://nim-lang.org/documentation.html |
19:50:15 | Araq | Search Options |
19:50:17 | Araq | Documentation Index - The generated index. Index + (Ctrl+F) == Joy |
19:50:18 | BlaXpirit | right |
19:50:37 | ldlework | we should definitely put it as a fourth link in the normal block |
19:50:51 | Araq | but you're right, every document should scream this link |
19:50:57 | ldlework | Its a good one |
19:51:20 | Araq | just like every compilation should shout at you "DEBUG BUILD! FOR PERFORMANCE TESTING USE -d:release" |
19:51:34 | ldlework | lol |
19:52:06 | ekarlso- | nimble publish < would be a fun command |
19:52:14 | Araq | the only thing we cannot do unfortunately is to bang your head against a wall for you |
19:53:21 | BlaXpirit | so... could someone try to run c2nim on CommonMark... |
19:54:09 | ldlework | flaviu: is your name a reference to the Nimrod lore? |
19:55:43 | Araq | dtscode: I don't know |
19:55:56 | dtscode | alright |
19:56:12 | dtscode | ill ask dom96 when he wakes up? |
19:56:26 | Araq | yup |
19:56:31 | ldlework | Araq: would you mind a PR to add anchors to the theindex symbol headers? |
19:56:40 | dtscode | i didnt to put the question mark :/ |
19:56:46 | dtscode | idk why i keep doing that |
19:57:08 | Araq | because there are no stupid questions, only stupid answers |
19:57:34 | Araq | ldlework: what do you mean? |
19:57:57 | ldlework | Araq: you know how it eventually starts listing all the API symbols, and all the ambigiguous places its defined? |
19:58:01 | ldlework | `$`: |
19:58:05 | dom96 | dtscode: what's up? |
19:58:06 | ldlework | then all the $'s in the stdlib |
19:58:29 | Araq | ldlework: we just need to cut off the wrappers and not build their docs |
19:58:29 | ldlework | Araq: I'd like to make `$`: a link, an anchor |
19:59:03 | ldlework | Araq: I'm thinking more for a documentation bot, so I can do "talmud: `$`" |
19:59:10 | ldlework | and it would link to that anchor in the index |
19:59:26 | dtscode | dom96, so im rewriting nimbus in asyncio (as you originally said to :} ) and im reading the asyncdispatch module, I was wondering what exactly TAsyncFD |
19:59:26 | * | BlaXpirit_ joined #nim |
19:59:28 | dtscode | ? |
19:59:33 | Araq | ldlework: ok go ahead |
20:00:35 | dom96 | dtscode: I originally suggested that you should use the IRC library, you should still do that. |
20:00:36 | ldlework | I should figure out which commit broke SDL first |
20:00:55 | dom96 | dtscode: You don't need to worry about TAsyncFD. |
20:01:03 | ldlework | dom96: I would love a small article on how to use the callback/futures style of async programming in Nim |
20:01:15 | ldlework | a tiny one! |
20:01:18 | BlaXpirit_ | re module does not support replacing with a function? T_T |
20:01:28 | dtscode | dom96, oh thats right... i looked at it last night though and the poll function had a disclaimer. ummm let me find it |
20:01:35 | dom96 | ldlework: There is an example here: http://nim-lang.org/asyncnet.html |
20:01:45 | dom96 | What would you like that article to cover? |
20:02:27 | ldlework | dom96: does Nim's async stuff have the concept of a Deferred? |
20:02:28 | Araq | ldlework: did I get a bug report from you about devel? |
20:02:40 | ldlework | Araq: that's what I'm saying I'm gonna do right now, before the docs thing |
20:02:49 | * | BlaXpirit quit (Ping timeout: 264 seconds) |
20:02:50 | dtscode | >a somewhat asynchronous IRC implementation, although it should only be used for simple things for example an IRC bot which does not need to be running many time critical tasks in the background. |
20:02:53 | ldlework | dom96: like when you do some async operation you get back an object you can attach a callback to? |
20:03:04 | dtscode | Nimbus will be running quite a few things in the background |
20:03:21 | dom96 | dtscode: Use NimBot as an example: https://github.com/nim-lang/nimbot/blob/master/src/nimbot.nim |
20:03:43 | ldlework | dom96: I think his concern is that he will be doing lots of background stuff and doesn't want to block the IRC from responding to pings and such |
20:03:43 | dtscode | alright dom96. thanks |
20:03:58 | dom96 | ldlework: Have you read the docs in asyncdispatch? |
20:04:06 | ekarlso- | anyone wanna help with packages ? :D |
20:04:21 | ldlework | dom96: Alright, give me a chance to review the stuff and I'll ask for an article again if I just find it perplexing |
20:04:51 | dom96 | I think it would be better to improve the docs because redirecting everyone to an article will be a pain. |
20:05:04 | dom96 | I do want to write an article about how the async stuff works though. |
20:05:09 | dom96 | I've already got it pretty much written. |
20:06:17 | ldlework | dom96: can you give me a yes or no, on the Deferred style of doing things? Is that what asyncdispatch is? |
20:06:41 | ekarlso- | hmm, to get packages by tag, do http://foo/packages?tag=foo or http://foo/tags/foo/packages ? |
20:06:45 | ldlework | This includes a dispatcher, a Future type implementation, and an async macro which allows asynchronous code to be written in a synchronous style with the await keyword. |
20:06:48 | ldlework | nm! |
20:07:12 | dom96 | ^^ |
20:07:13 | * | ldlework huggles dom96 |
20:07:20 | dom96 | :) |
20:07:29 | dom96 | Let me know if you have any other questions. |
20:07:30 | dom96 | bbl |
20:12:47 | Varriount | Araq: What is it you want me to work on? more of the buildbots? compiler bugs? idetools? |
20:13:06 | Araq | idetools |
20:13:27 | dtscode | dom96, in nimbot is irclog and irclogrender just meant for logging or does it do anything specifically for the irc part of the bot? |
20:13:34 | dtscode | yes plz ide tools |
20:18:41 | * | SplinterOfChaos joined #nim |
20:21:52 | Araq | hi SplinterOfChaos welcome |
20:22:34 | SplinterOfChaos | hi |
20:23:05 | ldlework | dtscode: lol |
20:23:54 | ekarlso- | should we store somekind of download stats of packages ? |
20:24:00 | ekarlso- | or is that wrong |
20:24:56 | ldlework | ekarlso-: in my experience those numbers are meaningless |
20:25:15 | ekarlso- | ldlework: ok by me :p |
20:25:28 | ldlework | "Oh look at how many times some bot downloaded my package!" |
20:25:31 | ekarlso- | :D |
20:25:37 | ekarlso- | a rating maybe ? |
20:25:43 | ekarlso- | a'la user +1 |
20:26:01 | ldlework | ekarlso-: that's far more useful |
20:30:52 | ldlework | https://github.com/Araq/Nim/commit/5e4ae8dbb4f5e3ca8cf8c1fb356ca0f500f32746 is the commit that breaks our app |
20:33:39 | ldlework | ekarlso-: you should still track downloads though |
20:33:44 | ldlework | but we shouldn't expose those to end users |
20:33:55 | ldlework | but they are useful metrics for non-popularity considerations |
20:37:28 | Araq | ldlework: what does produce with your code? crashes? |
20:37:40 | ldlework | https://github.com/Araq/Nim/issues/1899 |
20:38:50 | ldlework | Seems like it crashes while compiling rather than running |
20:39:03 | ldlework | no idea tho |
20:39:31 | flaviu | ekarlso-: Maybe make the download stats only available to package maintainers? |
20:40:03 | ldlework | flaviu: is your name a reference to Nimrod lore? |
20:40:08 | * | Nimbus quit (Remote host closed the connection) |
20:40:28 | flaviu | nope! |
20:40:33 | flaviu | It's actually my name :P |
20:41:29 | ldlework | http://en.wikipedia.org/wiki/Nimrod |
20:41:35 | ldlework | CTRL-F flaviu |
20:41:37 | ldlework | :) |
20:42:14 | dtscode | flaviu, its your real name? |
20:44:13 | * | bjz quit (Ping timeout: 264 seconds) |
20:44:27 | * | superfunc|busy quit (Ping timeout: 244 seconds) |
20:44:42 | * | Demon_Fox joined #nim |
20:44:48 | flaviu | ldlework: interesting coincidence. |
20:44:53 | flaviu | dtscode: yes, it is. |
20:44:59 | dtscode | interesting |
20:45:02 | Araq | ldlework: 'koch boot' and try it please so that I havea meaningful stacktrace |
20:45:34 | ldlework | Araq: I built the compiler with "./koch boot -d:release" |
20:45:38 | ldlework | oh |
20:45:39 | * | Mimbus quit (Read error: Connection reset by peer) |
20:45:41 | * | flaviu quit (Read error: Connection reset by peer) |
20:45:52 | ldlework | building.. |
20:48:52 | * | flaviu joined #nim |
20:52:51 | * | repax quit (Quit: repax) |
20:55:38 | * | flaviu quit (Read error: Connection reset by peer) |
20:56:12 | Araq | ldlework: you know this shouldn't take a year |
20:56:45 | * | brson joined #nim |
20:57:18 | ldlework | actually its still building the compiler |
20:59:41 | EXetoC | what's your hardware? it takes about a minute for me (3.4GHz AMD APU) |
21:00:44 | EXetoC | "./koch temp" to generate nim_temp |
21:02:11 | ldlework | I did "./koch boot" |
21:02:40 | EXetoC | just saying. they do almost the same thing |
21:03:17 | ldlework | I don't understand that |
21:03:19 | ldlework | it seems magical |
21:03:53 | * | flaviu joined #nim |
21:04:19 | EXetoC | but flaviu recommended release mode but with stack traces. you then have your stack traces, but it shouldn't be that slow |
21:07:03 | Araq | ldlework: don't use -d:useSysAssert -d:useGcAssert ! |
21:07:10 | ldlework | I'm not :( |
21:07:48 | dtscode | -d:tripleSpeedWithNoDownsides maybe? |
21:08:24 | ldlework | haha |
21:08:49 | EXetoC | ldlework: how long did it take? |
21:09:54 | * | Lordovos joined #nim |
21:11:22 | ldlework | Araq: if I use those flags to build once, and the build again without them, do they stick around or something? |
21:11:33 | ldlework | I just recloned and am rebuilding and its going a lot faster |
21:11:47 | Araq | no but guess what |
21:11:54 | ldlework | Araq: https://gist.github.com/62855fb88c14bee46304 |
21:12:00 | Araq | built it once with these and your 'nim' is slow |
21:12:01 | * | tinAndi joined #nim |
21:12:09 | ldlework | Ah |
21:12:16 | BlaXpirit_ | "a a".replace(re"a a") == "a a" |
21:12:16 | ldlework | makes sense |
21:12:18 | BlaXpirit_ | what am i missing? |
21:13:03 | * | shodan45 joined #nim |
21:13:34 | BlaXpirit_ | why does re"a\ a" work |
21:13:52 | BlaXpirit_ | OK I see, extended flagson by default |
21:25:52 | dtscode | dom96, your tab size is too small |
21:30:40 | * | superfunc|busy joined #nim |
21:41:57 | BlaXpirit_ | I think this is a useful addition to `re` module: https://gist.github.com/BlaXpirit/15ed8ea0bc3f35e973fc |
21:42:10 | BlaXpirit_ | "Regular expression replacement using results of calling a procedure" |
21:42:27 | BlaXpirit_ | Python has something like that, anyway |
21:42:44 | BlaXpirit_ | Araq, would a pull request with such an addition be accepted? |
21:44:14 | Araq | BlaXpirit_: flaviu already implement that one |
21:44:19 | BlaXpirit_ | wha :o |
21:44:26 | Araq | needs review though |
21:44:36 | BlaXpirit_ | dang it |
21:44:53 | flaviu | https://github.com/Araq/Nim/pull/1855 |
21:45:04 | BlaXpirit_ | i see now... |
21:45:39 | flaviu | If the previous implementations were correct, then my version is correct too. |
21:46:11 | flaviu | I just replaced the by with a function invocation and assert (to reduce user error) |
21:47:07 | BlaXpirit_ | flaviu, but do consider the differences in my thingy |
21:47:13 | * | gokr_ quit (Quit: IRC for Sailfish 0.8) |
21:47:33 | BlaXpirit_ | first, the array of matches is truncated for convenience (example shows why it's convenient) |
21:47:41 | * | gokr_ joined #nim |
21:47:45 | BlaXpirit_ | and the other version that just takes a proc on a string |
21:47:58 | BlaXpirit_ | just see the examples basically |
21:48:24 | BlaXpirit_ | but damn, what are the odds that we did the same thing within 4 days T_T |
21:49:38 | flaviu | BlaXpirit_: s/0..MaxSubpatterns-1/MaxSubpatterns |
21:49:42 | * | Sergio965 joined #nim |
21:50:06 | BlaXpirit_ | flaviu, it's not so important. i just wanted to be consistent to the rest of the code |
21:50:24 | flaviu | The rest of the code is old, it was written before that syntax was valid |
21:50:31 | flaviu | but fair enough, I suppose |
21:50:33 | BlaXpirit_ | i guessed so |
21:50:41 | BlaXpirit_ | flaviu, but what about the ideas? |
21:50:54 | flaviu | Also, IMO add(result -> result.add |
21:51:06 | BlaXpirit_ | flaviu, again, consistent to the rest of the code |
21:51:09 | jpoirier | am i abusing result if I'm doing assignments to fields when the return type is a tuple or "object of TObject", e.g. result.err = , result.dev =, etc.? |
21:51:12 | BlaXpirit_ | i wouldn't write it like that othwise |
21:51:36 | BlaXpirit_ | jpoirier, with tuple it probably wouldn't work |
21:51:46 | BlaXpirit_ | but with object it's totally fine and probably best |
21:53:08 | jpoirier | BlaXpirit_: tried it with tuples and it seems to work |
21:53:20 | jpoirier | should it not? |
21:53:38 | BlaXpirit_ | i dunno, in most languages tuples are immutable, so i thought..... |
21:53:44 | flaviu | BlaXpirit_: yeah, it looks good. I don't understand what you mean by "the array of matches is truncated for convenience" |
21:53:49 | BlaXpirit_ | i don't find tuples particularly useful in nim |
21:54:31 | BlaXpirit_ | flaviu, it means the opposite of "and accessing a capture index above the number of actual captures is undefined behavior." |
21:54:49 | BlaXpirit_ | 2 captures - you get array of 2 items |
21:55:12 | flaviu | BlaXpirit_: Same as seqs, you can modify tuples if you keep them in a `var`. |
21:55:25 | flaviu | BlaXpirit_: But out of bounds access *is* undefined behavior |
21:55:29 | BlaXpirit_ | ok, then the name "tuple" is very misleading |
21:55:34 | BlaXpirit_ | flaviu, ok, maybe it is xD |
21:55:42 | BlaXpirit_ | just see my example at the bottom |
21:55:55 | BlaXpirit_ | it allows iteration over captures |
21:56:11 | flaviu | Ah, I see. |
21:57:02 | BlaXpirit_ | flaviu, so yeah, consider that and simpler version that calls proc with just a string |
21:57:13 | BlaXpirit_ | Python actually calls it with both |
21:57:31 | BlaXpirit_ | match[0] is the whole string, and match[1...] is captures |
21:57:37 | BlaXpirit_ | i dunno |
21:57:52 | flaviu | BlaXpirit_: clean up the code so it uses modern style, and I'll rescind my PR. |
21:58:02 | flaviu | I like your ideas better |
21:58:07 | BlaXpirit_ | flaviu, no need to use my code though |
21:58:11 | BlaXpirit_ | you can add to yours |
21:59:05 | BlaXpirit_ | how do I officially license you to use that gist without limitations? :| |
21:59:43 | BlaXpirit_ | ahh it may be problematic with your 2nd commit |
21:59:54 | BlaXpirit_ | because too much performance is lost |
22:00:11 | flaviu | Why would that be? |
22:00:50 | BlaXpirit_ | well that slice "the array of matches is truncated for convenience" may be too much overhead |
22:00:51 | ekarlso- | how can u append to a string ? |
22:01:01 | ldlework | ekarlso-: ... |
22:01:01 | BlaXpirit_ | s.add "x" |
22:01:03 | BlaXpirit_ | i think |
22:01:11 | BlaXpirit_ | i just found out xD |
22:01:12 | flaviu | BlaXpirit_: Have you benchmarked it? I expect it to be nearly free. |
22:01:23 | BlaXpirit_ | flaviu, no idea how to do that |
22:01:29 | ldlework | ekarlso-: please use the docs for such basic questions |
22:01:44 | ekarlso- | ldlework: ya, u be correct |
22:01:53 | BlaXpirit_ | flaviu, consider that it needs to be done for every single replacement |
22:02:03 | BlaXpirit_ | including the basic versions of the function, if your 2nd commit passes |
22:02:19 | BlaXpirit_ | needless overhead |
22:02:20 | * | Sergio965 quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:02:48 | ekarlso- | so nothing like py's foo += "":( |
22:02:53 | BlaXpirit_ | make one? |
22:03:16 | BlaXpirit_ | ekarlso-, &= works |
22:04:16 | flaviu | BlaXpirit_: I think I figured out how you could send it to me. `git format-patch devel --stdout` from your patch branch |
22:04:25 | flaviu | and then just gist and message me it |
22:04:46 | flaviu | Your name appears in the commit logs, and credit is given where it is due. |
22:04:50 | BlaXpirit_ | flaviu, but it kinda conflicts with your 2nd commit, doesn't it? |
22:04:53 | * | gour quit (Quit: Leaving) |
22:05:10 | flaviu | We'll see :) |
22:05:16 | BlaXpirit_ | ... |
22:05:24 | flaviu | I'll benchmark it and everything |
22:10:36 | BlaXpirit_ | flaviu, https://gist.github.com/BlaXpirit/15ed8ea0bc3f35e973fc#file-0001-add-regex-replacement-using-results-of-calling-a-pro-patch |
22:10:47 | BlaXpirit_ | seems kinda counterproductive to use this code though |
22:11:49 | * | gokr_ quit (Ping timeout: 264 seconds) |
22:12:05 | * | gokr_ joined #nim |
22:12:12 | ekarlso- | how can u iterate over k, v of a stringtable? |
22:13:05 | BlaXpirit_ | ekarlso-, for k, v in astringtable |
22:13:17 | BlaXpirit_ | now go read tutorials and manual |
22:14:42 | ekarlso- | BlaXpirit_: yea, i should kinda ^^ |
22:17:52 | * | adam_s joined #nim |
22:19:41 | BlaXpirit_ | damn, flaviu |
22:19:45 | BlaXpirit_ | I already need another usecase |
22:19:52 | BlaXpirit_ | javascript: |
22:19:56 | BlaXpirit_ | text.replace(/\t/g, function(match, offset) { |
22:20:35 | BlaXpirit_ | Python's approach is so universal https://docs.python.org/library/re.html#re.MatchObject |
22:21:08 | flaviu | Yeah, I was thinking similar thoughs |
22:21:19 | flaviu | although I haven't used python's re |
22:21:23 | BlaXpirit_ | you can get string itself, its span, captures, whatever you want |
22:21:26 | Araq | Python's approach doesn't work |
22:21:37 | BlaXpirit_ | ? |
22:21:48 | Araq | match = re.search(pat, s) |
22:21:55 | Araq | if match: |
22:22:09 | Araq | elif (match = re.search(pat, s)) |
22:22:34 | Araq | oh wait, Python doesn't support that so you have to indent the heck out of a match chain |
22:22:57 | BlaXpirit_ | don't forget return |
22:23:12 | Araq | you cannot always 'return' |
22:23:15 | flaviu | I see no arguments against the library design, just against the language syntax. |
22:23:34 | Araq | the library design needs to fit the language |
22:23:54 | flaviu | so make a list of (regex, function) |
22:23:56 | BlaXpirit_ | i get it, but the point is, currently Nim's re library does not fit my needs |
22:24:09 | BlaXpirit_ | and right now I need a use case that isn't even covered by that patch |
22:24:15 | * | infrashortfoo quit (Remote host closed the connection) |
22:24:47 | BlaXpirit_ | honestly, modeling some of the stuff after javascript might be a reasonable idea |
22:25:03 | BlaXpirit_ | because i think regex is one of the few things it got right |
22:25:12 | Araq | yes, but don't copy anything blindly |
22:25:25 | Araq | that's all I'm saying really |
22:26:11 | BlaXpirit_ | i just realized using findBounds directly is not so different to what javascript has |
22:26:37 | flaviu | BlaXpirit_: Javascript's implementation is non-ideal in several ways |
22:27:07 | flaviu | but it also seems to be similar to python |
22:27:07 | gokr | Hard to keep up with this channel. That's good :) |
22:28:07 | flaviu | Honestly, python's API seems nearly perfect. |
22:28:36 | BlaXpirit_ | if you mean just regex, then yeah, it's quite good |
22:29:00 | BlaXpirit_ | (performance is abysmal, i expect, but whatever) |
22:29:00 | flaviu | I'm looking at MatchObject's API |
22:29:04 | BlaXpirit_ | yes |
22:29:14 | BlaXpirit_ | and what does it need? 2 numbers and a reference to string or something |
22:29:18 | BlaXpirit_ | the rest would be procs |
22:29:27 | flaviu | yep, and we could do lazy string slicing! |
22:29:45 | BlaXpirit_ | so many amazing things can be done in nim |
22:29:59 | flaviu | "Don't need this match? Ok, we won't do an allocation for it." |
22:30:15 | BlaXpirit_ | let's just go ahead and copy python's standard library |
22:30:45 | * | saml_ quit (Quit: Leaving) |
22:31:01 | flaviu | BlaXpirit_: Ok, you read over man pcreapi :P |
22:31:09 | BlaXpirit_ | flaviu, why? |
22:31:29 | flaviu | just joking, it's extremely long and extensive |
22:31:32 | BlaXpirit_ | lol ok |
22:31:39 | BlaXpirit_ | we can copy from existing nim implementation too |
22:31:59 | flaviu | It'll be more fun if we don't. |
22:32:09 | flaviu | We can use the pcre module to save a bit of work tho |
22:32:13 | BlaXpirit_ | i have a bit different notion of fun |
22:32:54 | BlaXpirit_ | if everything is done, i don't see why we shouldn't look at it |
22:33:44 | flaviu | Ok. |
22:34:11 | BlaXpirit_ | now, how serious are we here? |
22:34:24 | flaviu | I'm completely serious. |
22:34:56 | BlaXpirit_ | so we're planning to implement a library in Nim that follows Python's re |
22:35:03 | BlaXpirit_ | whatever, i've got time |
22:36:38 | * | irrequietus quit () |
22:38:38 | BlaXpirit_ | aha, i just realized... what about unicode? |
22:39:05 | * | Sphax quit (Read error: Connection reset by peer) |
22:39:38 | * | Sphax joined #nim |
22:39:58 | Araq | we have over 350 open issues. do you really think a new re module is what people want? |
22:40:07 | Araq | and need the most? |
22:40:23 | BlaXpirit_ | no |
22:40:36 | * | yglukhov_____ quit (Quit: Be back later ...) |
22:40:38 | flaviu | Araq: You know that the compiler is scary. |
22:40:54 | Araq | flaviu: there are open issues for the stdlib too |
22:41:08 | Araq | others affect the docs |
22:41:20 | Araq | we even have an 'easy' tag |
22:42:35 | BlaXpirit_ | that MaxSubpatterns tho :| |
22:42:49 | Araq | that is already mostly gone |
22:43:07 | BlaXpirit_ | reEmail can be so harmful |
22:43:31 | * | superfunc|busy quit (Ping timeout: 256 seconds) |
22:43:35 | wtw | is it possible that my compiler (0.9.2) doesn't know 'generic' as in type foo = generix x,y? |
22:43:49 | BlaXpirit_ | 0.9.2 is unforgivably old |
22:43:57 | wtw | FreeBSD port :/ |
22:44:17 | Araq | reEmail was added from a blog post about how to match emails, BlaXpirit_ |
22:44:29 | wtw | or rather package but the source port is equally old |
22:44:37 | BlaXpirit_ | Araq, okay, but it's completely wrong |
22:44:37 | Araq | I didn't came up with it, it seemed a credible source |
22:44:58 | BlaXpirit_ | list of top-level domains is ever growing |
22:45:18 | flaviu | It's best to let the user to come up with their own stupid regular expressions. |
22:45:22 | Araq | note that it matches realworld email addresses and not the RFC, but yes, it's totally outdated |
22:45:30 | Araq | *matched |
22:45:40 | BlaXpirit_ | doesn't match [email protected] |
22:46:08 | Araq | make a PR, deprecate it |
22:46:12 | Araq | later we'll remove it |
22:46:19 | Araq | how hard can it be? |
22:46:35 | dom96 | dtscode: My tab size is the Nim convention. |
22:46:51 | dtscode | its still too small |
22:46:57 | BlaXpirit_ | can't help but agree with dtscode though |
22:47:15 | dtscode | also thanks dom96 |
22:49:46 | * | yglukhov_____ joined #nim |
22:49:46 | * | yglukhov_____ quit (Client Quit) |
22:51:45 | * | yglukhov_____ joined #nim |
22:52:48 | * | tinAndi quit (Quit: ChatZilla 0.9.91.1 [Firefox 34.0/20141125180439]) |
22:56:15 | * | yglukhov_____ quit (Ping timeout: 252 seconds) |
22:56:51 | * | z1y joined #nim |
22:57:23 | * | z1y quit (Remote host closed the connection) |
22:57:43 | * | z1y joined #nim |
23:00:55 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:01:41 | * | hasenj quit (Quit: hasenj) |
23:05:46 | BlaXpirit_ | omg this is so sad |
23:05:58 | * | aw1231 joined #nim |
23:06:08 | BlaXpirit_ | "1234"[.. 0] == "1" |
23:06:12 | BlaXpirit_ | s[.. -1] == "1234" |
23:07:10 | aw1231 | Hi, I'm having some trouble compiling Aporia. I get "Error: unhandled exception: assignment to discriminant changes object branch [Fi eldError]" |
23:08:44 | * | Trustable quit (Quit: Leaving) |
23:10:45 | * | z1y quit (Quit: Leaving.) |
23:13:46 | * | yglukhov_____ joined #nim |
23:15:02 | Araq | aw1231: does the compiler say that or aporia? |
23:15:10 | * | adam_s quit (Quit: Leaving) |
23:15:53 | aw1231 | I think it's the compiler. I run "nim c aporia". |
23:16:53 | Araq | which version of the compiler? |
23:17:23 | aw1231 | The latest. I use the "devel" branch. |
23:27:45 | Araq | try master please. devel is broken |
23:28:47 | gokr | BlaXpirit_: Good work there on nim-csfml! |
23:28:56 | BlaXpirit_ | ok thanks |
23:29:02 | BlaXpirit_ | people look at the lib and say it's good |
23:29:08 | BlaXpirit_ | but has anyone tried to put it to use? |
23:29:46 | gokr | It might come handy for us, not sure yet. Parts of it. |
23:32:32 | * | areckizb joined #nim |
23:37:30 | * | dapz joined #nim |
23:43:29 | * | JinShil joined #nim |
23:45:14 | * | Sphax quit (Quit: CYA!!) |