00:01:09 | * | Xe quit (Changing host) |
00:01:09 | * | Xe joined #nim |
00:01:32 | * | kunev quit (Ping timeout: 240 seconds) |
00:01:35 | * | yglukhov joined #nim |
00:02:37 | * | kunev joined #nim |
00:03:36 | * | flyx joined #nim |
00:03:58 | * | euantor is now known as Guest85972 |
00:03:59 | * | Pisuke is now known as Guest3423 |
00:04:23 | * | byte512 joined #nim |
00:04:24 | * | pydsigner joined #nim |
00:04:46 | * | m712 joined #nim |
00:05:48 | * | yglukhov quit (Ping timeout: 240 seconds) |
00:10:37 | * | Jipok[m] joined #nim |
00:11:24 | * | smt joined #nim |
00:12:27 | * | smt_ joined #nim |
00:14:57 | * | smt` quit (Ping timeout: 248 seconds) |
00:16:37 | * | smt quit (Ping timeout: 260 seconds) |
00:16:51 | * | MrAxilus[m] joined #nim |
00:16:52 | * | ehmry joined #nim |
00:16:52 | * | dyce[m] joined #nim |
00:16:52 | * | Demos[m] joined #nim |
00:16:59 | * | hohlerde joined #nim |
00:16:59 | * | TheManiac joined #nim |
00:16:59 | * | jivank[m] joined #nim |
00:16:59 | * | mindB joined #nim |
00:29:59 | * | smt joined #nim |
00:33:31 | * | smt_ quit (Ping timeout: 246 seconds) |
00:42:41 | * | sz0 quit (Quit: Connection closed for inactivity) |
00:49:24 | * | def-pri-pub joined #nim |
01:00:51 | Elronnd | wtf does this nimble warning mean? "Warning: File inside package 'goodbot' is outside of permitted namespace, should be named 'goodbot.nim' but was named 'logging.nim' instead. This will be an error in the future." I *have* a file named goodbot.nim, and it imports logging.nim. Why tf should that be an issue? |
01:15:45 | * | maxcroud joined #nim |
01:16:44 | maxcroud | nim.fun domain is available for $4.99, renewal: $24.99. Just so ;) |
01:16:52 | * | maxcroud left #nim (#nim) |
01:25:27 | * | ShalokShalom quit (Ping timeout: 240 seconds) |
01:37:25 | * | def-pri-pub quit (Quit: leaving) |
01:38:25 | * | onionhammer quit (Quit: WeeChat 1.7) |
01:50:40 | * | couven92 quit (Read error: Connection reset by peer) |
01:51:43 | * | pilne joined #nim |
01:55:10 | * | chemist69 quit (Ping timeout: 240 seconds) |
01:56:17 | * | onionhammer joined #nim |
02:09:09 | * | chemist69 joined #nim |
02:40:39 | FromGitter | <brentp> hi, if I define a type like: `Op* = uint32` and then define an exported `$` on Op, then it seems to try to use that `$` method for all uint32's even if I haven't defined them as Ops. Is there a way to get around this? |
02:44:00 | * | Kingsqueee quit (Quit: https://i.imgur.com/qicT3GK.gif) |
02:46:16 | FromGitter | <brentp> the specific error I get is |
02:46:20 | FromGitter | <brentp> `````` |
02:46:23 | FromGitter | <brentp> Error: ambiguous call; both system.$(x: uint64) and hts.$(o: Op) match for: (uint8) |
02:49:57 | * | def-pri-pub joined #nim |
02:49:57 | * | def-pri-pub quit (Changing host) |
02:49:57 | * | def-pri-pub joined #nim |
02:50:37 | def-pri-pub | zacharycarter: not sure if you're here or AFK right now, but I posted the spec for the ZSPrite as a merge request. If it looks good to you, can you add it in? Otherwise, tell me what's off and we can work on a better design. |
02:50:58 | * | Kingsquee joined #nim |
02:50:59 | def-pri-pub | What I think I have right now should suit 99% of the needs for simple animated sprites at the moment. |
02:57:24 | * | pilne quit (Quit: Quitting!) |
03:05:04 | rauss | In a concept, is there a difference between `x is Type` and `x of Type`? The docs say `is` but `of` is used everywhere else for type checking AFAICT |
03:09:32 | * | endragor joined #nim |
03:22:43 | * | def-pri-pub quit (Quit: leaving) |
03:48:26 | * | Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif) |
04:07:22 | * | MrAxilus[m] quit (Ping timeout: 276 seconds) |
04:19:08 | * | MrAxilus[m] joined #nim |
04:28:22 | * | v17d joined #nim |
04:35:27 | * | dankrad joined #nim |
05:00:49 | * | v17d quit (Remote host closed the connection) |
05:02:22 | * | v17d joined #nim |
05:29:34 | * | haha_ joined #nim |
05:36:30 | * | dankrad quit (Ping timeout: 240 seconds) |
05:42:30 | * | ShalokShalom joined #nim |
06:04:33 | * | solitude joined #nim |
06:10:45 | * | Vladar joined #nim |
06:23:45 | * | haha_ quit (Quit: haha_) |
06:24:28 | * | rauss quit (Quit: WeeChat 1.9) |
06:24:46 | * | yglukhov joined #nim |
06:31:30 | * | nsf joined #nim |
06:31:30 | * | yglukhov quit (Remote host closed the connection) |
06:32:37 | * | ShalokShalom_ joined #nim |
06:35:16 | * | ShalokShalom quit (Ping timeout: 240 seconds) |
06:40:04 | * | ibutra joined #nim |
06:41:57 | * | solitude quit (Ping timeout: 240 seconds) |
06:42:12 | * | solitude joined #nim |
06:49:51 | * | Arrrr joined #nim |
06:51:24 | * | gangstacat joined #nim |
07:06:07 | * | v17d quit (Ping timeout: 260 seconds) |
07:08:06 | * | haha_ joined #nim |
07:09:59 | * | haha_ quit (Client Quit) |
07:12:55 | * | v17d joined #nim |
07:18:37 | * | mahmudov joined #nim |
07:25:27 | * | yglukhov joined #nim |
07:27:46 | * | gokr joined #nim |
07:28:49 | * | yglukhov quit (Remote host closed the connection) |
07:29:01 | * | yglukhov joined #nim |
07:37:14 | Araq | brentp: use a distinct type? |
07:41:15 | * | scriptum quit (Quit: Leaving) |
08:08:20 | * | salewski joined #nim |
08:10:12 | salewski | Araq, you pointed me recently to the sameType() function for use in macros to test for exact same types. |
08:10:48 | salewski | Is there something like the "of" operator which can be used in macros? |
08:12:16 | salewski | I think for some signals with not uniq names and different parameter list I will use such a test in the macro. |
08:12:35 | * | ShalokShalom_ is now known as ShalokShalom |
08:12:51 | * | ShalokShalom quit (Remote host closed the connection) |
08:13:32 | salewski | So when button is a subtype of widget, and user passes a Button type, I would have to recognize that it is "of" type Widget. |
08:14:23 | salewski | THat is necessary only for a few signals, but I can not really avoid it. |
08:15:51 | salewski | Maybe I can use somethink like "when compiles()" in the macro, doing an assignment in the passed arguments. |
08:16:16 | salewski | When it compiles, then types are compatible. |
08:25:57 | Araq | uhh, macro's getType does give you supertype information already |
08:26:40 | Araq | t[0] or t[1] gives the super type that you can that check against Buttton. sorry, forgot the details but it's possible |
08:29:29 | salewski | Oh, that is interesting. Will test that, thanks. |
08:33:28 | * | salewski quit (Quit: WeeChat 1.4) |
08:42:01 | * | Jipok joined #nim |
08:43:05 | Jipok | Hey. I have a pointer to the C array. How do I convert this to nim array/seq? |
08:45:23 | Jipok | I tried cast[seq[uint8]](pixels), and got "index out of bounds [IndexError]" |
08:45:38 | FromGitter | <zacharycarter> @define-private-public sorry yesterday was a wash for me I'll have more time today to review issues / prs |
08:46:51 | yglukhov | Jipok: var mySeq = newSeq[MyType](myLen); memCopy(addr mySeq[0], myCArray, myLen * sizeof(MyType) |
08:46:58 | yglukhov | * copyMeme |
08:47:02 | yglukhov | * copyMem |
08:47:20 | Jipok | wow |
08:48:37 | Jipok | It does not look good |
08:49:15 | Jipok | I get a copy? |
08:49:37 | yglukhov | yup |
08:49:42 | yglukhov | don't you want to? |
08:50:16 | * | dom96|w joined #nim |
08:50:31 | Jipok | Yes, I need to change the array |
08:50:50 | yglukhov | you can use {.unchecked.} array then |
08:51:01 | yglukhov | grep the manual for {.unchecked.} |
08:51:47 | Jipok | I tried, but it seemed to do it wrong |
08:53:05 | Jipok | I have to declare my type and then cast array to him? |
08:53:06 | * | Guest85972 is now known as euantor |
08:53:36 | * | euantor is now known as Guest30533 |
08:54:07 | yglukhov | yup, smth like that, don't remember exactly |
08:56:21 | Jipok | so, i tried "var data: ArrayPart = surf.pixels" |
08:56:31 | Jipok | but got type mismatch: got (pointer) but expected 'ArrayPart = array[0..0, int]' |
08:56:37 | yglukhov | cast? |
08:57:14 | Jipok | type mismatch: got (ptr ArrayPart) but expected 'ArrayPart = array[0..0, uint8]' |
08:57:27 | Jipok | oh |
08:57:33 | Jipok | Error: expression cannot be cast to ArrayPart |
08:59:05 | Jipok | can I simply change the value of the pointer and get data at its address? |
08:59:12 | yglukhov | type MyArr {.unchecked.} = array[0 .. 0, int] |
08:59:17 | yglukhov | var a: ptr int |
08:59:21 | yglukhov | var arr = cast[MyArr](a) |
08:59:25 | yglukhov | works for me |
08:59:53 | Jipok | hmm |
08:59:57 | Jipok | ptr int |
09:00:02 | Jipok | but i have just pointer |
09:00:26 | yglukhov | well, cast it to (ptr T) before casting to array |
09:01:25 | Araq | actually an unchecked array is still an *array* and you want a pointer to it |
09:01:36 | yglukhov | also note that 0 .. 0 might not be a valid range for you, because range checks are done in compile time afaik |
09:01:59 | Araq | yglukhov: that's apparently not a problem anymore |
09:02:11 | yglukhov | oh, cool |
09:02:44 | Jipok | Araq, how i can do it? |
09:04:57 | Jipok | yglukhov: "cast it to (ptr T)" not works too |
09:05:42 | yglukhov | Jipok: which nim version are using btw? |
09:05:55 | yglukhov | actually i can cast pointer directly to array |
09:05:59 | yglukhov | with no errors |
09:06:10 | yglukhov | haven't tested it in runtime though |
09:06:10 | yglukhov | =) |
09:07:16 | Jipok | last stable |
09:07:32 | Jipok | 0.17.0 (2017-05-17) |
09:07:59 | Araq | type MyArr {.unchecked.} = array[0 .. 0, int] |
09:08:45 | Araq | var view = cast[ptr MyArr](data) |
09:09:08 | Araq | and then use view[i] etc |
09:10:23 | yglukhov | Araq: will `var view = cast[ptr MyArr](data)[]` (note deref) produce the same code? |
09:10:56 | Jipok | Well at least now it is compiled |
09:11:24 | yglukhov | i think devel is already too far away from 0.17... |
09:11:44 | Araq | well the deref produces an array copy |
09:11:58 | yglukhov | how would it copy an unchecked arary? |
09:11:58 | Araq | and the compiler cannot copy it becuase it doesn't know the size |
09:12:08 | yglukhov | ok |
09:12:14 | Araq | well it would do something ... crazy |
09:12:18 | yglukhov | =) |
09:12:26 | Araq | like copying an array with 1 element in it |
09:13:07 | Araq | in retrospect .unchecked is kind of messy |
09:13:38 | yglukhov | maybe zielmicha's views will kick in at come point?.. |
09:16:02 | Araq | not sure I like it, yes at least you don't lie to the compiler but it introduced a new kind of type into the language via some innocent pragma |
09:16:11 | Araq | a type of "unknown" size. |
09:16:25 | Araq | Nim doesn't have these |
09:17:12 | yglukhov | type of "unknown" size? how come? isn't it just a wrapper to some buffer? |
09:17:26 | yglukhov | with internal pointer/ref to the buffer |
09:17:27 | Araq | an unchecked array is a type of unknown size |
09:17:37 | Araq | so every copy operation must be prevented |
09:17:44 | yglukhov | ah that one is. |
09:18:05 | yglukhov | i was talking about zielmicha's views =) |
09:19:18 | yglukhov | gitter-irc bot is somewhat lagging... |
09:20:23 | yglukhov | test |
09:20:36 | FromGitter | <yglukhov> test |
09:20:50 | yglukhov | nevermind, looks ok now. |
09:22:34 | * | Tiberium joined #nim |
09:39:09 | * | Jipok quit (Quit: Page closed) |
09:39:20 | * | couven92 joined #nim |
09:40:46 | Jipok[m] | Thanks to everyone, finally I was able to do it |
09:40:53 | Jipok[m] | https://i.imgur.com/oQwh7kb.png |
09:48:53 | * | dddddd quit (Remote host closed the connection) |
09:59:12 | Tiberium | Jipok[m], well, will you make a PR to nimgame2 ? :) |
10:01:37 | * | crem quit (Ping timeout: 276 seconds) |
10:01:54 | dom96|w | Araq: This might be of interest: https://news.ycombinator.com/item?id=15016083 |
10:03:06 | * | haha_ joined #nim |
10:03:12 | Araq | nim's GC is based on this paper |
10:03:20 | Araq | or at least earlier versions were |
10:07:40 | * | Guest30533 is now known as euantor |
10:07:54 | * | euantor quit (Changing host) |
10:07:54 | * | euantor joined #nim |
10:09:42 | Arrrr | Mmm i was under the impression new was a reserved word |
10:10:49 | * | gangstacat quit (Quit: Leaving) |
10:10:50 | Tiberium | it's a proc AFAIK |
10:10:56 | euantor | Looks like the website for that Dao programming language was brought grinding to a halt by HN |
10:11:28 | Tiberium | how to find it in google?dao lang doesn't give any results :) |
10:11:35 | Tiberium | ah, dao programming language |
10:11:51 | Tiberium | it's written entirely in C |
10:13:01 | Tiberium | well it looks like it's a VERY new language |
10:13:22 | dom96|w | Araq: cool |
10:14:17 | Tiberium | oh wait i'm wrong |
10:14:31 | Tiberium | current dao development began in 2006 |
10:21:04 | * | dddddd joined #nim |
10:26:33 | Tiberium | is there any way to check current directory at compile-time? in a macro |
10:27:59 | Araq | Tiberium: dirExists works at compiletime iirc |
10:28:13 | Tiberium | thanks, this is exactly that I need! |
10:34:38 | Tiberium | yeah, works |
10:47:06 | Araq | dom96|w: it's also wrong btw |
10:47:16 | Araq | that paper has a bug ;-) |
10:47:21 | Araq | a big one, in fact |
10:50:58 | * | tankfeeder quit (Quit: Connection closed for inactivity) |
10:52:57 | * | haha_ quit (Quit: haha_) |
10:54:10 | Tiberium | btw, AsyncHttpServer is very stable, it didn't crash even after 10 days of working (but most of the time it was idle) |
10:54:17 | Tiberium | also for now I need to use nginx for SSL |
10:56:22 | * | mal`` quit (Quit: Leaving) |
10:57:42 | subsetpark | Hard not to. We should really have a wsgi protocol implementation |
10:58:48 | Tiberium | well I wanted to have something built-in in jester or asynchttpserver for SSL (it's easier to use SSL this way for testing) |
10:59:11 | Tiberium | I know that for production you shouldn't use built-in SSL |
11:02:22 | * | tankfeeder joined #nim |
11:22:31 | * | couven92 quit (Quit: Client disconnecting) |
11:26:14 | * | mal`` joined #nim |
11:35:27 | * | dave24 quit (Ping timeout: 240 seconds) |
11:35:44 | * | couven92 joined #nim |
11:35:59 | * | dave24 joined #nim |
11:44:20 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
11:44:56 | * | haha_ joined #nim |
11:47:35 | FromGitter | <yglukhov> Tiberium: we're using it on prod, and did a stress test to it with 30k simultaneous "users", no problems there |
11:47:46 | Tiberium | yeah, that's the good thing :) |
11:47:48 | FromGitter | <yglukhov> 1) without ssl |
11:47:57 | Tiberium | I use it for vk.com Callback API |
11:48:14 | Jipok[m] | some noob question. how to concatenate two strings? |
11:48:20 | Tiberium | Jipok[m], "a" & "b" |
11:48:29 | Jipok[m] | why not +? |
11:48:30 | FromGitter | <yglukhov> however, there is one tiny. it may go out of sockets on accept, and will raise, and stop listening. |
11:48:51 | Tiberium | Jipok[m], because explicit is better than implicit? :) |
11:49:02 | Tiberium | e.g. it's better to have separate operator for strings |
11:49:06 | Tiberium | well, don't ask me |
11:49:12 | Tiberium | I don't know actually |
11:49:44 | yglukhov | because "+" comes from math? and match doesn't know how to add strings? =) |
11:51:05 | FromGitter | <Sud0nim> If you really want to use + you can just overload the operator: |
11:51:06 | FromGitter | <Sud0nim> proc `+`(a,b: string): string = a & b |
11:51:42 | Tiberium | template is better maybe? |
11:51:53 | Tiberium | because someone can add & to their type |
11:52:15 | Tiberium | template `+`(a, b: untyped): untyped = a & b |
11:52:17 | FromGitter | <Sud0nim> Fair enough, but either way I think using & is better |
11:52:20 | Tiberium | yeah |
11:56:20 | * | ibutra_ joined #nim |
11:58:13 | * | ibutra_ quit (Client Quit) |
11:58:21 | * | ibutra_ joined #nim |
11:58:21 | * | ibutra_ quit (Client Quit) |
11:58:48 | * | ibutra_ joined #nim |
11:59:53 | FromGitter | <Sud0nim> Hmm, maybe I should convert most of my proc overloading to templates for performance reasons... Still learning a lot |
12:00:16 | Tiberium | well you can use "inline" too |
12:00:27 | FromGitter | <Sud0nim> {.inline.} ? |
12:00:29 | Tiberium | yes |
12:00:30 | Tiberium | templates are better because you don't need generic procedures |
12:00:33 | * | ibutra quit (Ping timeout: 248 seconds) |
12:00:44 | Tiberium | if you're overloading operator which is used for many types |
12:01:33 | FromGitter | <Sud0nim> Yes I think they feel cleaner to me also looking at the code also, rather than pragmas which I don't like so much aesthetically |
12:02:09 | * | ScherzkeCks joined #nim |
12:03:38 | * | kalexm joined #nim |
12:04:49 | * | ibutra_ quit (Ping timeout: 248 seconds) |
12:07:29 | * | ScherzkeCks quit (Quit: Leaving) |
12:10:37 | * | arnetheduck joined #nim |
12:13:57 | Demos[m] | idk I'd keep em generic |
12:14:12 | Demos[m] | since generics are less powerful and participating in overload resolution is nice |
12:14:22 | Demos[m] | there is no runtime perf difference |
12:14:37 | Demos[m] | and probably not much of a compile time one |
12:15:26 | * | ScherzkeCks joined #nim |
12:15:28 | * | ScherzkeCks quit (Client Quit) |
12:15:50 | * | ibutra joined #nim |
12:17:13 | * | dom96|w joined #nim |
12:17:24 | Tiberium | Demos[m], well with generics a function is generated for every type on which this generic proc is called |
12:17:47 | Tiberium | you can see this in C code |
12:17:50 | Demos[m] | yeah, but that's not a huge problem |
12:18:29 | Demos[m] | you can probably have many thousands of instantiations before it becomes noticible compile time wise |
12:18:33 | Demos[m] | and runtime shrug |
12:18:34 | Tiberium | well I think with millions of calls there would be a small performance difference :) |
12:18:36 | * | pwntus_ is now known as pwntus |
12:18:45 | Demos[m] | but it's not millions of calls |
12:18:54 | * | pwntus quit (Changing host) |
12:18:54 | * | pwntus joined #nim |
12:18:57 | Demos[m] | the worst it could be is I$ thrashing |
12:19:28 | Demos[m] | (also for most operators you need different code (assembly) for different types |
12:19:37 | Demos[m] | and the cost of using dynamic methods to do that is more |
12:19:43 | Demos[m] | since then everything must be the same size |
12:19:54 | Demos[m] | which implies heap allocations and whatnot |
12:23:32 | Tiberium | lol wat |
12:23:33 | Tiberium | "template" 71.68ns 13.95M |
12:23:33 | Tiberium | "proc" 71.17ns 14.05M |
12:23:45 | Tiberium | 13.95 and 14.05 is iters/s |
12:23:50 | Demos[m] | yeah |
12:23:51 | Demos[m] | same speed |
12:23:55 | Tiberium | why proc is faster? |
12:23:58 | Tiberium | a little bit |
12:24:02 | Demos[m] | is million iters per second |
12:24:04 | Demos[m] | ? |
12:24:09 | Demos[m] | umm just slightly different codegen |
12:24:12 | Tiberium | yes |
12:24:17 | Tiberium | ah |
12:24:21 | Demos[m] | maybe one of the instantiations allowed something to be optimized out |
12:24:24 | Tiberium | well |
12:24:32 | Tiberium | well |
12:24:34 | Tiberium | if I run it again |
12:24:38 | Tiberium | it shows that template is faster :) |
12:24:38 | Demos[m] | you really need to looks at the code in vtune at those numbers |
12:24:47 | Demos[m] | is the first one per-run |
12:25:04 | Demos[m] | you need to run more interations |
12:25:11 | Demos[m] | but it sounds like almost the same code |
12:26:19 | Tiberium | well I've used nimbench from nimble |
12:26:23 | Tiberium | it's very easy to use |
12:27:02 | Demos[m] | you need more runs of the code |
12:27:18 | Demos[m] | also you need to look at the code in a good profiler |
12:27:33 | Demos[m] | but generics don't have any runtime cost |
12:33:57 | * | mahmudov quit (Ping timeout: 260 seconds) |
12:37:29 | * | kalexm quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
12:40:35 | * | Vladar quit (Ping timeout: 240 seconds) |
12:48:04 | * | Vladar joined #nim |
12:48:14 | Tiberium | Demos[m], unlike in some other languages :) |
12:48:27 | Demos[m] | like what? |
12:48:52 | Araq | Java |
12:49:52 | * | endragor quit (Remote host closed the connection) |
12:52:42 | * | crem joined #nim |
12:53:01 | * | endragor joined #nim |
12:57:14 | * | endragor quit (Ping timeout: 246 seconds) |
13:07:02 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
13:12:58 | Tiberium | Araq, I see on SO: "No, it won't affect performance since it's not even there at runtime." |
13:13:02 | Tiberium | about generics for java |
13:13:27 | Tiberium | https://stackoverflow.com/questions/6224368/does-using-generics-in-java-affect-performance |
13:14:01 | Araq | I don't feel like answering that one |
13:14:40 | Tiberium | well maybe they're wrong :) |
13:15:00 | * | couven92 quit (Read error: Connection reset by peer) |
13:15:56 | * | endragor joined #nim |
13:16:21 | Demos[m] | I think it's "compared to what" |
13:18:36 | * | Arrrr quit (Quit: Leaving.) |
13:18:43 | * | dom96|w joined #nim |
13:19:07 | FromGitter | <krux02> I added a comment with "compared to what?" |
13:20:37 | * | endragor quit (Ping timeout: 260 seconds) |
13:20:55 | Tiberium | well it's a bit old answer :) |
13:21:07 | Tiberium | ah |
13:21:08 | Tiberium | Yes, it does affect performance because the compiler creates type-casts. |
13:26:34 | FromGitter | <brentp> > **<Araq>** @brentp: use a distinct type? |
13:26:44 | FromGitter | <brentp> can you clarify? (I'm new to Nim). |
13:26:56 | Araq | type Foo = distinct uint32 |
13:27:18 | Tiberium | but you'll also need to borrow some procedures for uint32 if you need them (like + proc) |
13:28:19 | * | BitPuffin|osx quit (Ping timeout: 276 seconds) |
13:36:10 | FromGitter | <brentp> got it. thank you. |
13:37:13 | FromGitter | <ephja> I assume I have to resort to the compiler API in order to do things like ensure that one module references all exported symbols of another module |
13:40:30 | Araq | not really, you can parseStmt(staticRead("mymodule.nim")) to get the exported symbols and to perform some checking |
13:41:06 | FromGitter | <ephja> neat |
13:46:32 | FromGitter | <ephja> but then you need to wrap the contents of the module that performs this check in a macro, right? It's not that bad but there are ways to make it more elegant |
13:46:54 | * | rauss joined #nim |
13:49:25 | FromGitter | <ephja> maybe similar to how you can push pragmas |
13:55:14 | * | ibutra quit (Read error: Connection reset by peer) |
14:06:02 | * | BitPuffin|osx joined #nim |
14:10:34 | * | gangstacat joined #nim |
14:25:57 | * | arnetheduck quit (Ping timeout: 260 seconds) |
14:37:47 | * | sz0 joined #nim |
14:46:27 | * | v17d quit (Ping timeout: 240 seconds) |
14:52:19 | FromGitter | <Stromberg90> I'm trying to do some simple ffi with c++, here is my code https://pastebin.com/gjLCrMQG ⏎ I compile using: nim cpp -r cpp_ffi.nim ⏎ ⏎ this is the errors I get: https://pastebin.com/VR5BynXT ⏎ ... [https://gitter.im/nim-lang/Nim?at=59930aa3162adb6d2efa01ac] |
14:58:16 | Araq | "importcpp" is really more like "import method" and you import ordinary functions |
14:58:24 | Araq | so you should use importc here |
14:58:56 | Tiberium | his code then says "b.cpp:(.text+0xdc): undefined reference to `greet'" |
15:00:11 | * | v17d joined #nim |
15:01:25 | FromGitter | <Stromberg90> yeah, then I get undefined reference to greet and print_something |
15:02:25 | Tiberium | probably C++ compiler optimized them away? |
15:03:05 | FromGitter | <Stromberg90> importcpp seemed natural to me, since it's a cpp file, but If I knew more about it, it would probably make sense. |
15:03:17 | Tiberium | well importcpp is used in JS backend too |
15:03:35 | gangstacat | hey, would it be considered a bug if you name a file true.nim and that you use the boolean true in your program, then Nim says "Error: Error: ambiguous identifier: 'true' --use unknown.true or bool.true", you use bool.true but Nim still gives this message, you must obviously use system.true in this case (or rename the file obviously) |
15:03:52 | Tiberium | well it's already submitted on github issues |
15:04:37 | gangstacat | good then |
15:04:49 | Tiberium | well it's just about error message |
15:04:55 | Tiberium | which can be more helpful :) |
15:05:59 | FromGitter | <Stromberg90> I tried renaming the functions to greet2, gives me the same errors. |
15:07:12 | Tiberium | well probably C++ compiler optimized these functions away |
15:07:50 | * | vivus joined #nim |
15:10:38 | * | haha_ quit (Quit: haha_) |
15:11:14 | * | haha_ joined #nim |
15:12:01 | * | ShalokShalom joined #nim |
15:16:27 | * | haha_ quit (Quit: haha_) |
15:17:21 | * | PMunch joined #nim |
15:19:47 | * | haha_ joined #nim |
15:21:39 | FromGitter | <Stromberg90> How would I stop it from doing that? |
15:23:40 | Tiberium | well I may be wrong |
15:23:47 | Tiberium | I don't know C++ or C :) |
15:23:56 | * | haha_ quit (Ping timeout: 240 seconds) |
15:24:12 | * | Arrrr joined #nim |
15:25:57 | FromGitter | <Stromberg90> as far as I can tell it doesn't compile with optimizations on |
15:28:21 | Tiberium | yes this means C compiler optimizes it away |
15:29:21 | FromGitter | <Stromberg90> are you sure? |
15:29:37 | Tiberium | I'm not as I said |
15:30:01 | FromGitter | <Stromberg90> right |
15:31:20 | FromGitter | <Stromberg90> I followed what's here https://hookrace.net/blog/what-is-special-about-nim/ ⏎ under the "Bind to your favorite C functions and libraries" section. |
15:32:27 | * | Trustable joined #nim |
15:35:54 | Tiberium | hmm it works for me with C |
15:36:05 | Tiberium | I don't know that is bad with your C++ version |
15:37:00 | FromGitter | <Stromberg90> yeah, me neither :/ |
15:38:38 | Arrrr | For some reason, calling alloc afer i dealloc gives me a SIGSEV, what would be the reason for this? |
15:40:52 | FromGitter | <ephja> Araq: roughly how would you implement a feature that retrieves the value that a compile time variable holds at the very end of the compile time context? |
15:41:49 | FromGitter | <ephja> do we need the current (lexicographically dependent) behavior? |
15:43:27 | FromGitter | <ephja> yo, dom96|w: https://github.com/nim-lang/opengl/issues/46 :p |
15:44:51 | FromGitter | <ephja> can only the repo owner change the description? |
15:45:15 | Tiberium | you mean GitHub description? |
15:45:20 | Tiberium | or README? |
15:46:36 | FromGitter | <ephja> the former |
15:47:13 | Tiberium | IDK, probably only the owner |
15:47:44 | FromGitter | <ephja> yeah |
15:49:07 | dom96|w | suggest a description then |
15:53:46 | FromGitter | <ephja> 樂 |
15:58:03 | FromGitter | <ephja> dom96|w: "An OpenGL interface for Nim" might do |
16:12:06 | FromGitter | <ephja> Having memory issues? Try the Rasmus Lerdorf solution: ⏎ ⏎ ```While ($true) ⏎ { ⏎ taskkill /F /IM nimsuggest.exe /T ⏎ Start-Sleep -s 600 ⏎ }``` ⏎ ⏎ ;) [https://gitter.im/nim-lang/Nim?at=59931d55ee5c9a4c5fc28340] |
16:15:48 | FromGitter | <TiberiumN> lol |
16:15:59 | FromGitter | <TiberiumN> well nimsuggest can use quite a lot of memory, this is true |
16:18:16 | * | BitPuffin|osx quit (Ping timeout: 240 seconds) |
16:25:13 | * | dankrad joined #nim |
16:35:19 | FromGitter | <ephja> IIRC it also triggers a GC bug |
16:36:33 | Jipok[m] | can someone test duckduckgo? |
16:36:36 | Jipok[m] | https://duckduckgo.com/?q=sdl |
16:36:53 | Tiberium | what do you mean? |
16:37:02 | Tiberium | it works for me |
16:37:05 | Jipok[m] | It seems it does not work. I tried to go with a proxy and it's empty |
16:37:20 | Tiberium | well it works for me |
16:37:23 | Tiberium | without any issues |
16:37:31 | Jipok[m] | https://i.imgur.com/xYEVLma.png |
16:37:35 | Jipok[m] | hmm |
16:38:51 | * | Trustable quit (Remote host closed the connection) |
16:39:33 | Jipok[m] | https://twitter.com/duckduckgo/status/897497301106663425 |
16:39:38 | Jipok[m] | thx |
16:48:51 | * | yglukhov quit (Remote host closed the connection) |
16:50:32 | * | yglukhov joined #nim |
16:55:04 | * | gangstacat quit (Quit: Leaving) |
16:55:05 | * | rauss quit (Quit: WeeChat 1.9) |
16:55:40 | * | yglukhov quit (Ping timeout: 276 seconds) |
16:56:09 | * | rauss joined #nim |
16:57:08 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:15:21 | * | haha_ joined #nim |
17:20:17 | Demos[m] | Should we consider adding more reasonably names ffi pragmas? |
17:20:43 | Demos[m] | Also does there exist some module implementing the old style using statement |
17:29:37 | * | itseris quit (Quit: Konversation terminated!) |
17:31:13 | * | nsf quit (Quit: WeeChat 1.9) |
17:35:17 | * | yglukhov joined #nim |
17:35:33 | * | yglukhov quit (Remote host closed the connection) |
17:35:47 | * | yglukhov joined #nim |
17:58:03 | * | itseris joined #nim |
18:02:38 | * | kier joined #nim |
18:04:32 | dom96 | hello, sup guys? |
18:07:56 | Demos[m] | sup |
18:09:51 | * | v17d quit (Remote host closed the connection) |
18:18:30 | * | scriptum joined #nim |
18:24:14 | * | haha_ quit (Quit: haha_) |
18:24:54 | * | haha_ joined #nim |
18:27:49 | * | ShalokShalom quit (Quit: No Ping reply in 180 seconds.) |
18:29:27 | * | ShalokShalom joined #nim |
18:31:57 | FromGitter | <ephja> Araq: some of the symbols are generated by a macro though |
18:32:25 | FromGitter | <ephja> but it doesn't matter in this particular case |
18:34:39 | FromGitter | <ephja> since it's a list of procs in a template that have nodes added to them, so they can still be identified before the expansion |
18:41:01 | * | Arrrr quit (Read error: Connection reset by peer) |
18:49:05 | * | dankrad quit (Ping timeout: 248 seconds) |
18:49:25 | * | haha_ quit (Quit: haha_) |
18:50:46 | * | dankrad joined #nim |
19:03:12 | * | rauss quit (*.net *.split) |
19:03:13 | * | mal`` quit (*.net *.split) |
19:03:14 | * | solitude quit (*.net *.split) |
19:03:33 | * | solitude joined #nim |
19:03:33 | * | rauss joined #nim |
19:04:42 | * | mal`` joined #nim |
19:17:44 | * | Jesin joined #nim |
19:20:21 | * | haha_ joined #nim |
19:25:53 | * | haha_ quit (Quit: haha_) |
19:26:23 | Araq | Demos[m]: there is an issue open for that, yes definitely |
19:31:31 | * | haha_ joined #nim |
19:47:03 | dom96 | Elronnd: All files in a package must be namespaced appropriately. |
19:47:15 | dom96 | mv logging.nim pkgName/logging.nim |
19:49:18 | Elronnd | dom96: but it's in src already |
19:49:27 | Elronnd | why should I put it in another dir? |
19:49:40 | * | Vladar quit (Quit: Leaving) |
19:50:51 | * | endragor joined #nim |
19:55:14 | dom96 | Elronnd: Because if you don't people will be able to write `import logging` |
19:55:19 | dom96 | and that will clash with a stdlib module |
19:55:32 | * | endragor quit (Ping timeout: 260 seconds) |
19:55:39 | dom96 | and if we let every package do this then modules will start clashing |
19:56:09 | Elronnd | but it's not a library |
19:56:23 | Elronnd | no one *else* will write 'import logging' |
19:56:26 | dom96 | okay, so then add 'skipExt = @["nim"]' |
19:56:29 | dom96 | to your .nimble file |
19:56:39 | Elronnd | what's that do? |
19:56:47 | dom96 | it tells Nimble not to install any .nim files |
19:57:25 | Elronnd | ah |
19:59:08 | dom96 | I may make this implicit for packages with a 'bin' at some point in the future. |
19:59:30 | * | nsf joined #nim |
20:03:26 | ShalokShalom | can i code in a functional style? |
20:09:07 | Tiberium | yes |
20:09:18 | Tiberium | look at some sequtils procedures for example :) |
20:10:25 | Tiberium | *templates |
20:13:41 | * | mahmudov joined #nim |
20:13:42 | Tiberium | hmm |
20:14:10 | Tiberium | dom96, is this supposed to work? var a = @[1, 2, 3]; a.applyIt(it * 2).keepItIf(it > 2) |
20:14:28 | Tiberium | ah no |
20:14:37 | dom96 | no idea |
20:14:56 | Tiberium | i did it wrong |
20:15:21 | Tiberium | echo @[1, 2, 3].mapIt(it * 2).filterIt(it > 2) |
20:15:22 | Tiberium | :) |
20:16:31 | Tiberium | Is this a "functional" style? |
20:17:31 | dom96 | Sorta |
20:17:43 | dom96 | It's a special Nim functional style |
20:20:06 | FromGitter | <Smaehtin> @Tiberium Keep in mind that these operations make a new `seq` every time = they're not lazy, but eager |
20:20:13 | Tiberium | yes, I know |
20:20:18 | FromGitter | <Smaehtin> |
20:23:33 | * | haha_ quit (Quit: haha_) |
20:25:55 | Tiberium | neat, you actually can "emulate" python dict comprehensions with nim list comprehensions (you can do that in python too) |
20:26:14 | Tiberium | echo lc[(x, x^2) | (x <- 1..10), tuple[x, y: int]].newTable() |
20:26:23 | Tiberium | import future, tables |
20:26:28 | Tiberium | import math |
20:28:50 | dom96 | oh, interesting |
20:29:25 | Tiberium | well you can do that in Python too |
20:29:42 | Tiberium | lol |
20:29:43 | Tiberium | echo lc[($x.toUpper, x.repeat(3)) | (x <- "abcd"), tuple[x, y: string]].newTable() |
20:30:04 | Tiberium | is equivalent for {x.upper(): x*3 for x in 'abcd'} |
20:31:21 | dom96 | cool, would be nice if we could get something closer to Python's syntax :) |
20:31:24 | Tiberium | yeah |
20:31:35 | Tiberium | but macros are magical |
20:31:38 | Tiberium | in a good way |
20:37:03 | dom96 | Sucks that this doesn't work: https://gist.github.com/dom96/58cdcd81527cfb5eddc691598db18114 |
20:37:55 | Tiberium | lc[x in "abcd": ($x.toUpper, x.repeat(3)), tuple[x, y: string]] :D |
20:38:38 | Tiberium | wait, isn't there a way to avoid typing with list comprehension in future module? |
20:38:51 | Tiberium | I think it should be possible |
20:38:54 | Tiberium | hmm |
20:47:03 | FromGitter | <brentp> hi all. I got help from some of you over the last few days to write my first nim lib. it is here: https://github.com/brentp/hts-nim/ any suggestions welcome. |
20:47:33 | Tiberium | require? |
20:47:39 | Tiberium | maybe "import" ? :) |
20:47:44 | Tiberium | require hts |
20:48:05 | Tiberium | oh, about distinct types |
20:48:11 | Tiberium | you should've used borrow pragma |
20:48:14 | Tiberium | ah wait |
20:48:51 | FromGitter | <brentp> oops. thanks. changing to import in the README |
20:49:13 | Tiberium | well nim **can** look like JS, but very rarely :) |
20:49:20 | Tiberium | those "var"s, yeah |
20:49:35 | FromGitter | <brentp> I have no excuse. I don't even use js. |
20:49:50 | * | Tiberium quit (Remote host closed the connection) |
20:53:15 | dom96 | proc calls shouldn't begin with a capital letter |
20:54:07 | dom96 | (you're using `Open` in the readme) |
20:54:19 | * | Tiberium joined #nim |
20:54:59 | dom96 | And in general I would try to be consistent with your case/style (use camelCase for everything instead of a mix of camelCase and snake_case) |
20:56:09 | * | mahmudov quit (Remote host closed the connection) |
20:57:36 | FromGitter | <brentp> ok. will change, I can blame golang for that one. |
20:57:55 | FromGitter | <brentp> with distinct types, there's no way to get around this: https://github.com/brentp/hts-nim/blob/master/hts/flag.nim#L7 |
20:57:57 | FromGitter | <brentp> ? |
21:00:26 | Tiberium | why do you need a distinct type? |
21:02:39 | * | rauss quit (Quit: WeeChat 1.9) |
21:03:03 | FromGitter | <brentp> I wanted the `$` proc |
21:03:59 | FromGitter | <brentp> in that case, I don't really, but e.g. for this one: https://github.com/brentp/hts-nim/blob/master/hts/cigar.nim#L36 |
21:04:07 | FromGitter | <brentp> the `$` proc. |
21:04:45 | FromGitter | <brentp> but yeah, I'll remove the distinct from Flag. thanks! |
21:06:14 | FromGitter | <GULPF> you can use the `{. borrow .}` pragma to avoid reimplementing a ton of procs |
21:06:17 | FromGitter | <GULPF> https://nim-lang.org/docs/manual.html#distinct-type-modelling-currencies |
21:11:27 | * | Jesin quit (Ping timeout: 240 seconds) |
21:11:46 | * | Jesin joined #nim |
21:11:48 | FromGitter | <brentp> sweet. thanks. collecting these here: https://github.com/brentp/hts-nim/issues/1 |
21:16:50 | dom96 | Otherwise though, seems like a well written library :) |
21:22:33 | FromGitter | <brentp> :-) |
21:37:05 | * | solitude quit (Ping timeout: 248 seconds) |
21:39:02 | * | Sembei joined #nim |
21:39:25 | Araq | dom96: any ideas of how to do list comprehensions? |
21:39:58 | dom96 | Araq: what do you mean? |
21:40:10 | Calinou | are the MinGW compilers included in MSYS2 "compatible" with native MinGW-w64 compilers? as in, can I use them to compile Nim code for Windows? |
21:40:20 | Calinou | (I have these installed, I'd rather not duplicate things around if possible) |
21:40:30 | * | Guest3423 quit (Ping timeout: 240 seconds) |
21:40:33 | Calinou | I managed to compile Nim from source on Windows, using the bundled mingw32 that came with choosenim |
21:40:36 | Calinou | but that's 32-bit :P |
21:41:10 | dom96 | Calinou: try it and see if it works :) |
21:42:53 | Araq | dom96: the 'lc' macro is cool but also strange |
21:43:37 | dom96 | Araq: oh cool, so you agree that it should be improved to fit the language better :) |
21:43:48 | Araq | yeah |
21:44:14 | Calinou | dom96: 32-bit GCC 7.1 provided by MSYS2 works, but not 64-bit: https://hastebin.com/pibixowuci.txt |
21:44:26 | dom96 | well, as I've written: lc[for x in [1,2,3]: x * 2] would be nicer already |
21:44:40 | Calinou | this might be because I'm just re-running "bin\nim c koch" and not cleaning files |
21:44:47 | dom96 | But I don't even use list comprehensions in Python enough to remember exactly how they work |
21:45:02 | Araq | well last time I thought about it the problem is the stmt/expr split. 'for' is a statement or leads type 'void' (depending on how you look at it) |
21:45:03 | dom96 | Allowing the 'for' as an expression in Nim might be enough |
21:45:18 | Araq | if we make 'for' an expression ... lol |
21:45:33 | dom96 | what would happen? :P |
21:46:09 | dom96 | Calinou: you need to rebuild from C sources AFAIK |
21:46:20 | dom96 | possibly rebuild koch too |
21:46:24 | Araq | build64.bat, Calinou |
21:46:46 | Araq | koch supports the --cpu flag too, no need to rebuild koch |
21:47:02 | Calinou | ah yes, for building the C sources, there's a different script |
21:47:06 | Calinou | just noticed, because it told me :P |
21:47:28 | Calinou | Araq: now… if I want to distribute an application both as 32-bit and 64-bit, do I need only the 64-bit Nim compiler? or do I also need a 32-bit one? |
21:47:35 | Calinou | (since, ultimately, GCC will compile the generated C code) |
21:48:26 | Araq | any version of nim supports --cpu |
21:48:35 | Araq | and that's all you need really |
21:49:06 | Araq | 32bit nim can build 32 or 64 bit apps, 64bit nim can build 32 or 64 bit apps |
21:49:31 | Calinou | yeah, I figured |
21:53:22 | Araq | takesSeq(for x in bar: if cond: f(x)) |
21:54:01 | Calinou | random question: is it safe to leave MinGW permanently in your PATH? |
21:54:07 | Calinou | (won't it override built-in Windows utilities?) |
21:54:28 | Araq | it's safe, Windows doesn't care |
21:55:01 | Calinou | also, the Nimble I just built errors with "could not load: libeay64.dll" :/ |
21:55:34 | Araq | https://nim-lang.org/install_windows.html |
21:56:02 | Araq | the installers come with the required DLLs |
21:57:16 | * | Tiberium quit (Ping timeout: 276 seconds) |
21:57:26 | Araq | takesSeq((var tmp: seq[T] = @[]; for x in bar: if cond: tmp.add(f(x)); tmp)) |
21:57:43 | Araq | seems to be a pretty simple transformation |
21:58:35 | dom96 | Araq: yep, so why the 'lol'? |
21:58:55 | Calinou | thanks, Nimble works once the appropriate libraries are copy-pasted :P |
22:00:26 | * | cspar quit (Ping timeout: 246 seconds) |
22:00:45 | * | rauss joined #nim |
22:06:04 | Calinou | things seem to work alright, including building an hello world :P |
22:06:12 | Calinou | thanks… this was pretty easy |
22:09:34 | * | PMunch quit (Quit: leaving) |
22:19:26 | Araq | dom96: lol because we thought the same |
22:19:30 | * | acidx quit (Ping timeout: 240 seconds) |
22:20:34 | * | acidx joined #nim |
22:21:05 | * | gokr quit (Ping timeout: 240 seconds) |
22:21:22 | dom96 | i see :) |
22:34:32 | * | ehmry uploaded an image: file1502836466786.jpg (46KB) <https://matrix.org/_matrix/media/v1/download/matrix.org/jOZDAryJHHPqvLoukSxnwTax> |
22:35:10 | ehmry | dom96: just got my book |
22:35:40 | dom96 | :D |
22:35:51 | dom96 | Hope you enjoy it :) |
22:53:33 | * | Tiberium joined #nim |
22:56:34 | * | clarity510 joined #nim |
22:57:20 | * | clarity510 left #nim (#nim) |
23:05:11 | * | vivus quit (Quit: Leaving) |
23:40:45 | * | Jesin quit (Quit: Leaving) |
23:48:36 | * | zahary_ quit (Quit: Connection closed for inactivity) |
23:55:54 | * | nsf quit (Quit: WeeChat 1.9) |
23:56:29 | * | ludocode quit (Ping timeout: 240 seconds) |