<< 29-05-2015 >>

00:03:38filwitVarriount: 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:47Araqdtscode: what? o.O I disagree.
00:12:09vikatonofc Araq does
00:13:38Araqer ... not anymore
00:14:07vikatonby does i mean disagree
00:15:28Araqlol
00:17:39*vendethiel joined #nim
00:18:56filwitAraq: what does TLoc handle? this is an abstraction of a pointer/ref?
00:19:33Araqnah, it's "info the backend needs"
00:19:35filwitnevermind, it's in ast.nim
00:19:39filwiti found it
00:19:49Araqand yes, it's a strange name.
00:20:02AraqI thought of "Location" when I gave it a name
00:20:42filwitbtw, '.s' in this case is actually a TStorageLoc not string :P
00:20:55Araqah yeah
00:21:15Araqfeel free to rename it
00:21:25dtscode<Araq> dtscode: what? o.O I disagree.
00:21:27filwitwe need refactoring tools so cleaning up this kind of thing would be easy
00:21:40filwitAraq: wait what? i can rename these?
00:21:40Araqyup.
00:21:46ozrafilwit: so something go-langy?
00:21:47dtscodeI can't trust what you say so long as you disagree with the unix philosophy :p
00:21:58dtscodeOh please nothing go-langy
00:22:13Araqoh wait
00:22:19Araqnimfix can do renamings
00:22:39filwitbuggy?
00:22:46ozradtscode: I was refering to the "automated composition". afaik golang has no inheritance at all, but uses composition and automated forwarding of methods..
00:22:50Araqyou need to write {.deprecated: [TLoc, BackendInfo].} and then sit back
00:23:04dtscodeozra: eh
00:23:07filwitwell I am not going to start hacking on that yet
00:23:21ozradtscode: never mind ;-)
00:24:04vikatonhacking is illegal !
00:24:18ozradtscode: was wondering what it could be compared too.. fogeddabout golang!
00:24:31filwiti 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:38dtscodevikaton: er no its not
00:24:45dtscodeozra: I try every day
00:25:28Araqfilwit: nimfix was used on the compiler itself extensively and produced near perfect results. that said, it has a few bugs left.
00:26:03ozradtscode: the garbage collection is so slow - your memory wiiil be wiped out - right after ragnarök..
00:27:10filwitAraq: 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:25vikatonAraq, 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:05Araqvikaton: yes.
00:29:11filwitvikaton: theoretically if you hack it that way.. but the common conditions, eg object constructors, wont allow it.
00:29:22vikatonI see
00:29:42vikatoncan we invoke primitive types with `not nil` ?
00:30:07Araqprimitive types are not nilable to begin with
00:30:31vikatonpointers ?
00:31:30filwitvikaton: type A = object x: ptr int not nil; let a = A() # error, 'x' has to be set
00:32:40vikatonso if that's the case, then null pointers arent even a concept if you keep using that type'A'?
00:33:16filwiteh?
00:33:17vikatonI'm interested in this whole null pointer things, idk why
00:33:53fowlvikaton: you can also view null as a distinct state
00:33:54dtscodeA null pointer is just one that doesn't point at anything vikaton
00:34:13vikatonYes I am aware
00:34:21*BitPuffin|osx joined #nim
00:34:38vikatonbut lets say we use filwit's example of invoke not nil on pointer type A
00:35:01dtscodeI don't know enough nim anymore to understand what you said :p
00:35:07dtscodeI'm more of a C guy now
00:35:15vikatonA can never be "nothing"
00:35:23filwitAraq: 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:24vikatonIm more of a Nim noob than any1 here
00:36:55filwitvikaton: '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:39filwitvikaton: not sure how much runtime overhead that implies actually
00:37:45filwit(if any)
00:37:58Araqfilwit: ropes are just stupid strings
00:38:04vikatonfilwit, so if not nil is invoked on a ptr like in ur example, then dereferencing null A pointers is impossible?
00:38:05filwitk
00:38:10filwit^ Araq
00:38:28dtscode<Araq> filwit: ropes are just stupid strings
00:38:29filwitvikaton: no you get a compiler error
00:38:29dtscode:D
00:38:32Araqdtscode: why not c++?
00:38:50dtscodeAraq: Because I was stupid and wanted to see if I could write a command shell in C
00:39:03filwitvikaton: wait.. i'm not sure what you're asking..
00:39:15*vendethiel quit (Ping timeout: 265 seconds)
00:39:27Araqbut hey, it was alreay obvious you're a masochist when you implied you like Unix ;-)
00:39:32dtscode^
00:39:55vikatonfilwit: undefined behavior is impossible to happen because you cannot dereference a pointer type that does not allow nill values
00:39:58vikatoncorrect?
00:40:13filwityes, basically
00:40:23dtscodeI 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:28vikatoncool
00:40:57vikatonI may not be seeing `not nil` in the bigger picture however, feel like im missing something
00:41:13filwitit does things like this: proc foo(x:ptr int not nil); foo(nil) # compiler error on this call
00:41:44vikatonfilwit, couldnt you just make a type for a pointer than cannot be nil
00:41:48vikatonthen use that pointer everywhere?
00:41:55filwitan you must prove to the compiler that something is not nil (via if statement) to be able to call 'foo' at all
00:42:15filwitvikaton: yes
00:42:18vikatonand use a generic for the type that the ptr will be
00:42:49vikatonso you dont have to write var A: ptr int
00:42:56vikatonbut could int be T ?
00:42:58filwitvikaton: 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:18vikatonwhat types of ptrs are there?
00:43:31filwitptrs are just unsafe pointers
00:43:51filwitthey don't have a 'type' really without a context (eg, `ptr int`)
00:44:05vikatonI see
00:44:20vikatonto end this so I can get a solid idea
00:44:33filwityou can use a 'pointer' for general purpose unsafe points (same as void* in C)
00:45:17filwitbut 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:37vikatonyeah ik, just trying to wrap my head around this
00:45:39*dddddd quit (Ping timeout: 246 seconds)
00:45:53vikatonso a person uses pointers in a small Nim program
00:46:11vikatononly 1 pointer, ptr int
00:46:46vikatonhe uses that ptr around alot, and some runtime variables can cause a null pointer dereference
00:47:13vikatonif he decalred a ptr int type 'newptr' that has `not nil` invoked on it
00:47:22vikatonthe null pointer deref is a compile time error?
00:48:16filwitwell '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:37filwitonly a sub-set of issues, and it's also for safe references
00:50:02filwit'not nil' just prevents you from assigning to the ptr when the compiler can't guarantee the value is 'not nil'
00:50:33vikatonfilwit: Sure it cant prevent you from freeing, but im talking about dereferencing it
00:50:40vikatonwill turn into a compiler error?
00:51:15filwitwe'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:41Araqno, why would it? dereferencing is fine cause it can never be 'nil'.
00:51:50Araqthat's what 'not nil' means.
00:52:36filwityeah it will prevent you from derefing nil (in almost all cases), but it doesn't prevent you from using garbage memory
00:52:47filwitwhich is what refs are for
00:53:44filwitso the combination of refs + not nil means the your code won't accidentally deref nil or hit garbage
00:54:07vikatonperfect
00:54:50filwitAraq: does 'not nil' have a runtime overhead anywhere? I can't think of any..
00:55:00ozraAraq: 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:11filwittoo bad making 'not nil' default would break every line of Nim code ever written...
00:55:26Araqfilwit: no runtime overhead
00:55:31filwitnice
00:55:42Araqhowever I disagree that it should be the default
00:56:26vikatonfilwit: it would break it because lots of Nim code have Null pointers?
00:57:02filwitvikaton: no it would break because it would require 'not nil' proof where there currently isn't any
00:57:48vikatono rite
00:57:51vikatonhmm
00:58:37filwitit'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:23vikatonwow `not nil` annotations are cool
00:59:39vikatona good safety option with no overhead
00:59:43filwityep :)
01:00:54vikatonand people still whine about Nim's "undefined behavior"
01:00:59vikatonsome ppl smh
01:01:04vikatonbrb screencasting Nim
01:01:57vikatonAraq, are uninitialized variables 'nil' ?
01:04:23vikatonanything dealing with numbers are zero'd out
01:04:24filwitvikaton: 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:27filwitunlike 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:58vikatonmhm
01:06:27vikatonfilwit, when you declare a type of pointer with `not nil` and you initialize it, what's its vale?
01:06:29vikatonvalue*
01:06:41filwitwhatever you set it too
01:06:49filwitand you have to set it to something because of the 'not nil'
01:07:09filwityou should just try these things out in a test Nim file real quick
01:07:24vikatonI am
01:07:40vikatonhmm
01:10:31vikatonIm getting an invalid indentation with your example filwit
01:10:36vikatonwhen it is indented properly :/
01:11:27filwitidk 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:51filwitmake a gist/pastebin please
01:13:05vikatonhttps://www.irccloud.com/pastebin/tNxcRbsx
01:13:08vikatonfilwit: ^
01:14:02filwitvikaton: put a return after 'object'
01:14:28filwitso make 'x: ptr int not nil' on it's own line (extra indentation optional)
01:14:48filwiter wait, no it needs an extra indentation
01:15:07filwittype A = object
01:15:12filwit x: ptr int not nil
01:15:18vikatonyeah I got it
01:15:24vikatonbut I dont know its value
01:15:27vikatoncannot echo it
01:16:10filwityou should not be able to create an instance of A without providing a valid non-nil value for A.x
01:16:32filwityour 'let a: A' line is wrong for multiple reasons
01:16:42vikatonit compiles though
01:17:10filwitthat 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:46vikatonfilwit, my bad, chnaged let to var
01:18:03*jbomo joined #nim
01:18:11vikatonbut cannot echo once again, so Im not sure what the value of a is right now
01:18:47filwitbecause 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:54filwitdo this:
01:19:03filwitvar x = 123
01:19:12filwitvar a = A(x:addr x)
01:19:17filwitecho a.x
01:20:08filwityou may actually hit a 'cannot prove 'addr x' is not nil' with that code, btw..
01:20:17filwitso you might have to do...
01:20:19filwitvar x = 123
01:20:26filwitvar y = addr x
01:20:34filwitif y != nil:
01:20:42filwit var a = A(x:y)
01:20:45filwit echo a.x
01:20:57Araqthe compiler knows that 'addr' cannot be nil in this case
01:21:03filwitokay
01:22:54filwitAraq: 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:04filwiter wait, you told me to look up something before, one sec..
01:24:01filwitAraq: hmm.. nimgrep isn't finding anything for 'optOverflowChecks'
01:24:23filwit(yes, and using -y)
01:24:38AraqoptOverflowCheck
01:24:59filwitthanks
01:27:26filwitoh i see, that's about the {.push nilChecks:on.} functionality
01:27:30filwiti'm not there yet
01:27:42filwitidk how to compose the if-stmt
01:27:56Araqproc raiseNilError() {.compilerproc, noreturn, noinline.} =
01:27:57Araq sysFatal(NilError, " nil pointer dereference")
01:28:07Araq# add to lib/system/chcks.nim
01:28:25Araqand then you can use #raiseNilError(); in the C codegen
01:28:28vikatonI thought nilChecks didnt exist yet
01:28:35Araqnote the hash symbol
01:28:54Araqand again, see how other parts of the codegen deal with it
01:29:12filwitkk
01:29:40Araqvikaton: filwit is implementing for practice
01:29:52vikatonO
01:30:10*endragor joined #nim
01:31:24filwitAraq: looks like you already added it as 'chckNil'
01:31:49Araqyeah but that raise a value error
01:32:00Araqalso you shouldn't do the check in there
01:32:00filwityeah i just noticed that
01:32:10Araqyou should emit the check inline
01:32:21filwityeah that's what was confusing me about this
01:32:23Araqotherwise perf will suck
01:32:49filwitthat's what I meant by not knowing how to 'compose' the if
01:33:54filwitsearching 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:16Araqok, we have email validation now
01:48:28Araqthe 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:21vikatonAraq, 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:29dtscodeHey guys... How would I get a TimeInfo to use with format from the times lib?
04:41:40Varriountdtscode: http://nim-lang.org/docs/times.html#getGMTime,Time
04:41:46dtscodeThanks
04:41:56Varriountdtscode: You can also search the index - http://nim-lang.org/docs/theindex.html
04:42:01dtscodeNow how do I get a time?
04:42:03dtscodeEh good point
04:43:14Varriountdtscode: It might be something you have to allocate and then initialize, rather than get directly from a procedure.
04:43:33dtscodehrmmm
04:44:31Varriounteg "var t: TimeInfo; procInitializingTimeInfo(t)"
04:46:23Varriountdtscode: Looks like you can do 'var ti = getLocalTime(getTime())'
04:47:25dtscodeThanks :D
04:48:01Varriountdtscode: Or ''var ti = getGMTime(getTime())'
04:48:48*zaquest joined #nim
04:48:55VarriountHello zaquest
04:50:53zaquestHello
04:55:47*kumool quit (Quit: Leaving)
05:03:42dtscodeVarriount: Thanks for the help. One final problem
05:03:48dtscodeIs christmas the 24th or the 25th?
05:04:02filwit25th
05:04:41dtscodethanks
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:08VarriountAraq: 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:52pigmejreactormonk: ping
07:06:02reactormonkpigmej, pong, but gotta sleep soon
07:06:59pigmejI saw your questions about backend https://github.com/proofit404/company-anaconda/blob/master/company-anaconda.el
07:07:22reactormonkpigmej, could you put that stuff into the issue?
07:07:24*namra joined #nim
07:07:36pigmejsure :)
07:08:36namragreetings
07:08:45reactormonknamra, o/
07:08:46namrawhat version is reflected in the official docs?
07:08:53*endragor_ quit (Ping timeout: 265 seconds)
07:09:01reactormonkmaster usually
07:09:12reactormonkfor more bugfixes, go for devel
07:09:38Varriountnamra: The top of the standard library documentation has the version number. :)
07:09:42VarriountVersion: 0.11.2
07:10:06namrahttp://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:26namrabut the net documentation doesn't show newContext or wrapSocket
07:10:44namrahttp://nim-lang.org/docs/net.html
07:11:02Varriountnamra: That's likely a documentation error.
07:11:40VarriountIf I had to guess, I'd say that the mentioned procedures are only defined when --d:ssl is defined.
07:12:03VarriountAnd if the docgen was run without the -d:ssl flag...
07:12:37namrathat might be possible
07:13:05Varriountnamra: So the best way would be to check the source code, which isn't hard.
07:13:24namraVarriount: just what i did ^^
07:13:50Varriountnamra: If my guess turns out to be true, then there should be a 'when defined(ssl)' around the procedure definition.
07:14:35namrayes
07:14:56VarriountThat needs to be changed into a 'when defined(ssl) or defined(NimDoc):'
07:15:30Varriount(Which hopefully won't break anything when the documentation generator gets run... :/
07:15:35Varriount)
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:26VarriountAraq: 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:32AraqVarriount: no, these don't build with any version of Nim
09:24:48Araqstatic_t is for zahary to work with
09:25:03Araqmore_concurrency is where the exciting new stuff happens
09:25:34Araqthe other branches should be removed
09:26:44VarriountAraq: Ah, ok. I was doing some checking up on the buildbot, and was wondering what was going on.
09:27:19Araqsorry didn't know the bot cares about anything other than 'devel' and 'master'
09:28:13VarriountAraq: 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:15Araqyeah plus more_concurrency should build and work with all the tests
09:29:41Araqer ... except the async stuff
09:31:23fowlAraq: 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:05Araqthat's good to hear... "mostly just works"
09:32:33*Dragonbird joined #nim
09:33:05VarriountAraq: The more_concurrency branch compiles.
09:33:07fowlI only need to decref when reassigning a slot or destroying the object
09:33:08Araqyou need to stress test it though with -d:useGcAssert -d:useSysAssert and playing around with all the combinations in mmdisp.nim
09:33:41VarriountIt didn't compile for the win-64 builder, but that was because I had accidentally deleted gcc.
09:33:55Varriount:<
09:34:41fowlAraq: thanks I will
09:35:50Varriountfowl: I mentioned you in a forum post.
09:37:20fowl: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:41OnOAraq: 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:46OnOAraq: what do you think about that?
10:45:20AraqOnO: you have just described how TR macros work.
10:46:39OnOcorrect me if I am wrong, but currently macro has an access only to the AST part it gets as callsite
10:46:56OnOthe problem is that I need to add extra optimization pass on the statement invoking the macro
10:47:25*BlaXpirit joined #nim
10:47:40OnOotherwise programmer will need to type "optimize:" before each statement explicitly
10:48:14Araqno no no, this is exactly the problem that TR macros solve
10:48:31Araqto get rid of the explicit 'optimize'
10:48:34OnOcan you please elaborate more, or point me to some example?
10:49:35Araqtemplate optAdd{x = y; x.add(y)}(x, y: expr): expr = x = y & z
10:49:55Araqyou should watch my strange loop talk
10:50:10OnOaaa.... gotcha!
10:50:38Araqbut I suspect you need to improve the pattern sublanguage for your needs
10:50:47OnOyou bring me the enlightenment sir! :)
10:51:05OnOcool, 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:51OnOAraq: so as far I reckon TR macros not yet support complex statements?
11:15:39Araqin theory they do
11:16:59*thotypous joined #nim
11:17:44*xcombelle joined #nim
11:18:16OnOhmm.. 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:31Araqtemplate optIf{if 1 < x: anystmt}(x: SomeType)
11:19:50Araqnote that the template rewritings can bite you
11:20:01Araqx > 1 is transformed to 1 < x
11:20:18Araqand 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:34OnOtemplate optIf{if 1 < x: anystmt}(x: int) does not trigger on if 1 < x: echo x
11:31:18Araqwhat's 'anystmt'?
11:31:35Araq(it's not declared in the parameter list)
11:33:04OnOaaa.... I thought it is some matching wildcard
11:33:16OnOthen how to match the whole block?
11:35:19OnOoh 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:13OnOwhat's the order of TR are getting executed? order they are declared?
11:38:03*filwit quit (Quit: Leaving)
11:40:06OnOanother Q: how do I match field access (aka dot access) for any field?
11:44:31Araqyes, order they are declared
11:44:33*vendethiel quit (Ping timeout: 272 seconds)
11:45:04OnOtests/trmacros/tdisallowif.nim seems to not work :(
11:45:09Araqtemplate dotAccess{x.y}(x: Type, y: expr)
11:45:25Araqyeah I know, it worked at one point
11:45:57AraqI think it's because of the lambda lifting pass that introduces empty nodes for potential closure creation
11:48:20Araqtrees.flattenStmts doesn't handle nkEmpty
11:48:34Araqpatterns.nim implements the pattern matchings
11:48:48Araqit shouldn't be too hard to figure out what's wrong
11:51:13OnOand 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:58Araqgood question. with a guard.
11:59:43Araqtansform into (.obj.field.) where (. .) is a new construct that prevents TR macro from being applied...
11:59:49Araqbbl
12:00:12OnOokay 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:26AraqOnO: much better than preventing *all* TR macros is to name the optimization that should be prevented:
12:47:08*tamtaradam joined #nim
12:47:12AraqormFieldAccess(.obj.field.) # shield against ormFieldAccess transformation
12:47:44OnOyou mean (. is already in the devel somewhere, coz there no word about that in Manual ?
12:48:05Araqno, but it's already a token
12:51:37AraqOnO: not sure that's the synax we should use for this feature, but it's good enough for now
12:52:43tamtaradamHello. 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:20tamtaradamSorry. I want to wrap, not warp :)
12:53:52Araqtamtaradam: http://goran.krampe.se/2014/10/16/nim-wrapping-c/
12:55:54tamtaradamThanks, 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:24BlaXpiritfowl probably knows
12:58:09BlaXpiriti did this: cpp -C mainheader.h
12:58:14BlaXpirittamtaradam,
13:00:31Araqtamtaradam: with more recent versions of c2nim you can keeps your options in a .c2nim file
13:02:41Araqand iirc c2nim options.c2nim *.h just works
13:02:52*vendethiel joined #nim
13:03:31tamtaradamWow, i didn`t know it. Thanks
13:03:55OnOAraq: so I should make a PR for (. correct ? coz currently I get Error: expression expected, but found '(.'
13:04:47Araqaye
13:04:55OnOokay, I'll try that
13:06:35tamtaradamAraq, 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:22ozraAny 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:34dom96ozra: nerd stamp? wut?
15:50:50dom96ozra: Try putting `let a = x + 3; a - 2` in parenthesis.
15:50:53*vendethiel joined #nim
15:51:03ozraHehe. Since one's supposed to drink beer ;-)
15:52:00ozradom96: Thanks.
15:52:44*yglukhov_ quit (Ping timeout: 245 seconds)
16:03:11ozradom96: 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:35ozraFor "normal" call syntax
16:03:56dom96I think there is
16:09:41ozraOk. 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:12ozraOtherwise, 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:35ozradom96: If you know? ( Λ is a copy of `=>`, without infix notation)
16:17:20dom96ozra: No idea. Might be worthy of a bug report.
16:17:29*OnO quit (Ping timeout: 264 seconds)
16:17:41ozraAlright. 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:46Araqozra: that's just the old "we don't want strong spaces in the language problem"
16:20:12Araqwith strong spaces you get exactly the right behaviour. without them you get what we have today.
16:20:35Araqbut everybody is so afraid of them that we cannot enable them.
16:20:57ozraAlright, 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:03ozraI would expect calls to obey strong space, since command syntax is possible...
16:22:41Araqwell I'm not sure about your capital lambda
16:23:04Araqfoo(bar) passes 'bar' to 'foo', not '(bar)'
16:23:22Araqand foo (bar) is the same.
16:23:50Araqand with #! strongspaces it's '(bar)'. (Somebody needs to test this.)
16:24:49ozraYeah, 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:07AraqI agree
16:25:34*BlaXpirit quit (Quit: Quit Konversation)
16:25:56ozraThat is a common enforcement in juxtaposition allowing langs imo. Shouldn't have to be connected with "expression-strong-spaces" imo.
16:26:13ozraShould I file a bug report?
16:26:45Araqwell you're completely right, but I know code bases where foo (bar) with the current meaning is very common.
16:27:02Araqso it will break lots of code out there.
16:27:22*BlaXpirit joined #nim
16:27:28Arrrrbetter now than later
16:27:57ozra`#! strongspaces`- is that correct? Doesn't work with that either.
16:28:25Araqozra: yeah but that's just a bug. I think.
16:28:53ozraSolving it generally solves both in other words. I'll just file one report.
16:29:06Araqok
16:31:26ozraHmm, 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:05ozraAraq: 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:08ozraWell, 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:24ozraI'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:11wuehlmausanybody 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:29wuehlmausi know about rosettacode
17:43:36reactormonkfinally needs to die
17:43:39reactormonk... sf
17:45:30dtscodeis sf sourceforge?
17:45:35reactormonkyup
17:45:42dtscodeI second that then
17:50:07*boop is now known as boopisaway
17:50:36def-wuehlmaus: is it still maintained? no updates since 2011
17:53:10*Senketsu joined #nim
17:54:30*jj2baile joined #nim
18:02:42ArrrrIf 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:01wuehlmausdef-: i didn't ask this question, it's a good one!
18:08:34*boopisaway is now known as boop
18:11:01wuehlmaus.. 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:53ozraAnyone 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:41JehanIIozra: You need `delt do:` instead of `delt:` if you use it as part of an expression.
18:37:54ozraaha.
18:37:56JehanIIYou'll probably also need to indent the let part.
18:38:05JehanIIAnd a macro that does a discard will confuse the compiler.
18:38:10JehanIIIt has to return something.
18:38:35ozraI just wrote discard here to keep it short...
18:39:53ozraHmm. 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:09JehanIIyes, that's what I meant by indenting the let part.
18:40:27JehanIIEither that or put it inside parentheses.
18:40:38ozraBut that gives the same error..
18:42:27ozraHmmm.. guess I'll have to stick with delt((...)) notation.
18:43:02ozraSeems 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:34JehanIIozra: https://gist.github.com/rbehrends/59241405ab3d1501c972
18:44:09*askatasuna joined #nim
18:45:00*vikaton quit ()
18:45:50ozraJehanII: 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:34JehanIIThen use: var del1 = delt do: (let a = x+3; a-2)
18:47:02ozraso `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:37JehanIIThat 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:37ozra(it's really called Λ, I just tried delt to see if there was a parse bug w. unicode)
18:48:20ozraJehanII: I've coded identation-based for about 16Y, and one liners are always possible rather cleanly. And, as per above example..
18:48:21BlaXpiritso i just had an idea
18:48:32BlaXpirityou use the (thingy; thingy)
18:48:47BlaXpiritmake macros which define things through function calls
18:48:50BlaXpiritmake a lisp
18:48:52JehanIII don't mean to discourage you, I'm just pointing out that there's a tradeoff here.
18:49:55ozraJehanII: 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:30ozraIf it is OKed to be fixed...
18:51:52JehanIIHonestly, 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:57ozraThe 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:30ozraAccording 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:42ozraJehanII: ~
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:26boopaaah.
19:26:31boopcan i not use async in a thread?
19:27:50*whatisaphone quit (Quit: Leaving)
19:28:07*johnsoft joined #nim
19:28:15dom96boop: not right now
19:28:30boop:(
19:28:37*johnsoft is now known as whatisaphone
19:28:55boopwell that's annoying
19:28:56boophmm
19:29:26boopany way around it?
19:30:21*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:31:18dom96boop: What is your use case?
19:31:45boop'await'ing in a thread for messages from another thread
19:32:06*johnsoft joined #nim
19:32:11boopasync worked fine until I tried to use await
19:32:53dom96what errors are you getting?
19:33:54boopprivate/bynim_workthread.nim(31, 21) Info: template/generic instantiation from here
19:33:56booplib/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:26boop..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:37boopwith a bit of fiddling it's not erroring now
19:35:38booplet 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:01boopno errors now, but it's just Not Working
19:41:03boophm.
19:41:49boopi had to re-register the FD so..
19:45:05boop..wait, i've run async irc in a thread..
19:45:25dom96why do you need multiple threads?
19:46:02boopcode is being called as a library from a game, game locks up until the function returns.
19:46:13booppushing it into a thread and using sockets to communicate with it
19:46:38dom96Could you not use callbacks instead?
19:48:44boopthis game engine's FFI consists only of a 'char *func(int argc, char **argv)' call :/
19:49:09boopno callbacks
19:49:11boopit's a pain
19:50:03*aaronk joined #nim
19:51:23dom96Is there no event loop?
19:51:25*shevy left #nim ("I'll be back ... maybe")
19:51:39*solidsnack joined #nim
19:52:38boopnot one i can plug into
19:52:52boop(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:34dom96boop: that's odd. What engine are you using?
20:00:45boopBYOND, DM
20:00:49boop..it's really not designed for this kind of thing
20:00:55boophttp://www.byond.com/
20:02:09*bassa joined #nim
20:02:17boophmm.. issue might be somewhere else
20:02:28boop.send on my asyncsock isn't completing
20:02:39boopbut I can't really see why not
20:07:40boopand now I see why.. hmm
20:08:02boopdom96: false alarm, problems in my code :) turns out async does work in threads?
20:08:37dom96I never tested it so I default to "it does not work" :P
20:09:38boop:p
20:11:11*xcombelle quit (Remote host closed the connection)
20:11:28boopslightly 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:21NoobulaterDoes nim have a built in proc for converting little-endian to big-endian?
20:18:57Araqendians.nim module
20:19:52Noobulaterthanks Araq
20:20:10dom96boopisaway: 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:35vikatonAre there any tutorials/eamples of Nim being used with the windows API
20:25:53vikatonor Nim + C++ interop examples?
20:26:04*aaronk joined #nim
20:26:10*solidsnack joined #nim
20:26:21aaronkforum account activation failed for me just now :-(
20:27:35aaronk"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:06vikatonwait is C++ FFI like C++ interp or totally different?
20:37:07dom96aaronk: hrm
20:37:27dom96aaronk: 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:38boopdom96: 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:43dom96boop: Create a PR to make it public :)
20:44:48boopsure! :)
20:48:28aaronkdom96: sure
20:48:58vikatonanyone ere good with C++ ?
20:49:37*johnsoft quit (Quit: Leaving)
20:49:51*johnsoft joined #nim
20:50:08dtscodevikaton: sure
20:50:41vikatondtscode: So I have this C++ code here of a simple keylogger in C++
20:50:53vikaton(this isnt for malicious activiity)
20:50:54vikatonhttps://gist.github.com/Vikaton/6ea33e517d504ab67bfb
20:51:07dtscodeok
20:51:13ozraaraq: 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:30vikatonanyhow, I want to see how I can use Nim C++ FFI to create the same thing or using Windows API with Nim
20:51:51vikatonboth of which idk how to do and cant find docs on, so I need to be guided in the right direction
20:52:05dtscodeLike do you want to use as much nim as possible or call the keylogger from nim code?
20:52:42vikatonuse nim as much as possible
20:53:36dtscodeOk. 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:01vikatonOh ok, thanks
20:54:03dtscodeI think theres also a win32 wrapper floating around in the stdlib, fwiw
20:54:15boopthere's two, "windows" and "winlean"
20:54:30boopwindows has everything in windows.h, winlean has just the bits the compiler uses
20:54:35vikatonYeah if I can get a hold of windows.h and winuser.h equivalents in Nim, this should be easy
20:54:40boopcompiler and the standard lib*
20:54:47boopwindows.nim is massive
20:55:37vikatondisclaimer, 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:38Mat4hmm, is there a reason for using <stdio> routines instead of <iostream> ones ?
20:56:51*filcuc joined #nim
20:57:13boopMat4: using c instead of c++
20:57:17dtscodehttp://rosettacode.org/wiki/Call_a_foreign-language_function#Nim
20:58:25*gokr_ joined #nim
20:58:28vikatondtscode: Im gonna be using C FFI ?
20:59:02dtscodevikaton: If you wrap the c++ function in extern "C" it should be fine
20:59:36gokr_Or you use c2nim and the cpp backend
20:59:36Mat4eh yes however both are used in the pasted code ?!??, is this just a test routine ?
20:59:49gokr_Like we do with Urhonimo
21:01:39dtscodegokr: even better :D
21:01:52*boop is now known as boopisaway
21:02:16dtscodeSpeaking 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:34vikatonAt least I got a messagebox going from C FFI from windows.h
21:15:37vikatongud pr0gress
21:18:36vikatondoes anyone here know that the Nim docs are on the MIT website?
21:20:38*Strikecarl joined #nim
21:21:15StrikecarlOk 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:30Strikecarlhow would i do that+
21:21:59Araqozra: consider your PR accepted and start working on bugs :P
21:23:17vikatondoes Nim support inline asm ?
21:23:55ozraAraq: 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:59vikatonIndeed it does
21:27:35vikatonhttp://prntscr.com/7awp0w
21:28:21StrikecarlGj vikation :P
21:28:32vikatonbaby steps :P
21:29:20Strikecarlwho uses prntscr nowadays tho
21:29:56vikatonI dont see a problem with it
21:29:58vikatonI like it
21:30:22Strikecarlgetsharex nub
21:31:04vikatonwill look into it
21:33:24vikaton0...10 includes 10 correct?
21:33:37StrikecarlAfaik.
21:33:43JehanIIWith two dots.
21:34:55vikatonI thought .. what exclusive
21:39:33iznogoodd0..<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:58vikatonHow can I cast an int to a cint ?
21:40:23iznogooddcast or convert
21:40:29JehanIIcint(x) or x.cint
21:43:39*boopisaway is now known as boop
21:46:08vikatonIf I'm dealing with an ambigious type error, what should I generally do to the type?
21:46:09vikatono wait
21:47:10iznogooddmake it less ambiguous
21:47:16vikatonyeah I got it
21:48:34*JehanII quit (Quit: Leaving)
21:49:09vikatonSuccess!
21:49:18vikatonGetAsyncState works :P
21:50:12*vendethiel quit (Ping timeout: 276 seconds)
21:50:29*intra quit (Ping timeout: 265 seconds)
21:51:35vikatonhttp://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:17vikatondtscode: 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:21vikatonI may have ran into a problem. How do I import a type from C ?
22:31:56Senketsuim afraid you have to declare the type in nim
22:32:05Senketsudefine* w/e
22:32:52Varriountvikaton: Which isn't that hard. C structs map to Nim quite easily.
22:33:06*vendethiel quit (Ping timeout: 276 seconds)
22:34:14VarriountAraq: What kind of output message should the irc buildbot have when a build succeeds/fails?
22:34:19vikatonWell this is kinda complicated
22:34:35vikatonI 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:59vikatonmy end goal is to port this to Nim: https://gist.github.com/Vikaton/6ea33e517d504ab67bfb#file-keylog-cpp-L79
22:35:55Varriountvikaton: Building a key logger?
22:36:17vikatonVarriount: Yes, for experimental purposes
22:36:22*boop is now known as boopisaway
22:36:29vikatonI have everything set, except the stealth console
22:36:29VarriountRiight.. ;D
22:36:34vikatonhehe
22:37:08Varriountvikaton: You need the type that corresponds to 'HWND'?
22:37:26vikatonVarriount: Yes, which is the type of HANDLE
22:37:59Varriountvikaton: http://nim-lang.org/docs/windows.html#HWND
22:38:47vikatonwait wtf :/
22:38:59Varriount:3
22:39:02vikatonI didnt have to create a C binding with windows.h after all?
22:39:09vikatondarn it :[
22:39:28VarriountWell, to be fair, that windows wrapper is a tad incomplete, not to mention inaccurate.
22:39:31vikatonmy code self-esteem was p high until u had to ruin it :(
22:40:32Varriountvikaton: That module was originally translated from Pascal... make sure to verify the procedure signatures and type layouts...
22:40:51VarriountIn particular, there are some places where an 'int32' is used, when it should be 'int'
22:41:14Varriountvikaton: Sorry. I'm a terrible, terrible person.
22:41:36vikaton>:(
22:41:41vikatonthanks anyway tho lol
22:42:53dom96Varriount: [CommitHash] Architecture: Build failed/succeeded
22:45:10vikatonaaaand
22:45:20vikatonthe keylogger in Nim is complete :)
22:45:45VarriountNow to send it out among an unsuspecting world... Muahahahaha!!!!
22:46:23vikatonim going to leave proc GetAsyncKeyState(key: cint): int {.header: "<windows.h>", varargs.} in there
22:46:27vikatonjust to seem cool :P
23:00:14*vaedd quit (Quit: Connection closed for inactivity)
23:05:01vikatonHow can I check the IAT table in Nim ?
23:05:40VarriountIAT Table?
23:06:25vikatonImport Address Table
23:08:53Varriountvikaton: You mean, have a program modify it's own import address table, or simply view the import address table of an exe?
23:09:04VarriountHow would you normally do this in C?
23:09:33vikatonwith getProcAddress and LoadLibrary ?
23:09:57Varriountvikaton: 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:22vikatonI'm getting a mismatch error with GetProcAddress(LoadLibraryA("User32.dll"), cstring("MessageBox"))
23:41:39vikatonsays that it got a (FARPROC)
23:41:43vikatonbut expected so and so
23:42:06*vendethiel joined #nim
23:42:38vikatoncode is this
23:44:22*johnsoft quit (Ping timeout: 255 seconds)
23:44:37*johnsoft joined #nim
23:45:30vikatonhttps://www.irccloud.com/pastebin/WIR0N0OD/
23:45:39vikatondunno why that took so long to send
23:46:11*Trustable quit (Remote host closed the connection)
23:49:00vikatonanyone? :{
23:49:17Varriountvikaton: http://nim-lang.org/docs/windows.html#LoadLibraryA,LPCSTR
23:49:38VarriountLook at the return type of that, and the parameter type that GetProcAddress takes.
23:50:35vikatonVarriount: the return type is a HINST
23:50:44vikatonwhich is what GetProcAddress wants
23:51:33*frozen joined #nim
23:52:10Varriountvikaton: What error are you getting?
23:52:34vikatonhttps://www.irccloud.com/pastebin/PR9Wlxky/
23:52:37vikatonVarriount: ^
23:53:24Varriountecho repr(GetProcAddress(LoadLibraryA("User32.dll"), cstring("MessageBox")))
23:53:38vikatonwat is repr
23:54:01Varriountvikaton: Debug procedure that can get a useful string representation out of most data types.
23:54:12vikatonnice
23:54:49VarriountIt's only supposed to be used for debug code though - no guarantees are made about it's output being stable.
23:55:00Varriount(from version to version)
23:58:30vikatonthat's cool
23:58:40vikatonVarriount: its up btw https://github.com/Vikaton/nim-keylogger