00:03:38 | filwit | Varriount: i know this out of the blue, but we where talking about this gist I made the other day: https://gist.github.com/PhilipWitte/2d167c888f95e67f0292 and you mentioned it's virtually identical to inheritance and I agreed.. but I was actually wrong, this is automated composition, not inheritance, and is more compact (because there's no need for a typeDesc ptr for 'of' comparison) |
00:05:55 | * | superfunc quit (Ping timeout: 252 seconds) |
00:09:17 | * | gsingh93 quit (Ping timeout: 265 seconds) |
00:10:47 | Araq | dtscode: what? o.O I disagree. |
00:12:09 | vikaton | ofc Araq does |
00:13:38 | Araq | er ... not anymore |
00:14:07 | vikaton | by does i mean disagree |
00:15:28 | Araq | lol |
00:17:39 | * | vendethiel joined #nim |
00:18:56 | filwit | Araq: what does TLoc handle? this is an abstraction of a pointer/ref? |
00:19:33 | Araq | nah, it's "info the backend needs" |
00:19:35 | filwit | nevermind, it's in ast.nim |
00:19:39 | filwit | i found it |
00:19:49 | Araq | and yes, it's a strange name. |
00:20:02 | Araq | I thought of "Location" when I gave it a name |
00:20:42 | filwit | btw, '.s' in this case is actually a TStorageLoc not string :P |
00:20:55 | Araq | ah yeah |
00:21:15 | Araq | feel free to rename it |
00:21:25 | dtscode | <Araq> dtscode: what? o.O I disagree. |
00:21:27 | filwit | we need refactoring tools so cleaning up this kind of thing would be easy |
00:21:40 | filwit | Araq: wait what? i can rename these? |
00:21:40 | Araq | yup. |
00:21:46 | ozra | filwit: so something go-langy? |
00:21:47 | dtscode | I can't trust what you say so long as you disagree with the unix philosophy :p |
00:21:58 | dtscode | Oh please nothing go-langy |
00:22:13 | Araq | oh wait |
00:22:19 | Araq | nimfix can do renamings |
00:22:39 | filwit | buggy? |
00:22:46 | ozra | dtscode: I was refering to the "automated composition". afaik golang has no inheritance at all, but uses composition and automated forwarding of methods.. |
00:22:50 | Araq | you need to write {.deprecated: [TLoc, BackendInfo].} and then sit back |
00:23:04 | dtscode | ozra: eh |
00:23:07 | filwit | well I am not going to start hacking on that yet |
00:23:21 | ozra | dtscode: never mind ;-) |
00:24:04 | vikaton | hacking is illegal ! |
00:24:18 | ozra | dtscode: was wondering what it could be compared too.. fogeddabout golang! |
00:24:31 | filwit | i do think some of this should be refactorred in the future if nimfix actually works well.. it would make reading through and understand the compiler much easier if some common symbols had more descriptive names.. but they should also be somewhat consistent, so I should refrain from just renaming things at random. |
00:24:38 | dtscode | vikaton: er no its not |
00:24:45 | dtscode | ozra: I try every day |
00:25:28 | Araq | filwit: nimfix was used on the compiler itself extensively and produced near perfect results. that said, it has a few bugs left. |
00:26:03 | ozra | dtscode: the garbage collection is so slow - your memory wiiil be wiped out - right after ragnarök.. |
00:27:10 | filwit | Araq: great. I was under the impression you wanted the compiler code exactly how it is.. if you're receptive to name changes I will look through the compiler later and make specific PRs for renames. |
00:27:25 | vikaton | Araq, you dont need to explain properly and just answer this simple question, when "not nill" is invoked on a type, is it impossible for that type to have the value of nil? |
00:29:05 | Araq | vikaton: yes. |
00:29:11 | filwit | vikaton: theoretically if you hack it that way.. but the common conditions, eg object constructors, wont allow it. |
00:29:22 | vikaton | I see |
00:29:42 | vikaton | can we invoke primitive types with `not nil` ? |
00:30:07 | Araq | primitive types are not nilable to begin with |
00:30:31 | vikaton | pointers ? |
00:31:30 | filwit | vikaton: type A = object x: ptr int not nil; let a = A() # error, 'x' has to be set |
00:32:40 | vikaton | so if that's the case, then null pointers arent even a concept if you keep using that type'A'? |
00:33:16 | filwit | eh? |
00:33:17 | vikaton | I'm interested in this whole null pointer things, idk why |
00:33:53 | fowl | vikaton: you can also view null as a distinct state |
00:33:54 | dtscode | A null pointer is just one that doesn't point at anything vikaton |
00:34:13 | vikaton | Yes I am aware |
00:34:21 | * | BitPuffin|osx joined #nim |
00:34:38 | vikaton | but lets say we use filwit's example of invoke not nil on pointer type A |
00:35:01 | dtscode | I don't know enough nim anymore to understand what you said :p |
00:35:07 | dtscode | I'm more of a C guy now |
00:35:15 | vikaton | A can never be "nothing" |
00:35:23 | filwit | Araq: a Rope is a variable path? I thought Ropes where just strings optimized for a lot of mutation.. but it looks like they're being used as path identifiers in TLoc |
00:35:24 | vikaton | Im more of a Nim noob than any1 here |
00:36:55 | filwit | vikaton: 'not nil' just means the compiler tries it's best to prevent you from passing a nil var to that member/parameter, so you don't have to explicitly check for nil in your code everywhere. |
00:37:39 | filwit | vikaton: not sure how much runtime overhead that implies actually |
00:37:45 | filwit | (if any) |
00:37:58 | Araq | filwit: ropes are just stupid strings |
00:38:04 | vikaton | filwit, so if not nil is invoked on a ptr like in ur example, then dereferencing null A pointers is impossible? |
00:38:05 | filwit | k |
00:38:10 | filwit | ^ Araq |
00:38:28 | dtscode | <Araq> filwit: ropes are just stupid strings |
00:38:29 | filwit | vikaton: no you get a compiler error |
00:38:29 | dtscode | :D |
00:38:32 | Araq | dtscode: why not c++? |
00:38:50 | dtscode | Araq: Because I was stupid and wanted to see if I could write a command shell in C |
00:39:03 | filwit | vikaton: wait.. i'm not sure what you're asking.. |
00:39:15 | * | vendethiel quit (Ping timeout: 265 seconds) |
00:39:27 | Araq | but hey, it was alreay obvious you're a masochist when you implied you like Unix ;-) |
00:39:32 | dtscode | ^ |
00:39:55 | vikaton | filwit: undefined behavior is impossible to happen because you cannot dereference a pointer type that does not allow nill values |
00:39:58 | vikaton | correct? |
00:40:13 | filwit | yes, basically |
00:40:23 | dtscode | I typically use c++ for IRC stuff, nim for stuff I want to experiment with, C for low level-small run time things, perl for quick and dirty things, and python for everything else |
00:40:28 | vikaton | cool |
00:40:57 | vikaton | I may not be seeing `not nil` in the bigger picture however, feel like im missing something |
00:41:13 | filwit | it does things like this: proc foo(x:ptr int not nil); foo(nil) # compiler error on this call |
00:41:44 | vikaton | filwit, couldnt you just make a type for a pointer than cannot be nil |
00:41:48 | vikaton | then use that pointer everywhere? |
00:41:55 | filwit | an you must prove to the compiler that something is not nil (via if statement) to be able to call 'foo' at all |
00:42:15 | filwit | vikaton: yes |
00:42:18 | vikaton | and use a generic for the type that the ptr will be |
00:42:49 | vikaton | so you dont have to write var A: ptr int |
00:42:56 | vikaton | but could int be T ? |
00:42:58 | filwit | vikaton: use a generic for what? i'm not sure what you're thinking, but you can do: type NotNilIntPtr = ptr int not nil |
00:43:18 | vikaton | what types of ptrs are there? |
00:43:31 | filwit | ptrs are just unsafe pointers |
00:43:51 | filwit | they don't have a 'type' really without a context (eg, `ptr int`) |
00:44:05 | vikaton | I see |
00:44:20 | vikaton | to end this so I can get a solid idea |
00:44:33 | filwit | you can use a 'pointer' for general purpose unsafe points (same as void* in C) |
00:45:17 | filwit | but using unsafe pointers and stuff isn't the first things you should be trying to do in Nim (unless that's what you're looking to use Nim for of course) |
00:45:37 | vikaton | yeah ik, just trying to wrap my head around this |
00:45:39 | * | dddddd quit (Ping timeout: 246 seconds) |
00:45:53 | vikaton | so a person uses pointers in a small Nim program |
00:46:11 | vikaton | only 1 pointer, ptr int |
00:46:46 | vikaton | he uses that ptr around alot, and some runtime variables can cause a null pointer dereference |
00:47:13 | vikaton | if he decalred a ptr int type 'newptr' that has `not nil` invoked on it |
00:47:22 | vikaton | the null pointer deref is a compile time error? |
00:48:16 | filwit | well 'not nil' doesn't prevent you from free'ing memory the ptr is pointing at, so the main memory safety issue of unsafe points aren't addressed with 'not nil' |
00:48:37 | filwit | only a sub-set of issues, and it's also for safe references |
00:50:02 | filwit | 'not nil' just prevents you from assigning to the ptr when the compiler can't guarantee the value is 'not nil' |
00:50:33 | vikaton | filwit: Sure it cant prevent you from freeing, but im talking about dereferencing it |
00:50:40 | vikaton | will turn into a compiler error? |
00:51:15 | filwit | we'd need some sort of ownership/lent model (similar to Rust) to be able to use non-RC refs 'safely' in Nim.. and while that's possible, it's not going to happen any time soon I don't think (it will be really cool when it does though) |
00:51:41 | Araq | no, why would it? dereferencing is fine cause it can never be 'nil'. |
00:51:50 | Araq | that's what 'not nil' means. |
00:52:36 | filwit | yeah it will prevent you from derefing nil (in almost all cases), but it doesn't prevent you from using garbage memory |
00:52:47 | filwit | which is what refs are for |
00:53:44 | filwit | so the combination of refs + not nil means the your code won't accidentally deref nil or hit garbage |
00:54:07 | vikaton | perfect |
00:54:50 | filwit | Araq: does 'not nil' have a runtime overhead anywhere? I can't think of any.. |
00:55:00 | ozra | Araq: Do you have a sec. to do quick feedback on https://github.com/Araq/Nim/pull/2833 - I'd like to wrap it up get the changes you need done, and get goin on finding some bug on the issue-list I might be able to take care of... |
00:55:11 | filwit | too bad making 'not nil' default would break every line of Nim code ever written... |
00:55:26 | Araq | filwit: no runtime overhead |
00:55:31 | filwit | nice |
00:55:42 | Araq | however I disagree that it should be the default |
00:56:26 | vikaton | filwit: it would break it because lots of Nim code have Null pointers? |
00:57:02 | filwit | vikaton: no it would break because it would require 'not nil' proof where there currently isn't any |
00:57:48 | vikaton | o rite |
00:57:51 | vikaton | hmm |
00:58:37 | filwit | it's really not an issue, as Araq said the arguments for not-nil as default are debatable, but both sides have good reasoning |
00:59:23 | vikaton | wow `not nil` annotations are cool |
00:59:39 | vikaton | a good safety option with no overhead |
00:59:43 | filwit | yep :) |
01:00:54 | vikaton | and people still whine about Nim's "undefined behavior" |
01:00:59 | vikaton | some ppl smh |
01:01:04 | vikaton | brb screencasting Nim |
01:01:57 | vikaton | Araq, are uninitialized variables 'nil' ? |
01:04:23 | vikaton | anything dealing with numbers are zero'd out |
01:04:24 | filwit | vikaton: by default new objects are 'reset' to a default state (you can avoid this, for micro performance, via {.noinit.}).. the default for ref/ptr is nil, yes |
01:05:27 | filwit | unlike C where new objects are garbage, Nim opts for useful defaults unless explicitly stated otherwise (cause that's the only sane thing to do) |
01:05:58 | vikaton | mhm |
01:06:27 | vikaton | filwit, when you declare a type of pointer with `not nil` and you initialize it, what's its vale? |
01:06:29 | vikaton | value* |
01:06:41 | filwit | whatever you set it too |
01:06:49 | filwit | and you have to set it to something because of the 'not nil' |
01:07:09 | filwit | you should just try these things out in a test Nim file real quick |
01:07:24 | vikaton | I am |
01:07:40 | vikaton | hmm |
01:10:31 | vikaton | Im getting an invalid indentation with your example filwit |
01:10:36 | vikaton | when it is indented properly :/ |
01:11:27 | filwit | idk what code you talking about, but object members can't be on the same line as the 'object' (which my first code line did for the sake of illustration) |
01:11:51 | filwit | make a gist/pastebin please |
01:13:05 | vikaton | https://www.irccloud.com/pastebin/tNxcRbsx |
01:13:08 | vikaton | filwit: ^ |
01:14:02 | filwit | vikaton: put a return after 'object' |
01:14:28 | filwit | so make 'x: ptr int not nil' on it's own line (extra indentation optional) |
01:14:48 | filwit | er wait, no it needs an extra indentation |
01:15:07 | filwit | type A = object |
01:15:12 | filwit | x: ptr int not nil |
01:15:18 | vikaton | yeah I got it |
01:15:24 | vikaton | but I dont know its value |
01:15:27 | vikaton | cannot echo it |
01:16:10 | filwit | you should not be able to create an instance of A without providing a valid non-nil value for A.x |
01:16:32 | filwit | your 'let a: A' line is wrong for multiple reasons |
01:16:42 | vikaton | it compiles though |
01:17:10 | filwit | that sounds like a bug, or just the compiler seeing that you aren't using 'a' at all so it discards errors on that |
01:17:46 | vikaton | filwit, my bad, chnaged let to var |
01:18:03 | * | jbomo joined #nim |
01:18:11 | vikaton | but cannot echo once again, so Im not sure what the value of a is right now |
01:18:47 | filwit | because A isn't properly setup (eg, by default A's x value is nil, which cannot be due to the 'not nil' annotation) |
01:18:54 | filwit | do this: |
01:19:03 | filwit | var x = 123 |
01:19:12 | filwit | var a = A(x:addr x) |
01:19:17 | filwit | echo a.x |
01:20:08 | filwit | you may actually hit a 'cannot prove 'addr x' is not nil' with that code, btw.. |
01:20:17 | filwit | so you might have to do... |
01:20:19 | filwit | var x = 123 |
01:20:26 | filwit | var y = addr x |
01:20:34 | filwit | if y != nil: |
01:20:42 | filwit | var a = A(x:y) |
01:20:45 | filwit | echo a.x |
01:20:57 | Araq | the compiler knows that 'addr' cannot be nil in this case |
01:21:03 | filwit | okay |
01:22:54 | filwit | Araq: So I think i've found what to change for nil-check errors (the lines with 'putIntoDest').. but i'm not sure how to compose a 'if x != nil: ...' statement here.. |
01:23:04 | filwit | er wait, you told me to look up something before, one sec.. |
01:24:01 | filwit | Araq: hmm.. nimgrep isn't finding anything for 'optOverflowChecks' |
01:24:23 | filwit | (yes, and using -y) |
01:24:38 | Araq | optOverflowCheck |
01:24:59 | filwit | thanks |
01:27:26 | filwit | oh i see, that's about the {.push nilChecks:on.} functionality |
01:27:30 | filwit | i'm not there yet |
01:27:42 | filwit | idk how to compose the if-stmt |
01:27:56 | Araq | proc raiseNilError() {.compilerproc, noreturn, noinline.} = |
01:27:57 | Araq | sysFatal(NilError, " nil pointer dereference") |
01:28:07 | Araq | # add to lib/system/chcks.nim |
01:28:25 | Araq | and then you can use #raiseNilError(); in the C codegen |
01:28:28 | vikaton | I thought nilChecks didnt exist yet |
01:28:35 | Araq | note the hash symbol |
01:28:54 | Araq | and again, see how other parts of the codegen deal with it |
01:29:12 | filwit | kk |
01:29:40 | Araq | vikaton: filwit is implementing for practice |
01:29:52 | vikaton | O |
01:30:10 | * | endragor joined #nim |
01:31:24 | filwit | Araq: looks like you already added it as 'chckNil' |
01:31:49 | Araq | yeah but that raise a value error |
01:32:00 | Araq | also you shouldn't do the check in there |
01:32:00 | filwit | yeah i just noticed that |
01:32:10 | Araq | you should emit the check inline |
01:32:21 | filwit | yeah that's what was confusing me about this |
01:32:23 | Araq | otherwise perf will suck |
01:32:49 | filwit | that's what I meant by not knowing how to 'compose' the if |
01:33:54 | filwit | searching for a genIf.. |
01:40:51 | * | Jessin joined #nim |
01:41:16 | * | Jesin quit (Disconnected by services) |
01:41:18 | * | Jessin is now known as Jesin |
01:48:16 | Araq | ok, we have email validation now |
01:48:28 | Araq | the spammer are still here with us |
01:53:55 | * | kumool quit (Read error: Connection reset by peer) |
01:54:20 | * | kumool joined #nim |
01:56:28 | * | johnsoft quit (Ping timeout: 264 seconds) |
01:57:21 | * | johnsoft joined #nim |
01:59:21 | vikaton | Araq, email validation for? |
02:03:56 | * | darkf joined #nim |
02:05:53 | * | johnsoft quit (Ping timeout: 256 seconds) |
02:06:34 | * | johnsoft joined #nim |
02:10:11 | * | endragor quit (Remote host closed the connection) |
02:13:52 | * | endragor joined #nim |
02:16:18 | * | BitPuffin|osx quit (Ping timeout: 246 seconds) |
02:17:47 | * | endragor quit (Remote host closed the connection) |
02:19:09 | * | endragor joined #nim |
02:31:49 | * | vikaton quit () |
02:42:43 | * | dtscode quit (Read error: Connection reset by peer) |
02:44:46 | * | dtscode joined #nim |
02:49:20 | * | flaviu quit (Remote host closed the connection) |
02:50:25 | * | vendethiel joined #nim |
02:57:04 | * | ozra quit (Ping timeout: 246 seconds) |
03:03:01 | * | flaviu joined #nim |
03:15:58 | * | ddl_smurf quit (Quit: ddl_smurf) |
03:20:09 | * | endragor quit (Remote host closed the connection) |
03:21:04 | * | Jesin quit (Quit: preparing to land) |
03:23:11 | * | endragor joined #nim |
03:23:51 | * | endragor quit (Remote host closed the connection) |
03:52:37 | * | vendethiel quit (Ping timeout: 244 seconds) |
03:53:45 | * | johnsoft quit (Ping timeout: 240 seconds) |
03:54:49 | * | johnsoft joined #nim |
04:02:25 | * | endragor joined #nim |
04:04:41 | * | endragor quit (Remote host closed the connection) |
04:06:27 | * | endragor joined #nim |
04:12:05 | * | colectora joined #nim |
04:13:37 | * | endragor quit (Remote host closed the connection) |
04:17:40 | * | gsingh93 joined #nim |
04:18:52 | * | colectora quit (Quit: Leaving) |
04:20:10 | * | TEttinger joined #nim |
04:32:33 | * | endragor joined #nim |
04:33:09 | * | rgv151 quit (Quit: Leaving...) |
04:40:29 | dtscode | Hey guys... How would I get a TimeInfo to use with format from the times lib? |
04:41:40 | Varriount | dtscode: http://nim-lang.org/docs/times.html#getGMTime,Time |
04:41:46 | dtscode | Thanks |
04:41:56 | Varriount | dtscode: You can also search the index - http://nim-lang.org/docs/theindex.html |
04:42:01 | dtscode | Now how do I get a time? |
04:42:03 | dtscode | Eh good point |
04:43:14 | Varriount | dtscode: It might be something you have to allocate and then initialize, rather than get directly from a procedure. |
04:43:33 | dtscode | hrmmm |
04:44:31 | Varriount | eg "var t: TimeInfo; procInitializingTimeInfo(t)" |
04:46:23 | Varriount | dtscode: Looks like you can do 'var ti = getLocalTime(getTime())' |
04:47:25 | dtscode | Thanks :D |
04:48:01 | Varriount | dtscode: Or ''var ti = getGMTime(getTime())' |
04:48:48 | * | zaquest joined #nim |
04:48:55 | Varriount | Hello zaquest |
04:50:53 | zaquest | Hello |
04:55:47 | * | kumool quit (Quit: Leaving) |
05:03:42 | dtscode | Varriount: Thanks for the help. One final problem |
05:03:48 | dtscode | Is christmas the 24th or the 25th? |
05:04:02 | filwit | 25th |
05:04:41 | dtscode | thanks |
05:44:13 | * | intra joined #nim |
05:47:58 | * | dapz joined #nim |
05:51:16 | * | gsingh93 quit (Ping timeout: 256 seconds) |
05:53:45 | * | jbomo quit () |
06:05:33 | * | vendethiel joined #nim |
06:17:19 | * | endragor_ joined #nim |
06:17:42 | * | dapz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
06:19:49 | * | endragor quit (Ping timeout: 245 seconds) |
06:24:50 | * | themagician quit (Ping timeout: 265 seconds) |
06:30:45 | * | themagician_a joined #nim |
06:30:45 | * | vendethiel quit (Ping timeout: 258 seconds) |
06:31:23 | * | dapz joined #nim |
06:33:13 | * | dapz quit (Client Quit) |
06:34:30 | * | mAch17 joined #nim |
06:35:11 | * | skyfex_____ quit (Quit: (null)) |
06:35:19 | * | mAch17 quit (Client Quit) |
06:36:45 | * | dapz joined #nim |
06:41:08 | Varriount | Araq: Just so you know, I'm modifying the builder IRC bot to spit out more terse build replies. |
07:04:48 | * | endragor joined #nim |
07:05:52 | pigmej | reactormonk: ping |
07:06:02 | reactormonk | pigmej, pong, but gotta sleep soon |
07:06:59 | pigmej | I saw your questions about backend https://github.com/proofit404/company-anaconda/blob/master/company-anaconda.el |
07:07:22 | reactormonk | pigmej, could you put that stuff into the issue? |
07:07:24 | * | namra joined #nim |
07:07:36 | pigmej | sure :) |
07:08:36 | namra | greetings |
07:08:45 | reactormonk | namra, o/ |
07:08:46 | namra | what version is reflected in the official docs? |
07:08:53 | * | endragor_ quit (Ping timeout: 265 seconds) |
07:09:01 | reactormonk | master usually |
07:09:12 | reactormonk | for more bugfixes, go for devel |
07:09:38 | Varriount | namra: The top of the standard library documentation has the version number. :) |
07:09:42 | Varriount | Version: 0.11.2 |
07:10:06 | namra | http://nim-lang.org/docs/asyncnet.html --- mentions to create an SSL socket one needs to create a ssl context and then wrap that with the async socket via wrapSocket |
07:10:26 | namra | but the net documentation doesn't show newContext or wrapSocket |
07:10:44 | namra | http://nim-lang.org/docs/net.html |
07:11:02 | Varriount | namra: That's likely a documentation error. |
07:11:40 | Varriount | If I had to guess, I'd say that the mentioned procedures are only defined when --d:ssl is defined. |
07:12:03 | Varriount | And if the docgen was run without the -d:ssl flag... |
07:12:37 | namra | that might be possible |
07:13:05 | Varriount | namra: So the best way would be to check the source code, which isn't hard. |
07:13:24 | namra | Varriount: just what i did ^^ |
07:13:50 | Varriount | namra: If my guess turns out to be true, then there should be a 'when defined(ssl)' around the procedure definition. |
07:14:35 | namra | yes |
07:14:56 | Varriount | That needs to be changed into a 'when defined(ssl) or defined(NimDoc):' |
07:15:30 | Varriount | (Which hopefully won't break anything when the documentation generator gets run... :/ |
07:15:35 | Varriount | ) |
07:19:22 | * | endragor quit (Remote host closed the connection) |
07:19:51 | * | endragor joined #nim |
07:24:05 | * | endragor quit (Ping timeout: 250 seconds) |
07:26:46 | * | BlaXpirit joined #nim |
07:32:49 | * | yglukhov joined #nim |
07:59:50 | * | ddl_smurf joined #nim |
08:03:52 | * | coffeepot joined #nim |
08:11:48 | * | shevy joined #nim |
08:13:54 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:17:23 | * | endragor joined #nim |
08:17:26 | * | endragor quit (Remote host closed the connection) |
08:17:55 | * | endragor joined #nim |
08:21:48 | * | shodan45 quit (Read error: Connection reset by peer) |
08:22:24 | * | shodan45 joined #nim |
08:25:25 | * | Ven joined #nim |
08:26:26 | * | Trustable joined #nim |
08:30:16 | * | ingsoc joined #nim |
08:39:52 | * | rozovr joined #nim |
08:44:04 | * | rozovr quit (Client Quit) |
08:49:51 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:51:59 | * | Ven joined #nim |
08:53:18 | * | Dragonbird joined #nim |
08:58:03 | * | OnO joined #nim |
09:08:29 | * | boopisaway is now known as boop |
09:12:08 | * | Tennis joined #nim |
09:12:08 | * | Tennis quit (Changing host) |
09:12:08 | * | Tennis joined #nim |
09:13:00 | * | milosn quit (Ping timeout: 256 seconds) |
09:13:16 | * | milosn joined #nim |
09:14:10 | * | Dragonbird quit (Quit: This computer has gone to sleep) |
09:19:47 | * | Demon_Fox quit (Quit: Leaving) |
09:21:26 | Varriount | Araq: Just an FYI, the 'deepcopy', 'static_t', 'gcbugfix', and 'caas' branches won't build using a compiler generated from csources. Do you want me to generate a fresh csources and push it to the repository? |
09:24:32 | Araq | Varriount: no, these don't build with any version of Nim |
09:24:48 | Araq | static_t is for zahary to work with |
09:25:03 | Araq | more_concurrency is where the exciting new stuff happens |
09:25:34 | Araq | the other branches should be removed |
09:26:44 | Varriount | Araq: Ah, ok. I was doing some checking up on the buildbot, and was wondering what was going on. |
09:27:19 | Araq | sorry didn't know the bot cares about anything other than 'devel' and 'master' |
09:28:13 | Varriount | Araq: I think I can apply a filter, but I don't see any reason to. The builds fail early on, so it's not like a huge amount of computational power is going to waste. |
09:28:52 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:28:52 | * | vendethiel joined #nim |
09:29:15 | Araq | yeah plus more_concurrency should build and work with all the tests |
09:29:41 | Araq | er ... except the async stuff |
09:31:23 | fowl | Araq: in wrote some tests to make sure capturing refs in the unsafe way I am works and uh...it seems to mostly just work |
09:32:05 | Araq | that's good to hear... "mostly just works" |
09:32:33 | * | Dragonbird joined #nim |
09:33:05 | Varriount | Araq: The more_concurrency branch compiles. |
09:33:07 | fowl | I only need to decref when reassigning a slot or destroying the object |
09:33:08 | Araq | you need to stress test it though with -d:useGcAssert -d:useSysAssert and playing around with all the combinations in mmdisp.nim |
09:33:41 | Varriount | It didn't compile for the win-64 builder, but that was because I had accidentally deleted gcc. |
09:33:55 | Varriount | :< |
09:34:41 | fowl | Araq: thanks I will |
09:35:50 | Varriount | fowl: I mentioned you in a forum post. |
09:37:20 | fowl | :o |
09:47:37 | * | namra quit (Quit: WeeChat 1.2) |
09:49:24 | * | bluenote_ joined #nim |
09:51:25 | * | vendethiel quit (Ping timeout: 255 seconds) |
10:02:33 | * | vendethiel joined #nim |
10:03:54 | * | gokr left #nim (#nim) |
10:08:37 | * | gokr joined #nim |
10:10:33 | * | dapz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
10:11:50 | * | Dragonbird quit (Quit: This computer has gone to sleep) |
10:13:27 | * | johnsoft quit (Ping timeout: 265 seconds) |
10:13:52 | * | johnsoft joined #nim |
10:23:34 | * | vendethiel quit (Ping timeout: 245 seconds) |
10:29:47 | * | vendethiel joined #nim |
10:41:43 | * | BlaXpirit quit (Quit: Quit Konversation) |
10:44:41 | OnO | Araq: hi, I am working on other solution, ability to trigger custom macro pass on current invoking statemt from macro once the statement sema is complete, eg. wrapCurrentStmt(NimNode macroSym) |
10:44:46 | OnO | Araq: what do you think about that? |
10:45:20 | Araq | OnO: you have just described how TR macros work. |
10:46:39 | OnO | correct me if I am wrong, but currently macro has an access only to the AST part it gets as callsite |
10:46:56 | OnO | the problem is that I need to add extra optimization pass on the statement invoking the macro |
10:47:25 | * | BlaXpirit joined #nim |
10:47:40 | OnO | otherwise programmer will need to type "optimize:" before each statement explicitly |
10:48:14 | Araq | no no no, this is exactly the problem that TR macros solve |
10:48:31 | Araq | to get rid of the explicit 'optimize' |
10:48:34 | OnO | can you please elaborate more, or point me to some example? |
10:49:35 | Araq | template optAdd{x = y; x.add(y)}(x, y: expr): expr = x = y & z |
10:49:55 | Araq | you should watch my strange loop talk |
10:50:10 | OnO | aaa.... gotcha! |
10:50:38 | Araq | but I suspect you need to improve the pattern sublanguage for your needs |
10:50:47 | OnO | you bring me the enlightenment sir! :) |
10:51:05 | OnO | cool, I'll try that |
10:52:10 | * | vendethiel quit (Ping timeout: 255 seconds) |
10:55:43 | * | vendethiel joined #nim |
11:03:10 | * | dddddd joined #nim |
11:09:25 | * | TEttinger quit (Ping timeout: 264 seconds) |
11:14:51 | OnO | Araq: so as far I reckon TR macros not yet support complex statements? |
11:15:39 | Araq | in theory they do |
11:16:59 | * | thotypous joined #nim |
11:17:44 | * | xcombelle joined #nim |
11:18:16 | OnO | hmm.. can't find any example that will match to simple if x > 1: anystmt |
11:18:26 | * | vendethiel quit (Ping timeout: 272 seconds) |
11:19:31 | Araq | template optIf{if 1 < x: anystmt}(x: SomeType) |
11:19:50 | Araq | note that the template rewritings can bite you |
11:20:01 | Araq | x > 1 is transformed to 1 < x |
11:20:18 | Araq | and the pattern language doesn't do these substitutions yet iirc |
11:21:11 | * | synthmeat quit (Quit: WeeChat 1.3-dev) |
11:21:37 | * | vendethiel joined #nim |
11:23:44 | * | Dragonbird joined #nim |
11:24:23 | * | synthmeat joined #nim |
11:28:27 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
11:30:34 | OnO | template optIf{if 1 < x: anystmt}(x: int) does not trigger on if 1 < x: echo x |
11:31:18 | Araq | what's 'anystmt'? |
11:31:35 | Araq | (it's not declared in the parameter list) |
11:33:04 | OnO | aaa.... I thought it is some matching wildcard |
11:33:16 | OnO | then how to match the whole block? |
11:35:19 | OnO | oh well... maybe it is not necessary after all I think more, maybe I can match just field reads & writes, and ensure data is loaded before them |
11:35:40 | * | bjz joined #nim |
11:37:13 | OnO | what's the order of TR are getting executed? order they are declared? |
11:38:03 | * | filwit quit (Quit: Leaving) |
11:40:06 | OnO | another Q: how do I match field access (aka dot access) for any field? |
11:44:31 | Araq | yes, order they are declared |
11:44:33 | * | vendethiel quit (Ping timeout: 272 seconds) |
11:45:04 | OnO | tests/trmacros/tdisallowif.nim seems to not work :( |
11:45:09 | Araq | template dotAccess{x.y}(x: Type, y: expr) |
11:45:25 | Araq | yeah I know, it worked at one point |
11:45:57 | Araq | I think it's because of the lambda lifting pass that introduces empty nodes for potential closure creation |
11:48:20 | Araq | trees.flattenStmts doesn't handle nkEmpty |
11:48:34 | Araq | patterns.nim implements the pattern matchings |
11:48:48 | Araq | it shouldn't be too hard to figure out what's wrong |
11:51:13 | OnO | and how do I prevent endless loop, ag I want to replace obj.field = value -> obj.valueModified(field); obj.field = value <- but there is called again |
11:51:48 | * | mAch17 joined #nim |
11:52:02 | * | strcmp1 quit (Read error: Connection reset by peer) |
11:52:18 | * | mAch17 quit (Client Quit) |
11:53:26 | * | strcmp1 joined #nim |
11:57:58 | Araq | good question. with a guard. |
11:59:43 | Araq | tansform into (.obj.field.) where (. .) is a new construct that prevents TR macro from being applied... |
11:59:49 | Araq | bbl |
12:00:12 | OnO | okay thnx |
12:13:01 | * | Dragonbird quit (Quit: This computer has gone to sleep) |
12:25:17 | * | dddddd quit (Read error: Connection reset by peer) |
12:26:23 | * | dddddd joined #nim |
12:37:59 | * | vikaton joined #nim |
12:42:03 | * | banister joined #nim |
12:46:26 | Araq | OnO: much better than preventing *all* TR macros is to name the optimization that should be prevented: |
12:47:08 | * | tamtaradam joined #nim |
12:47:12 | Araq | ormFieldAccess(.obj.field.) # shield against ormFieldAccess transformation |
12:47:44 | OnO | you mean (. is already in the devel somewhere, coz there no word about that in Manual ? |
12:48:05 | Araq | no, but it's already a token |
12:51:37 | Araq | OnO: not sure that's the synax we should use for this feature, but it's good enough for now |
12:52:43 | tamtaradam | Hello. Can someone help me with c2nim? I want to warp a FLTK library. What i need to do? I need a precompiled library files and headers or a source code to convert to nim. So, if i need only headers and .so/.dll how can i convert a big pack of headers? Have someone a good manual or tutorial? |
12:53:20 | tamtaradam | Sorry. I want to wrap, not warp :) |
12:53:52 | Araq | tamtaradam: http://goran.krampe.se/2014/10/16/nim-wrapping-c/ |
12:55:54 | tamtaradam | Thanks, i alredy looked it. But Goran have only one header file :) Yes, i can write bash script, that will convert it automaticle. But mb c2nim have a native instrument? |
12:57:24 | BlaXpirit | fowl probably knows |
12:58:09 | BlaXpirit | i did this: cpp -C mainheader.h |
12:58:14 | BlaXpirit | tamtaradam, |
13:00:31 | Araq | tamtaradam: with more recent versions of c2nim you can keeps your options in a .c2nim file |
13:02:41 | Araq | and iirc c2nim options.c2nim *.h just works |
13:02:52 | * | vendethiel joined #nim |
13:03:31 | tamtaradam | Wow, i didn`t know it. Thanks |
13:03:55 | OnO | Araq: so I should make a PR for (. correct ? coz currently I get Error: expression expected, but found '(.' |
13:04:47 | Araq | aye |
13:04:55 | OnO | okay, I'll try that |
13:06:35 | tamtaradam | Araq, i fed header file with many includes to c2nim... it simply ignore its. |
13:11:12 | * | boop is now known as boopisaway |
13:11:19 | * | boopisaway is now known as boop |
13:11:43 | * | Ven joined #nim |
13:16:43 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
13:27:35 | * | vendethiel quit (Ping timeout: 256 seconds) |
13:40:26 | * | BlaXpirit_ joined #nim |
13:40:26 | * | BlaXpirit is now known as Guest13392 |
13:40:26 | * | Guest13392 quit (Killed (sinisalo.freenode.net (Nickname regained by services))) |
13:40:26 | * | BlaXpirit_ is now known as BlaXpirit |
13:40:32 | * | Arrrr joined #nim |
13:43:11 | * | ozra joined #nim |
13:50:05 | * | gokr quit (Read error: Connection reset by peer) |
13:51:45 | * | gokr joined #nim |
13:53:54 | * | vendethiel joined #nim |
14:06:23 | * | rgv151 joined #nim |
14:07:27 | * | rgv151 quit (Remote host closed the connection) |
14:21:00 | * | pregressive joined #nim |
14:24:04 | * | rgv151 joined #nim |
14:32:06 | * | endragor quit (Ping timeout: 276 seconds) |
14:36:40 | * | vendethiel quit (Ping timeout: 272 seconds) |
14:37:45 | * | Matthias247 joined #nim |
14:38:15 | * | rgv151 quit (Remote host closed the connection) |
14:41:53 | * | vendethiel joined #nim |
14:43:38 | * | tamtaradam quit (Quit: Page closed) |
14:49:10 | * | Senketsu quit (Quit: Leaving) |
15:02:44 | * | BitPuffin joined #nim |
15:21:23 | * | gsingh93 joined #nim |
15:25:12 | * | vendethiel quit (Ping timeout: 265 seconds) |
15:26:42 | * | darkf quit (Quit: Leaving) |
15:28:01 | * | rgv151 joined #nim |
15:28:27 | * | rgv151 quit (Remote host closed the connection) |
15:28:37 | * | rgv151 joined #nim |
15:28:41 | * | OnO joined #nim |
15:30:23 | * | Trustable quit (Remote host closed the connection) |
15:33:31 | * | yglukhov_ joined #nim |
15:33:34 | * | johnsoft quit (Ping timeout: 245 seconds) |
15:33:40 | * | johnsoft joined #nim |
15:36:13 | * | yglukhov quit (Ping timeout: 256 seconds) |
15:46:22 | ozra | Any one dare stay in and code on a friday afternoon (r what you got) and get the nerd stamp? If anyone knows, I'd be happy to learn; is this not supposed to work??: `var foo = (x: int) => let a = x + 3; a - 2` |
15:46:39 | * | xcombelle quit (Ping timeout: 244 seconds) |
15:46:53 | * | kumul joined #nim |
15:47:51 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:47:53 | * | architek_ joined #nim |
15:48:59 | * | architek_ left #nim ("Textual IRC Client: www.textualapp.com") |
15:50:34 | dom96 | ozra: nerd stamp? wut? |
15:50:50 | dom96 | ozra: Try putting `let a = x + 3; a - 2` in parenthesis. |
15:50:53 | * | vendethiel joined #nim |
15:51:03 | ozra | Hehe. Since one's supposed to drink beer ;-) |
15:52:00 | ozra | dom96: Thanks. |
15:52:44 | * | yglukhov_ quit (Ping timeout: 245 seconds) |
16:03:11 | ozra | dom96: If you have a sec: if I use 'command syntax', I expect `a b` to be `a(b)`, also I expect `a (b)` to be `a((b))` - not `a(b)`. Is there lenience in allowing space before arg-list instead of demanding strict juxtaposition? |
16:03:35 | ozra | For "normal" call syntax |
16:03:56 | dom96 | I think there is |
16:09:41 | ozra | Ok. There's no chance of stricting that syntax up? Would it break client code you think? |
16:10:44 | * | Tennis quit (Quit: Leaving) |
16:11:12 | ozra | Otherwise, this pretty weird construct is necessary: `var foo = Λ((let a = x + 3; a - 2))` - instead of `var foo = Λ(let a = x + 3; a - 2)` |
16:11:19 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
16:11:30 | * | vendethiel quit (Ping timeout: 258 seconds) |
16:15:35 | ozra | dom96: If you know? ( Λ is a copy of `=>`, without infix notation) |
16:17:20 | dom96 | ozra: No idea. Might be worthy of a bug report. |
16:17:29 | * | OnO quit (Ping timeout: 264 seconds) |
16:17:41 | ozra | Alright. I'll play a bit more with it before reporting.. |
16:18:50 | * | mAch17 joined #nim |
16:19:15 | * | mAch17 quit (Client Quit) |
16:19:46 | Araq | ozra: that's just the old "we don't want strong spaces in the language problem" |
16:20:12 | Araq | with strong spaces you get exactly the right behaviour. without them you get what we have today. |
16:20:35 | Araq | but everybody is so afraid of them that we cannot enable them. |
16:20:57 | ozra | Alright, so one has to enable strong spaces (that gives the funky expression precedances too) to get that for calls? I consider them different beasts.. |
16:21:19 | * | vendethiel joined #nim |
16:22:03 | ozra | I would expect calls to obey strong space, since command syntax is possible... |
16:22:41 | Araq | well I'm not sure about your capital lambda |
16:23:04 | Araq | foo(bar) passes 'bar' to 'foo', not '(bar)' |
16:23:22 | Araq | and foo (bar) is the same. |
16:23:50 | Araq | and with #! strongspaces it's '(bar)'. (Somebody needs to test this.) |
16:24:49 | ozra | Yeah, I'd expect the last one (space after foo) being a command call, and the paren there to be a regular precedence / grouping paren |
16:25:07 | Araq | I agree |
16:25:34 | * | BlaXpirit quit (Quit: Quit Konversation) |
16:25:56 | ozra | That is a common enforcement in juxtaposition allowing langs imo. Shouldn't have to be connected with "expression-strong-spaces" imo. |
16:26:13 | ozra | Should I file a bug report? |
16:26:45 | Araq | well you're completely right, but I know code bases where foo (bar) with the current meaning is very common. |
16:27:02 | Araq | so it will break lots of code out there. |
16:27:22 | * | BlaXpirit joined #nim |
16:27:28 | Arrrr | better now than later |
16:27:57 | ozra | `#! strongspaces`- is that correct? Doesn't work with that either. |
16:28:25 | Araq | ozra: yeah but that's just a bug. I think. |
16:28:53 | ozra | Solving it generally solves both in other words. I'll just file one report. |
16:29:06 | Araq | ok |
16:31:26 | ozra | Hmm, ofc. this is a macro, not a proc, if there are differences in the parsing at that stage.. Well, I'll use the macros as example in the issue, so that it is clear. |
16:32:52 | * | yglukhov_ joined #nim |
16:41:05 | ozra | Araq: If you have a sec: what do you think about the refactor into the new file: https://github.com/Araq/Nim/pull/2833 |
16:47:08 | ozra | Well, I filed it. Perhaps one could grep nimble modules etc. and see how common the `foo (bar)` call is. Could it be solved with nimfix? If so making the change when doing a major pre release?? |
16:47:24 | ozra | I'll add to the report regarding this.. |
17:01:49 | * | yglukhov__ joined #nim |
17:04:03 | * | yglukhov_ quit (Ping timeout: 256 seconds) |
17:18:46 | * | bluenote_ quit (Ping timeout: 246 seconds) |
17:31:01 | * | jj2baile quit (Ping timeout: 244 seconds) |
17:35:39 | * | xcombelle joined #nim |
17:36:11 | wuehlmaus | anybody know pleac.sf.net? i like the project that wants to try to be a programming language cookbook like the perl cookbook. nim is missing! |
17:36:29 | wuehlmaus | i know about rosettacode |
17:43:36 | reactormonk | finally needs to die |
17:43:39 | reactormonk | ... sf |
17:45:30 | dtscode | is sf sourceforge? |
17:45:35 | reactormonk | yup |
17:45:42 | dtscode | I second that then |
17:50:07 | * | boop is now known as boopisaway |
17:50:36 | def- | wuehlmaus: is it still maintained? no updates since 2011 |
17:53:10 | * | Senketsu joined #nim |
17:54:30 | * | jj2baile joined #nim |
18:02:42 | Arrrr | If i disable the gc, i presume i-ll have to treat refs as plain ptrs, or is any other ritual involved here |
18:03:06 | * | bassa quit (Read error: Connection reset by peer) |
18:04:01 | wuehlmaus | def-: i didn't ask this question, it's a good one! |
18:08:34 | * | boopisaway is now known as boop |
18:11:01 | wuehlmaus | .. but it's a pity, i love the idea of pleac. |
18:13:17 | * | kumul quit (Ping timeout: 264 seconds) |
18:24:03 | * | BitPuffin quit (Ping timeout: 250 seconds) |
18:34:32 | * | JehanII joined #nim |
18:34:53 | ozra | Anyone know why this isn't working: `macro delt(x: stmt) : stmt {.immediate} = discard; var del1 = delt: let a = x + 3; a - 2` - gives "Error: in call 'delt' got -1, but expected 1 argument(s)" |
18:37:11 | * | endragor joined #nim |
18:37:41 | JehanII | ozra: You need `delt do:` instead of `delt:` if you use it as part of an expression. |
18:37:54 | ozra | aha. |
18:37:56 | JehanII | You'll probably also need to indent the let part. |
18:38:05 | JehanII | And a macro that does a discard will confuse the compiler. |
18:38:10 | JehanII | It has to return something. |
18:38:35 | ozra | I just wrote discard here to keep it short... |
18:39:53 | ozra | Hmm. the do: doesn't work either. Might have to wrap stmt-list in parens. But then the compiler sigsev's instead... |
18:39:59 | * | endragor quit (Remote host closed the connection) |
18:40:09 | JehanII | yes, that's what I meant by indenting the let part. |
18:40:27 | JehanII | Either that or put it inside parentheses. |
18:40:38 | ozra | But that gives the same error.. |
18:42:27 | ozra | Hmmm.. guess I'll have to stick with delt((...)) notation. |
18:43:02 | ozra | Seems to be a couple of bugs here, if I haven't misunderstood things completely. I'll try to put some minimal cases together. |
18:43:34 | JehanII | ozra: https://gist.github.com/rbehrends/59241405ab3d1501c972 |
18:44:09 | * | askatasuna joined #nim |
18:45:00 | * | vikaton quit () |
18:45:50 | ozra | JehanII: I really want it as a one liner though - and my real use-case is basically the '=>' notation, but with parameters created autmatically from used idents in body (like KBD/Q) |
18:45:51 | * | fizzbooze joined #nim |
18:46:34 | JehanII | Then use: var del1 = delt do: (let a = x+3; a-2) |
18:47:02 | ozra | so `foo = Λ((let a = x + 3; a - 2))' works, but with command expression notation it does not, so right now it requires double parens. That's the tersest up till now.. |
18:47:37 | JehanII | That said, Nim is ultimately an indentation-based language. While parentheses allow you to (partly) hack around it, if you try to not use indentation, you will ultimately start fighting the syntax. |
18:47:37 | ozra | (it's really called Λ, I just tried delt to see if there was a parse bug w. unicode) |
18:48:20 | ozra | JehanII: I've coded identation-based for about 16Y, and one liners are always possible rather cleanly. And, as per above example.. |
18:48:21 | BlaXpirit | so i just had an idea |
18:48:32 | BlaXpirit | you use the (thingy; thingy) |
18:48:47 | BlaXpirit | make macros which define things through function calls |
18:48:50 | BlaXpirit | make a lisp |
18:48:52 | JehanII | I don't mean to discourage you, I'm just pointing out that there's a tradeoff here. |
18:49:55 | ozra | JehanII: Haha, yes, thank you though. Anyways, I guess until https://github.com/Araq/Nim/issues/2837 is fixed, `foo = Λ((let a = x + 3; a - 2))` is the cleanest solution. |
18:50:30 | ozra | If it is OKed to be fixed... |
18:51:52 | JehanII | Honestly, I'd have to look at the parser to see if it's a bug or if there's a reason for it (e.g. a parsing ambiguity that would otherwise arise). |
18:53:57 | ozra | The only thing I can imagine is that call-parser eats spaces, unless there is a non-paren after spaces, in which case it is treated as a command expr/stmt. In other langs supporting both - it's usually explicit. A spc after id = "command" syntax, hence expression parens around an argument are treated for what they are. |
18:54:22 | * | endragor joined #nim |
18:54:26 | * | gsingh93 quit (Ping timeout: 272 seconds) |
18:54:59 | * | ingsoc quit (Quit: Leaving.) |
18:55:30 | ozra | According to Araq, that's how it "should be", but as it is now, there can be code depending on the ad-hoc white-space. So I took that in account in the issue. |
18:55:42 | ozra | JehanII: ~ |
18:57:55 | * | Ven joined #nim |
19:09:37 | * | kumul joined #nim |
19:11:36 | * | endragor quit (Remote host closed the connection) |
19:11:50 | * | johnsoft quit (Quit: Leaving) |
19:12:07 | * | johnsoft joined #nim |
19:13:58 | * | kumul quit (Ping timeout: 258 seconds) |
19:17:27 | * | dapz joined #nim |
19:17:44 | * | johnsoft quit (Ping timeout: 245 seconds) |
19:18:46 | * | johnsoft joined #nim |
19:19:11 | * | Mat4 joined #nim |
19:23:29 | * | shevy quit (Ping timeout: 252 seconds) |
19:24:20 | * | dapz left #nim ("Textual IRC Client: www.textualapp.com") |
19:26:21 | * | johnsoft is now known as whatisaphone |
19:26:26 | boop | aaah. |
19:26:31 | boop | can i not use async in a thread? |
19:27:50 | * | whatisaphone quit (Quit: Leaving) |
19:28:07 | * | johnsoft joined #nim |
19:28:15 | dom96 | boop: not right now |
19:28:30 | boop | :( |
19:28:37 | * | johnsoft is now known as whatisaphone |
19:28:55 | boop | well that's annoying |
19:28:56 | boop | hmm |
19:29:26 | boop | any way around it? |
19:30:21 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:31:18 | dom96 | boop: What is your use case? |
19:31:45 | boop | 'await'ing in a thread for messages from another thread |
19:32:06 | * | johnsoft joined #nim |
19:32:11 | boop | async worked fine until I tried to use await |
19:32:53 | dom96 | what errors are you getting? |
19:33:54 | boop | private/bynim_workthread.nim(31, 21) Info: template/generic instantiation from here |
19:33:56 | boop | lib/nim/pure/asyncdispatch.nim(1196, 8) Error: 'cb' is not GC-safe as it accesses 'nameIterVar' which is a global using GC'ed memory |
19:35:26 | boop | ..wait |
19:35:26 | * | whatisaphone quit (Ping timeout: 258 seconds) |
19:35:29 | * | _ joined #nim |
19:35:30 | * | boop squints |
19:35:36 | * | fizzbooze quit (Ping timeout: 272 seconds) |
19:35:37 | boop | with a bit of fiddling it's not erroring now |
19:35:38 | boop | let me test this |
19:35:53 | * | _ is now known as Guest44939 |
19:36:22 | * | shevy joined #nim |
19:36:58 | * | johnsoft quit (Disconnected by services) |
19:37:18 | * | Guest44939 is now known as johnsoft |
19:41:01 | boop | no errors now, but it's just Not Working |
19:41:03 | boop | hm. |
19:41:49 | boop | i had to re-register the FD so.. |
19:45:05 | boop | ..wait, i've run async irc in a thread.. |
19:45:25 | dom96 | why do you need multiple threads? |
19:46:02 | boop | code is being called as a library from a game, game locks up until the function returns. |
19:46:13 | boop | pushing it into a thread and using sockets to communicate with it |
19:46:38 | dom96 | Could you not use callbacks instead? |
19:48:44 | boop | this game engine's FFI consists only of a 'char *func(int argc, char **argv)' call :/ |
19:49:09 | boop | no callbacks |
19:49:11 | boop | it's a pain |
19:50:03 | * | aaronk joined #nim |
19:51:23 | dom96 | Is there no event loop? |
19:51:25 | * | shevy left #nim ("I'll be back ... maybe") |
19:51:39 | * | solidsnack joined #nim |
19:52:38 | boop | not one i can plug into |
19:52:52 | boop | (maybe i'm misunderstanding you?) |
19:53:07 | * | Arrrr quit (Quit: WeeChat 1.2) |
19:55:21 | * | solidsnack quit (Client Quit) |
19:56:21 | * | TEttinger joined #nim |
20:00:34 | dom96 | boop: that's odd. What engine are you using? |
20:00:45 | boop | BYOND, DM |
20:00:49 | boop | ..it's really not designed for this kind of thing |
20:00:55 | boop | http://www.byond.com/ |
20:02:09 | * | bassa joined #nim |
20:02:17 | boop | hmm.. issue might be somewhere else |
20:02:28 | boop | .send on my asyncsock isn't completing |
20:02:39 | boop | but I can't really see why not |
20:07:40 | boop | and now I see why.. hmm |
20:08:02 | boop | dom96: false alarm, problems in my code :) turns out async does work in threads? |
20:08:37 | dom96 | I never tested it so I default to "it does not work" :P |
20:09:38 | boop | :p |
20:11:11 | * | xcombelle quit (Remote host closed the connection) |
20:11:28 | boop | slightly related: any big reason this isn't exported? https://github.com/Araq/Nim/blob/master/lib/pure/net.nim#L121 |
20:13:27 | * | boop is now known as boopisaway |
20:15:12 | * | rgv151 quit (Remote host closed the connection) |
20:15:59 | * | kumul joined #nim |
20:16:41 | * | Noobulater joined #nim |
20:17:14 | * | vbtt_ quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
20:17:16 | * | aaronk quit (Ping timeout: 246 seconds) |
20:17:21 | Noobulater | Does nim have a built in proc for converting little-endian to big-endian? |
20:18:57 | Araq | endians.nim module |
20:19:52 | Noobulater | thanks Araq |
20:20:10 | dom96 | boopisaway: Because the net module was designed so that it creates the SocketHandle for you. |
20:24:52 | * | vikaton joined #nim |
20:25:22 | * | solidsnack joined #nim |
20:25:25 | * | solidsnack quit (Client Quit) |
20:25:35 | vikaton | Are there any tutorials/eamples of Nim being used with the windows API |
20:25:53 | vikaton | or Nim + C++ interop examples? |
20:26:04 | * | aaronk joined #nim |
20:26:10 | * | solidsnack joined #nim |
20:26:21 | aaronk | forum account activation failed for me just now :-( |
20:27:35 | aaronk | "Account activation failed" with no explanation |
20:27:48 | * | filcuc joined #nim |
20:29:34 | * | jaco60 joined #nim |
20:34:16 | * | yglukhov__ quit (Quit: Be back later ...) |
20:35:06 | vikaton | wait is C++ FFI like C++ interp or totally different? |
20:37:07 | dom96 | aaronk: hrm |
20:37:27 | dom96 | aaronk: Can I PM you? |
20:40:33 | * | vendethiel quit (Ping timeout: 250 seconds) |
20:42:39 | * | boopisaway is now known as boop |
20:43:37 | * | vendethiel joined #nim |
20:43:38 | boop | dom96: what if i want to pass in my own fd but use the nice send/recv functions? asyncnet lets me do this already |
20:44:43 | dom96 | boop: Create a PR to make it public :) |
20:44:48 | boop | sure! :) |
20:48:28 | aaronk | dom96: sure |
20:48:58 | vikaton | anyone ere good with C++ ? |
20:49:37 | * | johnsoft quit (Quit: Leaving) |
20:49:51 | * | johnsoft joined #nim |
20:50:08 | dtscode | vikaton: sure |
20:50:41 | vikaton | dtscode: So I have this C++ code here of a simple keylogger in C++ |
20:50:53 | vikaton | (this isnt for malicious activiity) |
20:50:54 | vikaton | https://gist.github.com/Vikaton/6ea33e517d504ab67bfb |
20:51:07 | dtscode | ok |
20:51:13 | ozra | araq: sorry to bug you, I'd just like to get #2833 wrapped up nice, so I can grab a bug from the list to work on: I think I might be able to handle #2523 for instance... |
20:51:30 | vikaton | anyhow, I want to see how I can use Nim C++ FFI to create the same thing or using Windows API with Nim |
20:51:51 | vikaton | both of which idk how to do and cant find docs on, so I need to be guided in the right direction |
20:52:05 | dtscode | Like do you want to use as much nim as possible or call the keylogger from nim code? |
20:52:42 | vikaton | use nim as much as possible |
20:53:36 | dtscode | Ok. So first what you want to do is recreate as much of the code as possible in nim, then whatever you can't do, put in a c++ file, and give me a sec and I'll find the guide for ffi's |
20:54:01 | vikaton | Oh ok, thanks |
20:54:03 | dtscode | I think theres also a win32 wrapper floating around in the stdlib, fwiw |
20:54:15 | boop | there's two, "windows" and "winlean" |
20:54:30 | boop | windows has everything in windows.h, winlean has just the bits the compiler uses |
20:54:35 | vikaton | Yeah if I can get a hold of windows.h and winuser.h equivalents in Nim, this should be easy |
20:54:40 | boop | compiler and the standard lib* |
20:54:47 | boop | windows.nim is massive |
20:55:37 | vikaton | disclaimer, that c++ code is not mine, I saw saw it on pastebin and looked pretty straightforward |
20:56:36 | * | filcuc quit (Read error: No route to host) |
20:56:38 | Mat4 | hmm, is there a reason for using <stdio> routines instead of <iostream> ones ? |
20:56:51 | * | filcuc joined #nim |
20:57:13 | boop | Mat4: using c instead of c++ |
20:57:17 | dtscode | http://rosettacode.org/wiki/Call_a_foreign-language_function#Nim |
20:58:25 | * | gokr_ joined #nim |
20:58:28 | vikaton | dtscode: Im gonna be using C FFI ? |
20:59:02 | dtscode | vikaton: If you wrap the c++ function in extern "C" it should be fine |
20:59:36 | gokr_ | Or you use c2nim and the cpp backend |
20:59:36 | Mat4 | eh yes however both are used in the pasted code ?!??, is this just a test routine ? |
20:59:49 | gokr_ | Like we do with Urhonimo |
21:01:39 | dtscode | gokr: even better :D |
21:01:52 | * | boop is now known as boopisaway |
21:02:16 | dtscode | Speaking of c++ code, I am currently fixing some of the shittiest c++ code I've ever seen |
21:04:21 | * | solidsnack quit (Ping timeout: 246 seconds) |
21:05:32 | * | thotypous quit (Ping timeout: 265 seconds) |
21:06:47 | * | filcuc quit (Quit: Konversation terminated!) |
21:06:58 | * | filcuc joined #nim |
21:11:17 | * | filcuc quit (Client Quit) |
21:15:34 | vikaton | At least I got a messagebox going from C FFI from windows.h |
21:15:37 | vikaton | gud pr0gress |
21:18:36 | vikaton | does anyone here know that the Nim docs are on the MIT website? |
21:20:38 | * | Strikecarl joined #nim |
21:21:15 | Strikecarl | Ok so guys, i'm making a program that uses startsWith("hey") to echo out all files in a dir that starts with hey |
21:21:30 | Strikecarl | how would i do that+ |
21:21:59 | Araq | ozra: consider your PR accepted and start working on bugs :P |
21:23:17 | vikaton | does Nim support inline asm ? |
21:23:55 | ozra | Araq: I just must admit that I'm a bit new to github collaboration, so I PR'ed from my devel branch, instead of the feature branch, so it's just my noobishness that has kinda "locked me in".. reading about git'ing now to see how I can 'get out' before accepted ;-) |
21:23:59 | vikaton | Indeed it does |
21:27:35 | vikaton | http://prntscr.com/7awp0w |
21:28:21 | Strikecarl | Gj vikation :P |
21:28:32 | vikaton | baby steps :P |
21:29:20 | Strikecarl | who uses prntscr nowadays tho |
21:29:56 | vikaton | I dont see a problem with it |
21:29:58 | vikaton | I like it |
21:30:22 | Strikecarl | getsharex nub |
21:31:04 | vikaton | will look into it |
21:33:24 | vikaton | 0...10 includes 10 correct? |
21:33:37 | Strikecarl | Afaik. |
21:33:43 | JehanII | With two dots. |
21:34:55 | vikaton | I thought .. what exclusive |
21:39:33 | iznogoodd | 0..<1 exclusive if i remember correctly, and im not mixing languages |
21:39:53 | * | Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
21:39:58 | vikaton | How can I cast an int to a cint ? |
21:40:23 | iznogoodd | cast or convert |
21:40:29 | JehanII | cint(x) or x.cint |
21:43:39 | * | boopisaway is now known as boop |
21:46:08 | vikaton | If I'm dealing with an ambigious type error, what should I generally do to the type? |
21:46:09 | vikaton | o wait |
21:47:10 | iznogoodd | make it less ambiguous |
21:47:16 | vikaton | yeah I got it |
21:48:34 | * | JehanII quit (Quit: Leaving) |
21:49:09 | vikaton | Success! |
21:49:18 | vikaton | GetAsyncState works :P |
21:50:12 | * | vendethiel quit (Ping timeout: 276 seconds) |
21:50:29 | * | intra quit (Ping timeout: 265 seconds) |
21:51:35 | vikaton | http://prntscr.com/7ax0cy |
21:55:04 | * | saml quit (Quit: Leaving) |
21:59:53 | * | Mat4 quit (Remote host closed the connection) |
22:00:55 | * | banister_ joined #nim |
22:01:00 | * | banister_ quit (Max SendQ exceeded) |
22:01:17 | vikaton | dtscode: Im not quite sure how to implement the Stealth function |
22:03:03 | * | banister quit (Ping timeout: 265 seconds) |
22:05:58 | * | Demon_Fox joined #nim |
22:09:47 | * | Noobulater quit (Quit: Page closed) |
22:09:49 | * | vendethiel joined #nim |
22:10:45 | * | banister joined #nim |
22:11:27 | * | Trustable joined #nim |
22:14:34 | * | solidsnack joined #nim |
22:17:21 | * | askatasuna quit (Quit: WeeChat 1.2) |
22:18:08 | * | Senketsu quit (Read error: Connection reset by peer) |
22:20:38 | * | Senketsu joined #nim |
22:25:47 | * | davidhq joined #nim |
22:29:38 | * | davidhq quit (Client Quit) |
22:30:21 | vikaton | I may have ran into a problem. How do I import a type from C ? |
22:31:56 | Senketsu | im afraid you have to declare the type in nim |
22:32:05 | Senketsu | define* w/e |
22:32:52 | Varriount | vikaton: Which isn't that hard. C structs map to Nim quite easily. |
22:33:06 | * | vendethiel quit (Ping timeout: 276 seconds) |
22:34:14 | Varriount | Araq: What kind of output message should the irc buildbot have when a build succeeds/fails? |
22:34:19 | vikaton | Well this is kinda complicated |
22:34:35 | vikaton | I need to decalre one type which will be the type of the type I really need |
22:34:39 | * | BlaXpirit quit (Quit: Quit Konversation) |
22:34:59 | vikaton | my end goal is to port this to Nim: https://gist.github.com/Vikaton/6ea33e517d504ab67bfb#file-keylog-cpp-L79 |
22:35:55 | Varriount | vikaton: Building a key logger? |
22:36:17 | vikaton | Varriount: Yes, for experimental purposes |
22:36:22 | * | boop is now known as boopisaway |
22:36:29 | vikaton | I have everything set, except the stealth console |
22:36:29 | Varriount | Riight.. ;D |
22:36:34 | vikaton | hehe |
22:37:08 | Varriount | vikaton: You need the type that corresponds to 'HWND'? |
22:37:26 | vikaton | Varriount: Yes, which is the type of HANDLE |
22:37:59 | Varriount | vikaton: http://nim-lang.org/docs/windows.html#HWND |
22:38:47 | vikaton | wait wtf :/ |
22:38:59 | Varriount | :3 |
22:39:02 | vikaton | I didnt have to create a C binding with windows.h after all? |
22:39:09 | vikaton | darn it :[ |
22:39:28 | Varriount | Well, to be fair, that windows wrapper is a tad incomplete, not to mention inaccurate. |
22:39:31 | vikaton | my code self-esteem was p high until u had to ruin it :( |
22:40:32 | Varriount | vikaton: That module was originally translated from Pascal... make sure to verify the procedure signatures and type layouts... |
22:40:51 | Varriount | In particular, there are some places where an 'int32' is used, when it should be 'int' |
22:41:14 | Varriount | vikaton: Sorry. I'm a terrible, terrible person. |
22:41:36 | vikaton | >:( |
22:41:41 | vikaton | thanks anyway tho lol |
22:42:53 | dom96 | Varriount: [CommitHash] Architecture: Build failed/succeeded |
22:45:10 | vikaton | aaaand |
22:45:20 | vikaton | the keylogger in Nim is complete :) |
22:45:45 | Varriount | Now to send it out among an unsuspecting world... Muahahahaha!!!! |
22:46:23 | vikaton | im going to leave proc GetAsyncKeyState(key: cint): int {.header: "<windows.h>", varargs.} in there |
22:46:27 | vikaton | just to seem cool :P |
23:00:14 | * | vaedd quit (Quit: Connection closed for inactivity) |
23:05:01 | vikaton | How can I check the IAT table in Nim ? |
23:05:40 | Varriount | IAT Table? |
23:06:25 | vikaton | Import Address Table |
23:08:53 | Varriount | vikaton: You mean, have a program modify it's own import address table, or simply view the import address table of an exe? |
23:09:04 | Varriount | How would you normally do this in C? |
23:09:33 | vikaton | with getProcAddress and LoadLibrary ? |
23:09:57 | Varriount | vikaton: Then use the same technique in Nim? |
23:10:07 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
23:11:11 | * | kumul quit (Ping timeout: 252 seconds) |
23:15:57 | * | solidsnack joined #nim |
23:21:14 | * | davidhq joined #nim |
23:29:08 | * | thotypous joined #nim |
23:36:10 | * | gokr_ quit (Ping timeout: 258 seconds) |
23:41:22 | vikaton | I'm getting a mismatch error with GetProcAddress(LoadLibraryA("User32.dll"), cstring("MessageBox")) |
23:41:39 | vikaton | says that it got a (FARPROC) |
23:41:43 | vikaton | but expected so and so |
23:42:06 | * | vendethiel joined #nim |
23:42:38 | vikaton | code is this |
23:44:22 | * | johnsoft quit (Ping timeout: 255 seconds) |
23:44:37 | * | johnsoft joined #nim |
23:45:30 | vikaton | https://www.irccloud.com/pastebin/WIR0N0OD/ |
23:45:39 | vikaton | dunno why that took so long to send |
23:46:11 | * | Trustable quit (Remote host closed the connection) |
23:49:00 | vikaton | anyone? :{ |
23:49:17 | Varriount | vikaton: http://nim-lang.org/docs/windows.html#LoadLibraryA,LPCSTR |
23:49:38 | Varriount | Look at the return type of that, and the parameter type that GetProcAddress takes. |
23:50:35 | vikaton | Varriount: the return type is a HINST |
23:50:44 | vikaton | which is what GetProcAddress wants |
23:51:33 | * | frozen joined #nim |
23:52:10 | Varriount | vikaton: What error are you getting? |
23:52:34 | vikaton | https://www.irccloud.com/pastebin/PR9Wlxky/ |
23:52:37 | vikaton | Varriount: ^ |
23:53:24 | Varriount | echo repr(GetProcAddress(LoadLibraryA("User32.dll"), cstring("MessageBox"))) |
23:53:38 | vikaton | wat is repr |
23:54:01 | Varriount | vikaton: Debug procedure that can get a useful string representation out of most data types. |
23:54:12 | vikaton | nice |
23:54:49 | Varriount | It's only supposed to be used for debug code though - no guarantees are made about it's output being stable. |
23:55:00 | Varriount | (from version to version) |
23:58:30 | vikaton | that's cool |
23:58:40 | vikaton | Varriount: its up btw https://github.com/Vikaton/nim-keylogger |