00:00:32 | dom96 | once suggest works i'll finally release a new version |
00:00:49 | dom96 | so that you don't need to explicitly install head all the time |
00:04:50 | Jehan_ | Nimble/Nim QoL issue: The Hint: added path spam does get annoying once you've got a number of nimble packages installed. I'm not sure if I've got a good solution for it (I don't want to turn off the hint entirely, either). |
00:06:08 | Jehan_ | Also not crazy about how the top level module namespace starts to get polluted. |
00:08:07 | reactormonk | Jehan_, got an idea how to fix that part? |
00:09:03 | Jehan_ | reactormonk: What I'd really like is to specify not only a module but a library for the import. And default to local modules > stdlib, too. |
00:09:11 | * | fizzbooze quit (Ping timeout: 246 seconds) |
00:10:43 | Jehan_ | E.g. import numerics:num |
00:11:02 | Jehan_ | Would still allow me to use a local "num" module. |
00:11:28 | Jehan_ | Without them fighting over which is which. |
00:12:03 | Jehan_ | I'd also like to, say, have a local "net" module without that conflicting with stdlib:net |
00:13:09 | Jehan_ | Right now I'm working around that by putting modules into a directory of their own (which works until the stdlib or a nimble package gets a directory that's named identically). |
00:14:43 | Jehan_ | Module lookup in general is my single serious issue that I'm still having with Nim. |
00:16:47 | mpthrapp | Alright, one more silly question. :P What's the best practice for folder structure within my workspace? Eg, /NimWorkspace/hello_world/src? Or right in /NimWorkspace/hello_world |
00:17:55 | dom96 | Jehan_: Perhaps we need to enforce that modules in a nimble package must be put in a directory which name corresponds to the package's. |
00:18:04 | dom96 | *whose |
00:18:41 | Jehan_ | dom96: Still doesn't really fix the bigger issue. |
00:19:14 | * | BitPuffin joined #nim |
00:19:34 | dom96 | Jehan_: It doesn't? |
00:19:51 | dom96 | You will import the package's modules via import packageName/module |
00:20:15 | Jehan_ | dom96: It avoids it (sort of) for Nimble packages, but not for, say, the stdlib. |
00:20:32 | Jehan_ | Or anything that's not installed via Nimble. |
00:20:38 | dom96 | Although conflicts could arise if you have a directory in your source code which matches a package's name. |
00:21:43 | dom96 | I think you have a point. |
00:21:56 | Jehan_ | For example, let's say I have a module foo.nim right now; at one point, the stdlib is reorganized so that a foo.nim submodule is created, at which point either my code or the stdlib breaks. |
00:22:00 | dom96 | A simple introduction of a module into the stdlib could cause code breakage. |
00:22:06 | Jehan_ | Yeah. |
00:23:53 | flaviu | place the stdlib in a "stdlib" directory? |
00:23:54 | Jehan_ | For starters, I think that local modules should get priority. I.e. an "import net" in my own program should prioritize my module over that of the stdlib, an "import net" in the stdlib should prioritize the stdlib's net module. |
00:23:59 | flaviu | stdlib.foo |
00:24:05 | dom96 | Do you have any ideas how we can fix this without breaking everybody's code? |
00:24:48 | Jehan_ | dom96: As I said, I'd use smart priorities and allow users to specify where to get a module from via import syntax. |
00:25:24 | Jehan_ | If you have a local module called foo in your program or nimble module, you will practically never want one from elsewhere. |
00:25:32 | Araq | the compiler already does that to some extend |
00:25:51 | dom96 | Jehan_: So you suggest we introduce new syntax to make the lookup explicit? |
00:25:53 | Jehan_ | And if you do, having an import syntax to specify that resolves the problem. |
00:26:17 | OderWat_ | @Araq I know have a docs related error with stacktrace from nim without -d:release .. https://gist.github.com/oderwat/9d9f1ff286036a4f03b8 |
00:26:26 | dom96 | I like the idea, but does Araq? |
00:26:32 | Jehan_ | dom96: I'm not fixated on one approach. I'm happy with anything that works. |
00:27:00 | Araq | dom96: the compiler already does work this way in my dream |
00:27:00 | Jehan_ | But a syntax like "import library:module" would be one way to do it (combined with smart prioritization). |
00:28:20 | dom96 | Araq: So you want this syntax in the language? |
00:28:24 | dom96 | Araq: Can I implement it? |
00:28:49 | Araq | dom96: no, we have lots of logic that deals with the search path order |
00:29:03 | Araq | maybe it doesn't work yet |
00:29:18 | Jehan_ | Well, there'd still be the problem of how you'd map the library name to a path. |
00:29:33 | dom96 | we can use nimble files |
00:29:44 | Jehan_ | True. |
00:29:45 | Araq | we already look at nimble files |
00:29:45 | dom96 | they are already used for .c file prefixes. |
00:30:17 | * | l04m33 joined #nim |
00:30:26 | Araq | OderWat_: how does this command differ from the command that works? |
00:32:04 | * | a5i joined #nim |
00:33:13 | * | l04m33_ quit (Ping timeout: 252 seconds) |
00:33:24 | Jehan_ | Hmm, I keep getting double posts on the forum. |
00:33:51 | Jehan_ | No big deal since I can delete them, but odd. |
00:34:07 | Jehan_ | Is it something I'm doing wrong or are other people having the problem, too? |
00:34:22 | Araq | I never ever had this problem |
00:34:54 | Jehan_ | I've only had it starting today. |
00:34:59 | OderWat_ | hum... thats hard to see. the first (which works) was created just with koch boot without the -d:release from a compiler which made with an -d:release one. the second nim is compiled without -d:release but with the compiler which has no -d:release :) ... I am not totally sure what happens here :) |
00:35:15 | a5i | Whats with this heat between u peeps and Rust |
00:36:12 | Jehan_ | a5i: Just some people who are a bit excitable, I think. |
00:36:33 | flaviu | a5i: Some people are more vocal than others, but I think it's clear that they aren't really representative of the entire community. http://forum.nim-lang.org/t/970 |
00:37:28 | flaviu | I personally feel that rust is great, and that nim is great too! |
00:37:45 | a5i | Same ! ^ |
00:37:57 | a5i | Yeah runvnc is a Dick |
00:38:03 | Jehan_ | Not sure about others, but I generally think that competition is good and monocultures are a problem. Different languages allow for different ideas to develop, and the good ones tend to find broad adoption later. |
00:38:10 | a5i | His name is Jason Livesay in Quora |
00:38:42 | a5i | I kinda think Rust and nim isnt really an apples to apples thing is most cases |
00:39:07 | flaviu | Let's not bash people, even if you feel they deserve it. |
00:39:33 | a5i | Sorry but that guy makes me cringe |
00:39:44 | Jehan_ | a5i: Yeah, they really target different niches (despite some overlap). |
00:40:18 | a5i | I hope to learn Nim after I learn some foundation languages |
00:40:34 | * | epichero joined #nim |
00:40:49 | OderWat_ | @Araq I still have both versions of the compiler.. one which does not work and one which works. both show the same switches (both without -d:release) |
00:41:18 | a5i | well and after Rust 1.0, I know bit too much of Rust to not learn it after foundation languages |
00:42:39 | * | epichero quit (Read error: Connection reset by peer) |
00:43:08 | * | epichero joined #nim |
00:46:36 | Araq | OderWat_: well in theory you could diff the C source code and see why one version is buggy |
00:48:03 | * | Jehan_ quit (Quit: Leaving) |
00:51:21 | OderWat_ | @Araq: Its funny. With the current compiler I can "nim c -d:release compiler/nim.nim" and then "compiler/nim doc2 lib/system.nim" works |
00:52:56 | OderWat_ | @Araq even ./koch boot -d:release now made a version of the compiler which works... |
00:54:04 | OderWat_ | @Araq I guess that something is not doing what I think it does. I try to bring you something reproduceable tomorrow. I am to tired right now. |
00:54:31 | Araq | sure no problem. same here. good night |
00:56:24 | randomwalk | I'm trying to compile my own fork of Nim (so I can do pull requests); and using my own install of MinGW I get an error from as.exe saying it can't find the __printf__ entry point.... :( |
00:56:46 | randomwalk | Is there something special about the gcc in dist? |
00:57:13 | * | elbow_jason quit (Ping timeout: 256 seconds) |
00:59:09 | * | epichero quit () |
00:59:25 | * | epichero joined #nim |
01:04:42 | randomwalk | :( I'll just learn how to build the repo later...ttyl |
01:04:42 | * | ruzu quit (Read error: Connection reset by peer) |
01:05:21 | * | ruzu joined #nim |
01:06:04 | * | kniteli quit (Ping timeout: 245 seconds) |
01:07:43 | * | flaviu quit (Read error: Connection reset by peer) |
01:07:55 | * | flaviu joined #nim |
01:13:53 | * | leonlee joined #nim |
01:18:10 | def- | randomwalk: nothing special about the mingw with the distro afaik |
01:19:25 | * | johnsoft quit (Ping timeout: 250 seconds) |
01:20:14 | * | johnsoft joined #nim |
01:21:04 | randomwalk | I will try again. |
01:21:13 | def- | i haven't seen that error before |
01:21:23 | def- | usually people have problem with 32/64 bit |
01:21:27 | randomwalk | I'll just use the mingw from the binary download. |
01:25:19 | * | reem quit (Remote host closed the connection) |
01:25:30 | randomwalk | btw start.bat should be named differently since START is a command in windows |
01:27:39 | mpthrapp | What module should I look at to be making POST calls to an API? |
01:29:12 | mpthrapp | Nevermind, figured it out. |
01:29:23 | randomwalk | mpthrapp: I use libcurl for GET calls...I haven't tried POSTs yet |
01:29:46 | mpthrapp | randomwalk: I'm checking out httpclient at the moment. |
01:32:06 | randomwalk | yay, build64.bat works... I just threw away my mingw install and put dist/mingw in my path |
01:46:43 | * | reem joined #nim |
01:50:01 | * | reem quit (Remote host closed the connection) |
01:52:47 | * | reem joined #nim |
01:54:10 | * | mpthrapp quit (Quit: Konversation terminated!) |
01:55:32 | * | kniteli_ joined #nim |
02:01:07 | * | darkf joined #nim |
02:18:30 | * | reem quit (Remote host closed the connection) |
02:26:11 | * | saml_ joined #nim |
02:27:08 | * | reem joined #nim |
02:32:45 | * | kniteli_ quit (Ping timeout: 252 seconds) |
02:33:10 | * | kniteli_ joined #nim |
02:40:57 | * | reem quit (Remote host closed the connection) |
02:43:11 | * | johnsoft quit (Ping timeout: 246 seconds) |
02:43:31 | * | johnsoft joined #nim |
02:49:07 | * | reem joined #nim |
02:51:24 | * | reem quit (Remote host closed the connection) |
02:53:05 | * | BitPuffin quit (Ping timeout: 244 seconds) |
02:53:16 | * | reem joined #nim |
02:54:34 | * | chemist69_ joined #nim |
02:56:51 | * | reem quit (Remote host closed the connection) |
02:57:22 | * | chemist69 quit (Ping timeout: 245 seconds) |
03:06:52 | * | reem joined #nim |
03:08:56 | * | brson quit (Quit: leaving) |
03:17:51 | * | reem quit (Remote host closed the connection) |
03:18:57 | * | a5i quit (Quit: Connection closed for inactivity) |
03:21:45 | * | reem joined #nim |
03:24:54 | * | reem quit (Remote host closed the connection) |
03:26:08 | * | reem joined #nim |
03:28:25 | * | reem quit (Remote host closed the connection) |
03:33:49 | * | Teef joined #nim |
03:34:40 | * | silven quit (Read error: Connection reset by peer) |
03:35:07 | * | reem joined #nim |
03:35:25 | * | silven joined #nim |
03:36:42 | * | reem quit (Remote host closed the connection) |
03:40:16 | * | reem joined #nim |
03:42:45 | * | Demos quit (Read error: Connection reset by peer) |
03:43:32 | * | reem quit (Remote host closed the connection) |
03:57:40 | * | reem joined #nim |
04:04:10 | * | reem quit (Remote host closed the connection) |
04:09:46 | l04m33 | Anyone here? A question regarding the asyncfile module: http://forum.nim-lang.org/t/984 |
04:19:50 | * | l04m33 left #nim (#nim) |
04:19:53 | * | l04m33 joined #nim |
04:20:27 | * | fizzbooze joined #nim |
04:21:12 | * | reem joined #nim |
04:24:02 | * | reem quit (Remote host closed the connection) |
04:37:08 | * | reem joined #nim |
04:43:46 | * | reem quit (Remote host closed the connection) |
04:45:07 | * | ChrisMAN quit (Ping timeout: 252 seconds) |
05:00:53 | * | reem joined #nim |
05:03:02 | * | reem quit (Remote host closed the connection) |
05:08:55 | * | gmpreussner|lapt joined #nim |
05:08:57 | * | gmpreussner|lapt quit (Read error: Connection reset by peer) |
05:12:46 | * | banister joined #nim |
05:12:52 | * | banister quit (Max SendQ exceeded) |
05:19:06 | * | reem joined #nim |
05:25:33 | * | darkf_ joined #nim |
05:28:37 | * | darkf quit (Ping timeout: 264 seconds) |
05:28:42 | * | darkf_ is now known as darkf |
05:32:51 | * | randomwalk_ joined #nim |
05:33:28 | * | randomwalk_ quit (Client Quit) |
05:33:47 | * | randomwalk quit (Quit: Leaving) |
05:34:27 | * | reem quit (Remote host closed the connection) |
05:35:00 | * | reem joined #nim |
05:37:18 | * | reem quit (Remote host closed the connection) |
05:39:16 | * | reem joined #nim |
05:43:28 | reactormonk | http://pastie.org/10004181 |
05:44:22 | reactormonk | l04m33, wrong TZ, wait a few hours |
05:46:18 | * | zahary1 quit (Ping timeout: 246 seconds) |
05:47:29 | * | reem quit (Remote host closed the connection) |
06:01:41 | * | reem joined #nim |
06:02:03 | * | gsingh93 quit (Ping timeout: 246 seconds) |
06:05:46 | * | saml_ quit (Remote host closed the connection) |
06:06:45 | * | reem quit (Remote host closed the connection) |
06:08:15 | * | reem joined #nim |
06:13:25 | * | Teef quit (Ping timeout: 246 seconds) |
06:16:24 | * | reem quit (Remote host closed the connection) |
06:19:11 | * | reem joined #nim |
06:20:08 | * | reem quit (Remote host closed the connection) |
06:32:09 | * | kniteli_ quit (Ping timeout: 244 seconds) |
06:39:45 | * | Varriount|Mobile quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )) |
06:42:26 | * | gsingh93 joined #nim |
06:43:47 | * | gmpreussner|lapt joined #nim |
06:44:30 | * | fizzbooze quit (Quit: WeeChat 1.1.1) |
06:45:22 | * | kniteli_ joined #nim |
06:47:47 | * | gsingh93 quit (Ping timeout: 245 seconds) |
06:49:46 | * | reem joined #nim |
06:51:51 | * | reem quit (Remote host closed the connection) |
06:53:09 | * | reem joined #nim |
06:57:19 | * | reem quit (Remote host closed the connection) |
07:06:04 | * | reem joined #nim |
07:06:13 | * | gmpreussner|lapt quit (Quit: Leaving) |
07:08:16 | * | reem quit (Remote host closed the connection) |
07:08:51 | * | reem joined #nim |
07:20:02 | * | rkj-b joined #nim |
07:21:03 | * | reem quit (Remote host closed the connection) |
07:21:46 | * | rkj-b quit (Client Quit) |
07:23:13 | * | untitaker quit (Ping timeout: 264 seconds) |
07:26:44 | * | BlaXpirit joined #nim |
07:27:43 | * | bjz joined #nim |
07:30:13 | * | untitaker joined #nim |
07:32:26 | * | reem joined #nim |
07:36:24 | * | bjz quit (Ping timeout: 265 seconds) |
07:38:24 | * | reem quit (Remote host closed the connection) |
07:43:10 | * | reem joined #nim |
07:46:19 | * | reem quit (Remote host closed the connection) |
07:50:45 | * | reem joined #nim |
08:00:14 | * | bjz joined #nim |
08:06:09 | * | reem quit (Remote host closed the connection) |
08:13:17 | * | reem joined #nim |
08:15:54 | * | reem quit (Remote host closed the connection) |
08:17:17 | * | reem joined #nim |
08:19:20 | * | reem quit (Remote host closed the connection) |
08:23:40 | * | reem joined #nim |
08:34:40 | * | xificurC joined #nim |
08:39:01 | * | reem quit (Remote host closed the connection) |
08:43:28 | * | reem joined #nim |
08:46:37 | novist | i need to generate unique variable name at compile time (macro). is there any way to have some kind of global state during compile time? what i have in mind is using simple counter which is increased by one each time macro is called. |
08:46:55 | novist | also Araq thank you for that fix, now i can mess w/ macros again :) |
09:01:33 | novist | actually turns out adding counter to static: block works. /win |
09:05:14 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
09:06:18 | * | ruzu quit (Ping timeout: 265 seconds) |
09:07:34 | * | tumult joined #nim |
09:12:11 | * | zahary joined #nim |
09:20:13 | * | davidhq joined #nim |
09:25:25 | BlaXpirit | novist, there is a way to generate a unique name |
09:25:47 | novist | if you are speaking of oids module (if name is right) - cant use it at compile time |
09:26:26 | BlaXpirit | novist, http://nim-lang.org/macros.html#genSym,TNimrodSymKind,string |
09:27:18 | novist | oh thats cool, thanks! |
09:28:03 | BlaXpirit | i have never used this, not sure if it's even the right thing |
09:29:16 | novist | hmm yeah noticed its.. odd. it has ident as parameter. so if im giving it identifier name its as good as generating identifier myself |
09:29:25 | novist | well anyway having counter works so it will do |
09:31:32 | novist | anyway my latest macro version: http://forum.nim-lang.org/t/703/5#5926 |
09:35:47 | * | aidanh quit (Ping timeout: 265 seconds) |
09:36:39 | * | aidanh joined #nim |
09:44:58 | tumult | novist: I've been following this as you've developed it and I love this idea of uniformly generating calls to initialisation procs. I'm wondering though, why is there a second call to generate a Type2 here: var a = new_ref Type1(1, new_ref Type2(2)) |
09:47:24 | tumult | ah sorry I see, type1 has a less trivial 'constructor' that accepts type2! Clever stuff :) |
09:58:23 | * | reem quit (Remote host closed the connection) |
10:11:40 | novist | tumult: its just a test verifying that nesting calls works |
10:11:56 | novist | im glad at least one person finds it cool :D |
10:12:34 | novist | too bad Araq is anti-oop hehe. if there was standard way to do this it would be much better than optional macro hack |
10:18:04 | * | gokr quit (Ping timeout: 256 seconds) |
10:20:53 | * | leonlee quit (Quit: Leaving) |
10:24:25 | * | reem joined #nim |
10:25:40 | tumult | personally I like this idea as it encourages uniformity in the name of construction procs, but I can see it might split people who see it as adding hidden complexity and those who see it as reducing code complexity |
10:26:06 | tumult | has Araq said that he doesn't like the idea? |
10:27:15 | novist | he did not state that explicitly but i got a vibe of disapproval. you can read his posts here: http://forum.nim-lang.org/t/703/3 |
10:27:52 | novist | though without something like this im not sure how working with c++ stuff is going to happen. especially complex things like Qt or Urho3D |
10:29:24 | * | reem quit (Ping timeout: 256 seconds) |
10:29:24 | tumult | for me, on the one hand I am used to calling obj = MyObj.Create and knowing I can write my own Create to init, on the other hand I like nim's resistance to 'dogma' of OOP (I guess I'm thinking of the UCS and not having an implied super class in methods here) |
10:30:22 | tumult | I don't see why it can't be a module that you can include depending on your coding preference though |
10:30:45 | * | reem joined #nim |
10:31:21 | novist | with MyObj.Create i bet you have to allocate object yourself and return it? |
10:32:08 | novist | i wanted to avoid that kind of redundancy |
10:33:35 | novist | all in all that OOP macro seems to do pretty good job. with my macro calling constructor automatically its pretty much solved problem for me personally. but im still not sure how problem would be tackled for big lib wrappers |
10:34:03 | novist | now i saw urhonimo using constructObject() convention. which is odd. then there is var a = cnew getContext().something() |
10:34:10 | novist | which is even more strange |
10:34:21 | novist | easy to get lost in this maze |
10:34:45 | * | reem quit (Remote host closed the connection) |
10:40:33 | tumult | "i bet you have to allocate object yourself and return it" For Delphi, the Create call constructs the memory for you so you can just stuff your init code in there, as opposed to nim where you explicitly call new |
10:40:50 | tumult | however it's a different oop model in Delphi |
10:41:33 | tumult | there's a default create in object base classes that does the allocate when create is called |
10:48:18 | tumult | your macro does make me wonder something I've had trouble with in nim, though. Every bit of code that I've seen that populates a seq with objects uses ref objects, so it will do newobj = newMyObj() then myseq.add(newobj). This is fine but is it possible to do this with objects that are not refs? I've never seen it, and I wonder if your new_obj macro would allow this? |
10:49:07 | tumult | I am wondering if everyone uses refs in seq for a reason though and I just haven't understood why it's a bad idea to generate non-ref objects to stuff into seqs |
10:49:45 | tumult | (^ where newMyObj() would make a call to new(result) to create the ref) |
11:06:30 | novist | tumult: i did not try it myself but i think it would be possible, however adding stack object to seq if it worked it would make a copy of that object |
11:06:58 | novist | everyone uses refs because its efficient, object is allocated on heap and only reference (like pointer) is passed around |
11:07:26 | Araq | er ... did you look at my patch? |
11:07:38 | Araq | I used seq[tuple[a, b]] just fine |
11:09:47 | * | aidanh quit (Ping timeout: 256 seconds) |
11:15:16 | * | chemist69_ quit (Quit: WeeChat 1.1.1) |
11:15:26 | * | chemist69 joined #nim |
11:15:32 | tumult | novist: I keep forgetting that stack objects would copy. I do use refs anyway because they're easier to work with in the situations I use them. As a delphi developer I've often been bitten by using records instead of classes and not updating what I think it would due to updating the copy! |
11:16:36 | def- | tumult: if you want inheritance, you can't put put non-ref objects into their base class types or data gets cut off |
11:16:43 | novist | hehe i see. i hate delphi/pascal with passion so i dont know it's ins and outs. should you have c++ background it would be obvious because it works like that in c++ |
11:20:09 | Araq | tumult: you cannot do anything else with a stack object. the nature of the stack is that things cannot escape from it |
11:20:47 | Araq | if they could, it would be a heap ;-) |
11:21:03 | * | aidanh joined #nim |
11:22:17 | tumult | Araq: I'm a simple man with a simple mind sometimes :) I think I've had trouble separating MyObj = object and instantiating it, and my weird idea that refs are somehow related to Delphi interfaces and the problems I've had with those, when they're not really related |
11:23:03 | tumult | I just use refs most of the time now except in rare circumstances |
11:23:28 | Araq | he, that's slow :P |
11:24:42 | tumult | interfaces in Delphi have caused me so many problems tbh, I really dislike them even though I like the idea of templating a collection of methods that something may use |
11:27:14 | tumult | actually whilst I'm asking questions on OOP in nim. When you have an object, say MyObj = ref object of RootObj, what happens when you inherit it? If I do: MyNewObj = ref object of MyObj is that a ref of a ref? What about MyNewObj = object of MyObj, is this a stack allocation of a ref object? |
11:27:41 | * | aidanh quit (Ping timeout: 244 seconds) |
11:29:35 | tumult | I should probably make these questions forum posts... |
11:29:56 | Araq | it's not a ref to a ref |
11:30:05 | Araq | when you do object of SomeRef |
11:30:32 | Araq | that's just an allowed shortcut for 'object of UnderlyingObjectofSomeRef' |
11:31:05 | Araq | since the underlying object can be anonymous |
11:31:24 | Araq | which is what happens when you do |
11:31:32 | Araq | type SomeRef = ref object |
11:33:06 | * | aidanh joined #nim |
11:35:00 | tumult | so where SomeObject = ref object, "SomeRef = ref object of SomeObject" is the same as "SomeRef = object of SomeObject", where SomeRef is a ref in both cases? So the inherited 'ref' is redundant in the code here? |
11:38:18 | novist | i think he meant "SomeRef = ref object of SomeRefObject" == "SomeRef = ref object of SomeObject" |
11:48:57 | fowl | Araq, getType is returning float64 as float |
11:49:30 | Araq | fowl: that is correct, float64 is mapped to float since quite some time now |
11:52:19 | fowl | int and uint still exist with int8 through int64 though? |
11:52:28 | Araq | yes |
11:52:36 | fowl | int and uint still exist with int8 through int64 though? |
11:52:39 | fowl | er |
11:53:21 | Araq | but yeah, we need to look at this design again |
11:53:34 | Araq | float vs float64 proved hard to work with math.nim |
11:53:58 | Araq | but effectively losing the "default fast float type" is not good either |
11:54:24 | Araq | that said, I'd like to make float32 the default |
11:54:52 | Araq | both Urho and Unreal Engine 4 use float32 for everything anyway |
11:55:15 | Araq | and float32 is much better for GPUs |
11:56:59 | tumult | does anyone know the url of an online nim evaluator? |
11:57:08 | Araq | ask ekarlso |
11:57:13 | tumult | I'm sure I remember seeing one but can't find it now |
12:00:35 | tumult | btw thanks everyone for helping me on my OOP questions :) |
12:01:22 | def- | tumult: http://185.56.186.94/ |
12:02:08 | tumult | def-, cheers :) |
12:02:45 | tumult | there's also this one http://www.tutorialspoint.com/compile_nimrod_online.php |
12:03:12 | * | aidanh quit (Ping timeout: 245 seconds) |
12:04:27 | tumult | def- the one you posted is far better tho |
12:04:37 | def- | that's the one by ekarlso |
12:05:38 | * | TEttinger quit (Ping timeout: 252 seconds) |
12:06:36 | ekarlso | meh meh :p |
12:13:11 | * | gokr joined #nim |
12:17:29 | Araq | ekarlso: can we get a proper URL for this? |
12:17:32 | dom96 | ekarlso: Is your version ready to be accessible via play.nim-lang.org? |
12:18:02 | ekarlso | take a look at the code and you decide ;) |
12:18:32 | def- | ekarlso: got the timeout issue solved? |
12:19:20 | * | aidanh joined #nim |
12:19:26 | dom96 | ekarlso: Is there any sort of API for it? |
12:19:43 | dom96 | I could add it to NimBot then :) |
12:20:24 | ekarlso | dom96: there is |
12:20:25 | def- | ekarlso: and you'll definitely need cpu% and mem% limits too |
12:20:36 | ekarlso | def-: eh, how the crap you do that :p |
12:20:38 | ekarlso | with playpen |
12:20:50 | def- | playpen -h |
12:20:54 | def- | should tell you all |
12:24:51 | def- | ekarlso: and it should be possible to select the backend compiler maybe. tcc is much faster, which is great for this, but if someone tries threading they'll be disappointed. setting compiler options would also be necessary then (--threads:on) |
12:25:20 | def- | and you can use highlight.js for syntax highlighting |
12:25:59 | ekarlso | def-: on the roadmap :| |
12:26:06 | ekarlso | def-: you can do that with ace too :) |
12:26:20 | dom96 | also set indentation to two spaces |
12:26:40 | def- | ekarlso: great |
12:27:01 | dom96 | ekarlso: do you want to run this on your own server? |
12:27:25 | ekarlso | dom96: i got more resources then u do I wonder ?^^ |
12:27:29 | ekarlso | so i think so :) |
12:27:51 | dom96 | possibly |
12:27:58 | dom96 | Araq needs to upgrade the VPS :P |
12:28:10 | ekarlso | dom96: heh, I got freebie account on a cloud :p |
12:28:21 | def- | you really shouldn't run the playpen thing on the website vps |
12:28:47 | dom96 | That's true. |
12:28:57 | dom96 | ekarlso: You can host it then. |
12:36:11 | BlaXpirit | ekarlso, it went down |
12:40:16 | ekarlso | k |
12:55:01 | * | BlaXpirit quit (Quit: Quit Konversation) |
12:57:54 | * | BlaXpirit joined #nim |
13:00:08 | * | aidanh quit (Ping timeout: 256 seconds) |
13:00:52 | * | aidanh joined #nim |
13:12:45 | * | johnsoft quit (Ping timeout: 252 seconds) |
13:12:57 | * | johnsoft joined #nim |
13:17:32 | * | BitPuffin joined #nim |
13:18:46 | * | johnsoft quit (Ping timeout: 244 seconds) |
13:19:11 | * | aidanh quit (Ping timeout: 250 seconds) |
13:19:42 | * | johnsoft joined #nim |
13:40:10 | * | aidanh joined #nim |
13:47:14 | ekarlso | suggestions def- ? ^ |
13:49:29 | def- | ekarlso: suggestions for? |
13:59:58 | ekarlso | def-: u had some examples no to import ? |
14:00:47 | def- | ekarlso: Many of those: https://github.com/def-/nim-unsorted |
14:01:07 | def- | they all print something and show a huge part of the standard library |
14:09:43 | * | mpthrapp joined #nim |
14:11:21 | * | aleron joined #nim |
14:19:28 | * | Trixar_za quit (Quit: ZNC - http://znc.in) |
14:22:36 | aleron | Are there any file reading procs that will return right away if there is no data available on the file handle? |
14:23:06 | aleron | I'm looking for a way to read from stdin without blocking |
14:29:56 | Araq | dunno, I'm sure you can wrap some name without vowels to get this feature on unix |
14:32:35 | aleron | I am debaiting exposing poll() to nim |
14:33:12 | aleron | also having a way to set a file handle to non-blocking (fcntl()) would be a way too |
14:33:33 | Araq | posix.nim? |
14:34:53 | aleron | woohoo |
14:34:55 | aleron | thanks! |
14:36:16 | aleron | So if a proc's signature has a ptr argument, that means when I call the proc I need to do foo(addr myarg) right? |
14:36:31 | def- | right |
14:37:00 | aleron | ty |
14:45:39 | * | sampwing joined #nim |
14:45:57 | onionhammer | aww ekarlso where'd it go? I wanted to see :( |
14:51:53 | ekarlso | onionhammer: :P |
14:52:19 | * | sampwing quit (Ping timeout: 252 seconds) |
14:52:25 | onionhammer | :'( |
15:01:19 | * | Trustable joined #nim |
15:05:21 | * | johnsoft quit (Ping timeout: 250 seconds) |
15:06:07 | * | johnsoft joined #nim |
15:12:58 | * | mpthrapp quit (Remote host closed the connection) |
15:14:49 | * | mpthrapp joined #nim |
15:16:07 | * | a5i joined #nim |
15:16:58 | * | zahary quit (Read error: Connection reset by peer) |
15:30:33 | * | ChrisMAN joined #nim |
15:40:13 | * | aleron quit (Quit: leaving) |
15:40:18 | * | darkf quit (Quit: Leaving) |
15:42:47 | BlaXpirit | onionhammer, it's an ACE editor textbox with a "run" button and an output field |
15:54:50 | * | zahary joined #nim |
16:00:15 | * | irrequietus joined #nim |
16:07:44 | * | irrequietus_ joined #nim |
16:07:51 | * | irrequietus quit (Ping timeout: 252 seconds) |
16:27:04 | Araq | novist: we can re-consider the construction problem, but please consider a few more things than just syntax |
16:27:56 | Araq | 1. does the design allow painless switching to some form of pool allocation |
16:28:21 | Araq | 2. how does the design deal with the 'not nil' initialization problems |
16:32:16 | Araq | and when we talk about syntax why is 'new T' so much better than 'newT'? If you argue about consistency, well the 'new T' syntax cannot prevent a simple construction proc, so the people who ignore the standard way of doing things can continue to do that just fine. So nothing is gained. |
16:34:31 | Araq | and again, even in C#/Java construction is not consistent. There can be factories. |
16:34:50 | novist | hmm i see, behind-the-scenes constructor obscures object allocation.. well that surely is not good. although if "new" in "new T()" did allocation then it could be customized with custom "new_pool T". im not sure what are 'not nil' problems though |
16:35:38 | Araq | T(field: "") # can prove x.field is not nil very easily. |
16:36:05 | * | irrequietus_ quit () |
16:36:28 | Araq | initT("") # harder to prove. well my example sucks |
16:37:02 | Araq | but it's a big problem with init(x: var Obj) |
16:37:13 | Araq | since 'var' doesn't mean 'out' |
16:37:40 | reactormonk | init(x: var Obj not nil) ? |
16:37:48 | Araq | so for better 'not nil' support we need 'init(x: var Obj) {.constructor.}' |
16:38:00 | Araq | and then the compiler can *check* every field is assigned in 'init' |
16:38:13 | Araq | reactormonk: it's about the Obj's fields |
16:38:33 | reactormonk | so not nil is transitive? |
16:38:41 | Araq | no. |
16:38:50 | novist | although why every field has to be assigned in ctor? there surely are situations where it can be nil until its needed |
16:38:55 | Araq | but object field: T not nil is possible |
16:39:04 | Araq | not every field |
16:39:09 | Araq | but every field that is not nil |
16:40:13 | novist | im not aware of such things. is it set somehow in declaration of field or what? or its based on field type? |
16:40:26 | Araq | based on field type |
16:41:11 | Araq | Construction in a mutable language is *complex*. ;-) |
16:41:45 | novist | i do not doubt hehe, but this thing is really nasty itch that needs scratching |
16:41:59 | novist | and i believe it would simplify some things for wrapping large c++ libs too |
16:42:57 | Araq | I don't think it solves anything for C++ interop. |
16:43:03 | novist | regarding constructor pragma - is it really necessary? can it not be implied that if method name is init and it has first param of a certain type its a constructor? after all its being called by compiler as a constructor if it fits the bill |
16:43:59 | Araq | yeah but we decided on "magic builtin procs" to use operator syntax |
16:44:20 | Araq | since proc `[]=` already exists and is somewhat special |
16:45:10 | reactormonk | Araq, do I also need to realign WarningsToStr / HintsToStr? |
16:45:25 | Araq | iirc it would be proc `~init`(x: var T) |
16:45:28 | novist | im thinking with pragma it would be somewhat out of tune with destroy() destructor, hence again confusing |
16:45:45 | Araq | onionhammer argued we need to do 'destroy' differently |
16:46:10 | novist | differently how? |
16:46:17 | Araq | so ok, no pragma required, that's good |
16:46:22 | reactormonk | ... nope |
16:46:28 | Araq | proc `~destroy`(x: var T) |
16:48:52 | novist | well to me such syntax looks bit awkward but okay ^_^. i mean i get why operators are in backticks - special characters and all. ctor/dtor does not have to be like that |
16:49:54 | Araq | bbl |
16:50:20 | novist | an someone logs out on pidgin. i must be having Araq in my contacts :)) |
16:56:02 | onionhammer | it'd be better to not need the backticks |
16:56:14 | onionhammer | just proc ~destroy(self: var T) |
16:58:30 | onionhammer | next up owned pointers |
16:58:55 | novist | tbh i think its pretty good without ~. i get that it makes it obvious that its dtor if one comes from c++ background but maybe it should not be dragged into nim |
16:59:06 | novist | just like __del__ in python |
16:59:24 | onionhammer | i would prefer ~TypeName() to ~destroy |
16:59:40 | onionhammer | proc ~MyObj(self: MyObj) |
17:00:01 | novist | like people say in my country it looks like buttery butter |
17:00:19 | emilsp | novist, is that sviestains sviests ? |
17:00:27 | novist | sviestas sviestuotas :p |
17:00:37 | emilsp | novist, lithuanian ? |
17:00:47 | novist | are you from Latvia or something? yes i am lithuanian hehe |
17:00:54 | emilsp | yes, indeed I am |
17:01:10 | novist | good to meet neighbors in this vast internetz world haha |
17:02:27 | ekarlso | play site running again |
17:04:04 | novist | reason i personally would prefer init(or even construct)/destroy that it fits nicer into nim's functional approach, since they then are just ordinary procs that get called by compiler. and later in child object constructor user can call manually parent constructor, just like a simple proc. much like in python |
17:04:38 | * | brson joined #nim |
17:06:07 | * | gmpreussner|lapt joined #nim |
17:08:06 | * | Menche quit (Ping timeout: 246 seconds) |
17:32:16 | * | kniteli_ quit (Quit: Leaving) |
17:32:29 | * | kniteli joined #nim |
17:41:34 | ekarlso | who managed to crash it again ? :p |
17:41:58 | dom96 | ekarlso: You should set it up so that it restarts automatically :P |
17:42:39 | ekarlso | dom96: ... |
17:42:42 | ekarlso | too much todo atm :| |
17:51:19 | * | tumult quit (Ping timeout: 246 seconds) |
17:54:33 | * | Tennis quit (Quit: Leaving) |
17:54:41 | * | federico3 joined #nim |
17:59:01 | * | pregressive joined #nim |
18:09:51 | ekarlso | does http://185.56.186.94/#/ |
18:09:54 | ekarlso | look better ? |
18:25:01 | * | johnsoft quit (Ping timeout: 264 seconds) |
18:28:00 | ekarlso | def-: dom96 ? :p |
18:28:28 | * | gmpreussner|lapt quit (Ping timeout: 255 seconds) |
18:30:43 | Araq | ekarlso: did I break it? |
18:33:45 | reactormonk | Araq, any tests on import statements besides in modules/ ? |
18:34:59 | Araq | reactormonk: there is also 1 important test in manyloc/ iirc |
18:35:34 | reactormonk | what does manyloc stand for? |
18:35:56 | Araq | "many lines of code" |
18:36:41 | reactormonk | http://pastie.org/10004181 <- when running ./koch tests |
18:36:43 | Araq | aye manyloc/packages is the test |
18:37:10 | Araq | yeah I need to disable Nimble package testing |
18:37:19 | Araq | but you can do it too |
18:39:47 | * | johnsoft joined #nim |
18:43:19 | * | kniteli quit (Ping timeout: 250 seconds) |
18:43:53 | * | tumult joined #nim |
18:45:02 | reactormonk | Found the bug, but the tests still fail in nimble |
18:48:52 | Araq | reactormonk: if you could get that to work, that would really be sweet |
18:49:02 | reactormonk | Araq, the nimble tests? |
18:49:03 | ekarlso | haha, apparantly u did Araq ... |
18:49:06 | ekarlso | silly while loop :p |
18:49:13 | Araq | ekarlso: :P |
18:49:19 | Araq | reactormonk: yes |
18:50:15 | reactormonk | Oh, I found the bug. |
18:50:40 | reactormonk | Task: chop off a newline (And a bit more). Solution: str[0.. -3]. Find the bug. |
18:51:16 | ekarlso | wonder how to avoid that Araq |
18:51:17 | ekarlso | :p |
18:52:04 | Araq | ekarlso: use linux sandboxing |
18:52:41 | Araq | or simply have a watcher process that kills the Nim process after a timeout |
18:52:57 | * | Trixar_za joined #nim |
18:56:15 | * | vendethiel- quit (Remote host closed the connection) |
18:56:25 | * | vendethiel joined #nim |
18:58:59 | reactormonk | how can I run all non-nimble tests? |
18:59:26 | * | kniteli joined #nim |
19:00:29 | reactormonk | found it |
19:02:03 | * | epichero quit () |
19:18:14 | * | milosn quit (Read error: Connection reset by peer) |
19:21:19 | * | UberLambda joined #nim |
19:22:32 | * | milosn joined #nim |
19:23:07 | Araq | Maxdamantus: what happened to your PR? |
19:25:14 | * | pregressive quit (Remote host closed the connection) |
19:28:51 | * | pregressive joined #nim |
19:40:02 | onionhammer | ekarlso very cool, you want some help with the UI? :) |
19:41:07 | Araq | ekarlso: yeah, pretty cool, we will link to it from the website when it's more stable :-) |
19:41:22 | Araq | so yes, people here do care about your work |
19:43:07 | * | Trustable quit (Remote host closed the connection) |
19:43:07 | ekarlso | onionhammer: by all means :P |
19:43:25 | ekarlso | Araq: i think pkgs are more importamt :p |
19:43:29 | ekarlso | but ey ok ^^ |
19:43:53 | onionhammer | ekarlso you got a repo somewhere? |
19:44:07 | onionhammer | you got the tcc back end working huh, nice :) |
19:44:29 | ekarlso | onionhammer: yeah, it's 2 seperate repos atm :) |
19:44:48 | onionhammer | links? |
19:44:56 | ekarlso | there's the old frontend which was jquery and the new using angular |
19:45:01 | ekarlso | https://github.com/ekarlso/nim-play-frontend |
19:45:06 | onionhammer | gotcha |
19:45:22 | ekarlso | the other part is a simple rest api with some utils to create a chroot etc |
19:45:29 | def- | ekarlso: only 1 program can be compiled and run at any time? that should be a much higher number |
19:46:19 | ekarlso | def-: I suspect it's because the cmd is blocking :P |
19:47:31 | ekarlso | that part is here: https://github.com/ekarlso/nim-playpen |
19:47:59 | ekarlso | onionhammer: u good at gulp ? |
19:48:28 | onionhammer | not at all |
19:48:41 | ekarlso | doh :D |
19:48:44 | onionhammer | i'm a web dev, but I dont do a lot of client-side fuckery :P |
19:48:52 | ekarlso | :P |
19:48:57 | * | a5i quit (Quit: Connection closed for inactivity) |
19:49:22 | onionhammer | shouldnt be too hard to figure out though |
19:49:27 | ekarlso | :P |
19:49:42 | ekarlso | there's a issue with the fonts not wokring when doing "gulp serve" |
19:49:52 | ekarlso | you'll see i've done a hacky thing :p |
19:50:05 | onionhammer | ha ok |
19:50:17 | onionhammer | i'm at work right now, but i should have time to look at this tomorrow :) |
19:50:26 | ekarlso | :D |
19:50:39 | onionhammer | my girlfriend has to work tomorrow (party! :)) |
19:50:55 | ekarlso | :P |
19:50:57 | ekarlso | haha |
19:51:07 | ekarlso | enjoy it while it's gf and not mom or wife :P |
19:51:19 | onionhammer | lol i hope she never becomes my mom |
19:51:34 | fowl | ekarlso, will you add a sharing function to your repl |
19:51:39 | ekarlso | your childs mim hah : |
19:51:47 | ekarlso | fowl: sharing how ? |
19:52:01 | ekarlso | i got a few ideas in mind :P |
19:52:08 | ekarlso | though not all the time in the world :/ |
19:52:13 | fowl | link to open the page with script loaded would be perfect |
19:52:45 | ekarlso | should'nt be hard though |
19:52:52 | ekarlso | each run / snip already has a ID |
19:52:58 | ekarlso | so just store the file and share the id |
19:53:00 | ekarlso | :P |
19:53:36 | fowl | cool |
19:58:09 | ekarlso | def-: any clue on the multiple requests stuff ? :p |
19:58:35 | def- | ekarlso: a thread for each request? |
19:58:41 | def- | if you want to keep it blocking |
19:58:47 | def- | or you do some async stuff |
19:58:49 | ekarlso | how to make it nonblocking :P |
19:58:52 | ekarlso | def-: patches welcome :D |
19:59:01 | def- | none coming soon, sorry |
19:59:53 | ekarlso | :( |
20:00:00 | ekarlso | everyone just has ideas :p |
20:02:52 | * | BlaXpirit quit (Remote host closed the connection) |
20:03:16 | Maxdamantus | 08:22:50 < Araq> Maxdamantus: what happened to your PR? |
20:03:46 | Araq | yeah, your diff looked good |
20:03:49 | Maxdamantus | It's still there. I added the `(int, int)` commit to it and rebased it again yesterday (because of conflicts) |
20:04:10 | Araq | hrm oh so you added it to the other PR? |
20:04:17 | Maxdamantus | Yeah. |
20:04:41 | * | BlaXpirit joined #nim |
20:04:56 | Maxdamantus | Merging them separately would cause conflicts because of at least the type rendering. |
20:05:17 | ekarlso | Araq: ever concidered using something like gerrithub? |
20:14:05 | dom96 | ekarlso: I haven't looked at your code but perhaps this would be of use? https://github.com/nim-lang/nimbuild/blob/rewrite/src/builder/asyncproc.nim |
20:14:25 | dom96 | If so then I can put it in a separate nimble package so that both projects can use a common code base |
20:15:11 | ekarlso | dom96: what projects ? :) |
20:15:19 | OderWat_ | Yeah! I love my new echo x[->] and x[<-] as alternative to x[x.high] x[x.low] which I made as the next thing @Araq can reject to put into the language :-P |
20:15:45 | dom96 | ekarlso: nim-playpen and nimbuild |
20:15:57 | ekarlso | :P |
20:16:28 | dom96 | OderWat_: hah |
20:16:47 | OderWat_ | I think it is beautiful: https://github.com/Araq/Nim/pull/2283 |
20:18:01 | OderWat_ | But I bet it is not good for some reason. I still like to fiddle with the compiler parser / ast :-P |
20:18:26 | fowl | OderWat_, hey, i just saw your comment today, the fix for repeat() is curry((proc(c:char,n:int):string)strutils.repeat, 'x') |
20:18:57 | dom96 | OderWat_: Certainly a good way to get to know the way the compiler works. |
20:18:58 | OderWat_ | @fowl ok thats cool! |
20:20:08 | * | pregressive quit (Remote host closed the connection) |
20:30:35 | dom96 | ekarlso: From looking at your code you should be able to make use of asyncproc :) |
20:30:57 | ekarlso | dom96: hard to adopt ? :Ø |
20:31:14 | dom96 | ekarlso: I don't think so. |
20:31:18 | dom96 | Just need to make everything async :P |
20:31:28 | dom96 | That said, I haven't actually properly tested asyncproc yet. |
20:31:42 | dom96 | Because of the bug which prevented threads and async await being used together. |
20:31:56 | dom96 | Basic usage of it seems to work though |
20:31:58 | ekarlso | anyways, looking into sharing atm :P |
20:38:03 | * | Matthias247 joined #nim |
20:38:23 | ekarlso | dom96: what compiler flags should one allwo ? |
20:38:27 | ekarlso | like threads or so |
20:38:36 | dom96 | just --threads:on |
20:38:42 | ekarlso | no other flags ? :p |
20:38:44 | ekarlso | ok |
20:38:51 | def- | -d:release |
20:38:56 | def- | and checks on/off |
20:42:18 | ekarlso | stacktrace too or ? |
20:43:42 | def- | in my opinion yes |
20:47:50 | * | Jehan_ joined #nim |
20:52:09 | Varriount | Personally, I compile all my 'release' code with '-d:release --stacktrace:on --linetrace:on' |
20:52:56 | * | mnemonikk quit (Ping timeout: 265 seconds) |
20:55:15 | * | mnemonikk joined #nim |
20:55:15 | * | mnemonikk quit (Changing host) |
20:55:15 | * | mnemonikk joined #nim |
20:56:38 | Maxdamantus | Araq: actually, there's some bug somewhere that has something to do with the anonymous tuples. |
21:02:00 | * | Menche joined #nim |
21:10:44 | Araq | Maxdamantus: well you have to be more concrete |
21:14:00 | Maxdamantus | I think .n is only set for tuple[..]-constructed PTypes. |
21:14:05 | * | Maxdamantus wonders where that happens. |
21:16:31 | onionhammer | ekarlso syntax highlighting working yet? |
21:17:59 | ekarlso | onionhammer: nope, that needs some ace stuff |
21:18:38 | onionhammer | http://ace.c9.io/#nav=higlighter |
21:18:41 | onionhammer | doesnt look too bad |
21:20:52 | Varriount | onionhammer: Just added shell escaping to 'nimble search' |
21:22:13 | Varriount | So users shouldn't be able to destroy their own computers via 'dummy;rm -rf / |
21:22:16 | Varriount | ' |
21:22:17 | onionhammer | oo yeah :) |
21:22:26 | onionhammer | 'accidentally' :P |
21:22:45 | onionhammer | when does this go into master? |
21:22:56 | Varriount | onionhammer: When it's finished and tested. |
21:23:15 | Varriount | onionhammer: I intend to post on the forum to request some beta testers when it's ready. |
21:23:29 | onionhammer | master is for beta testing :p; |
21:23:52 | onionhammer | ST package control is for stable releases :P |
21:24:09 | Varriount | Hm, true |
21:24:27 | Varriount | Only AutoComplete.py, Lookup.py, and Documentation.py remain for refactoring. |
21:24:45 | Varriount | Adding the new output settings has taken a lot of time to get right. |
21:25:06 | Maxdamantus | Ah, in semTuple itself. |
21:25:18 | Varriount | onionhammer: Of course, if you want to merge it, be my guest. Just don't complain about anything being broken. |
21:25:37 | onionhammer | if u dont think it's ready to be merged then its not ready |
21:26:05 | * | tumult quit (Quit: Page closed) |
21:26:13 | Araq | OderWat_: you can implement var (foo, _, _) = p() instead |
21:26:38 | Araq | that one will be accpted |
21:27:00 | onionhammer | _= discarded? |
21:27:04 | Araq | yes |
21:27:09 | onionhammer | why not discard :P |
21:27:16 | Araq | because sexy |
21:27:20 | onionhammer | heh ok |
21:27:24 | Jehan_ | I think it's about selective discards? |
21:27:38 | onionhammer | Jehan_ I meant var (foo, discard, discard) = p() |
21:27:46 | Jehan_ | Oh, I see. |
21:28:03 | Jehan_ | I'd favor _, because it's easier to read. |
21:28:14 | onionhammer | same, just devils advocate for consistency |
21:28:32 | BlaXpirit | cool stuff |
21:28:43 | Jehan_ | Eh, it would be using discard differently (as a pseudo-variable rather than function), so it wouldn't be all that consistent. |
21:28:53 | * | Menche quit (Ping timeout: 264 seconds) |
21:28:57 | onionhammer | discard as a function? |
21:29:08 | Varriount | But it would still serve the same purpose. :/ |
21:29:13 | Araq | and if you want a challenge, go on and implement p(_, _, "abc") which we need for disambiguation for the fowl's 'curry' macro |
21:29:14 | Jehan_ | Well, discard is essentially a pseudo-function. |
21:29:19 | Jehan_ | You could implement it as one. |
21:29:20 | onionhammer | Jehan_ there are already multiple purposes for it |
21:29:41 | onionhammer | discard meaning "I dont care about this result" or discard meaning "no statement" |
21:29:47 | BlaXpirit | `discard` will not look good |
21:30:21 | Jehan_ | onionhammer: The latter is the same as the first without an argument. |
21:30:24 | * | Menche joined #nim |
21:30:37 | Varriount | Personally, I favor 'var (foo, discard, discard) = p()', since it re-uses discard (and is a logical extension of it's purpose) |
21:30:39 | onionhammer | no, they're on different sides of calls |
21:30:40 | Maxdamantus | Mm. I think they shouldn't have .n, though semtypes.nim at least assumes they do, dunno what else. |
21:30:55 | onionhammer | l value vs r value |
21:31:15 | Jehan_ | Varriount: I'm mostly interested in code readability. If you have multiple values, it's easier to count "_" than discards. |
21:31:18 | Araq | Maxdamantus: there are few places left that assume an 'n', should be easy to fix |
21:31:47 | Jehan_ | But, well, personal opinion and all that. :) |
21:32:03 | onionhammer | I think _ is easier to use, but im not sure if it should be used all that much :P |
21:32:15 | Jehan_ | I mean, I am also using underscores in Nim identifiers for my code (heresy!) |
21:32:21 | Varriount | Araq: What would p(_, _, "abc") do? |
21:32:43 | Araq | Varriount: match against the proc that ends with a 'string' parameter |
21:32:44 | Maxdamantus | er, not semtypes, semtypeinst |
21:34:23 | Varriount | Araq: Is there any reasoning besides 'looking nice' to use '_' over 'discard'? |
21:34:47 | Maxdamantus | var discard = 4 |
21:34:58 | Araq | Varriount: no. |
21:35:01 | Jehan_ | What would p(_, _, "abc") for? A moment ago we were talking about destructuring, I thought? |
21:35:16 | Jehan_ | be for* |
21:35:21 | Varriount | Araq: I'm just trying to keep in mind that it will be yet another surprise for someone who is new to the language. |
21:35:23 | BlaXpirit | partial? |
21:35:26 | Araq | we talk about the new "solves everything feature" _ |
21:35:46 | * | Jehan_ looks vaguely lost. |
21:35:46 | BlaXpirit | well it could still be `discard` even in that case |
21:35:54 | BlaXpirit | but it will blend in with the rest |
21:35:57 | BlaXpirit | it is not nice |
21:36:03 | Araq | fowl's curry macro needs partial overloading resolution |
21:36:16 | Jehan_ | Oh, anonymous functions as in Sather or Scala? |
21:36:32 | Araq | so I am thinking of giving the placeholder _ more features |
21:37:15 | * | tinAndi joined #nim |
21:37:20 | BlaXpirit | are you sure "currying" is the right term here? |
21:37:29 | BlaXpirit | some background would be nice anyway |
21:37:30 | Varriount | Araq: Hm. What would be the difference between '_ = proc()' and 'discard proc'? |
21:37:45 | Araq | there is no '_ = proc' |
21:37:55 | Araq | _ is only in tuple destructuring |
21:37:55 | Maxdamantus | Araq: do you know what all those places are or how to find out? |
21:38:23 | Araq | Maxdamantus: the tests will tell you |
21:38:51 | Araq | but you can also grep for tyTuple |
21:38:59 | Varriount | Araq: But every value can also be thought of as a tuple of length 1 |
21:39:51 | Maxdamantus | The current tests don't exhaustively use anonymous tuples (or even nominal ones, I suspect) |
21:40:11 | Araq | Maxdamantus: well I'm sure you will add tests ;-) |
21:41:33 | Maxdamantus | But ensuring exhaustion is difficult and can't really itself be tested for. |
21:41:49 | Maxdamantus | I'll add this parser combinator thing as a test anyway. |
21:42:09 | Araq | grepping for tyTuple is exhaustive |
21:44:00 | Jehan_ | Next on the menu: ADT notation? :) |
21:45:04 | Araq | pattern matching macro seems to be more important after _ |
21:45:14 | def- | Jehan_: maybe a nice macro would work |
21:45:17 | Araq | ADT notation is only helpful when you write lots of ADTs |
21:45:23 | Araq | but nobody does |
21:45:50 | * | UberLambda quit (Quit: Leaving the Matrix) |
21:45:55 | Jehan_ | I wasn't serious, and I have a macro for when I do (albeit not a nice one). :) |
21:46:13 | Maxdamantus | Why not GADT? |
21:46:16 | Araq | people write an ADT when they try Nim the first time |
21:46:33 | Araq | but most code doesn't consist of ADTs |
21:47:30 | Maxdamantus | type Maybe where Just: proc[A](a: A): Maybe A; Nothing: Maybe A |
21:49:22 | Varriount | Does this have anything to do with type classes? |
21:49:27 | Maxdamantus | No. |
21:49:39 | * | fizzbooze joined #nim |
21:50:01 | Jehan_ | Araq: Hmm, I tend to use them (or their equivalents) a fair bit. |
21:51:12 | Jehan_ | tagged unions/ADTs/subtyping or something like them is pretty essential for polymorphic behavior. |
21:51:14 | fizzbooze | so heard that if you disable GC, you get memory leak. is this true? |
21:51:21 | BlaXpirit | pretty much |
21:51:34 | Jehan_ | And often, ADTs are the most convenient way of doing them (especially for ad-hoc types). |
21:51:46 | def- | fizzbooze: try --gc:none and you will see the compiler warnings about GCed memory |
21:52:22 | fizzbooze | def-: is there a way to disable GC and free the memory yourself? |
21:52:22 | Araq | Jehan_: dunno, my ad-hoc types are often just enums, I think |
21:52:31 | fizzbooze | or is GC required if you don't want leaks |
21:52:42 | flaviu | fizzbooze: GC is requried for the stdlib. |
21:52:57 | fizzbooze | i see. thanks |
21:52:57 | Araq | fizzbooze: something like that is in fact in the works |
21:52:57 | def- | fizzbooze: the idea is not to use the standard library then but write your own stuff, as you would do in a kernel, for example |
21:53:13 | Varriount | Araq: Well, I just want it to be noted that I oppose using '_' for tuple destructuring, and would rather re-use 'discard'. |
21:53:20 | Varriount | 'discard' is already used to 'throw away' data, and it would make more sense when a beginner to the language sees it used in a tuple destructuring context. |
21:54:23 | Varriount | Using '_' for two very different purposes is confusing, even if it does look nice. |
21:54:41 | Araq | Varriount: fair enough, but I think newbies don't understand the consistency |
21:54:58 | Araq | newbies are usually more like "ok, like in Scala" |
21:55:00 | fizzbooze | Araq: is this planned for post-1.0? |
21:55:36 | Araq | fizzbooze: pretty much, yes as the design is not finished |
21:55:42 | Maxdamantus | proc dracsid[T](a: T) = return |
21:56:37 | Jehan_ | Araq: Hmm, I often need more than enums, but that probably comes down to programming style. |
21:57:13 | Araq | and programming domain |
21:57:13 | Jehan_ | I am not so keen on having ADTs as the one-stop-shopping solution for polymorphism, but I do find them handy often enough. |
21:57:18 | Jehan_ | True. |
21:57:57 | * | Maxdamantus doesn't like the use of the term "polymorphism" there. |
21:58:01 | Varriount | fizzbooze: In the future, parts of the stdlib may become less dependant on run-time garbage collection (if they aren't already) |
21:58:12 | Maxdamantus | You declare a bunch of things that are the same type. |
21:58:23 | Maxdamantus | Polymorphism is about handling things of varying types. |
21:58:37 | Araq | Varriount: that's not really my plan |
21:59:07 | Jehan_ | And an ADT is basically a sum type over multiple tuple types. |
21:59:10 | Araq | instead the threal local GC can be turned into region based allocator |
21:59:20 | Varriount | Araq: I mean, aren't there places where sequences could be safely deallocated when scope ends? |
21:59:34 | Araq | oh yeah but that's just escape analysis |
21:59:41 | Maxdamantus | Jehan_: no, because of tags. |
22:00:06 | Varriount | Araq: Well yes, but then you aren't really using (run-time) garbage collection anymore. |
22:00:20 | Araq | Varriount: that depends on the *thread* |
22:00:40 | Araq | oh |
22:00:52 | Araq | you're still talking about escape analysis |
22:00:54 | Jehan_ | http://en.wikipedia.org/wiki/Algebraic_data_type#Theory |
22:01:01 | Varriount | Araq: Yep. |
22:01:09 | Araq | well that's just an optimization, that cannot do wonders |
22:01:18 | * | Zuchto quit (Quit: --) |
22:03:25 | Maxdamantus | Jehan_: it's describing it lazily, unfortunately. |
22:05:39 | Maxdamantus | Jehan_: but the tag is quite important. You can't just say that `List Int` in Haskell is a union of `()` and `(Int, List Int)` |
22:06:02 | Jehan_ | Sum types are tagged unions? |
22:06:13 | Jehan_ | Just a different terminology? |
22:06:14 | * | l04m33 quit (Ping timeout: 252 seconds) |
22:06:17 | Maxdamantus | Not really. |
22:06:28 | * | l04m33 joined #nim |
22:06:46 | Jehan_ | Hmm, reference? |
22:08:00 | Maxdamantus | Maybe sometimes. |
22:08:34 | Maxdamantus | Wikipedia says tagged unions are also called "sum types" .. on the tagged union page. |
22:11:28 | Jehan_ | Any specific example where a sum type expresses something that a tagged union cannot express or vice versa? |
22:13:04 | Maxdamantus | if you're not in a intuitionistic system, you can just have a sum without a tag, which is the same as a union operation on sets. |
22:13:11 | * | mpthrapp quit (Remote host closed the connection) |
22:14:19 | Jehan_ | Hmm. |
22:14:54 | Jehan_ | Still not seeing how they aren't isomorphic. |
22:15:06 | Maxdamantus | think about Either Int Int |
22:15:22 | Jehan_ | Though my background is primarily algebra, not type theory, so that may color my perception. |
22:17:53 | Maxdamantus | `Left 4` is distinguished from `Right 4` |
22:19:17 | Maxdamantus | if you just had: `Either a b = a ∪ b`, `Either Int Int` would be `{0, -1, 1, -2, 2, ..} ∪ {0, -1, 1, -2, 2, ..}` |
22:19:25 | Maxdamantus | which is again just `{0, -1, 1, -2, 2, ..}` |
22:22:07 | Araq | that makes sense. :-) |
22:22:35 | Maxdamantus | but that's not what happens. |
22:22:52 | Maxdamantus | if `Int` has 2^32 values, `Either Int Int` has 2^33 values. |
22:23:15 | Araq | so ... does your Either have a tag or not? |
22:23:30 | Maxdamantus | The one with ∪ doesn't. |
22:23:33 | Maxdamantus | The one in Haskell does. |
22:23:58 | * | fizzbooze quit (Ping timeout: 256 seconds) |
22:24:23 | Maxdamantus | in C you have something more like the one with ∪ |
22:24:43 | Maxdamantus | because `union { int a, b; }` still has the same number of values as `int` |
22:28:42 | Araq | so your point is that a "sum type" doesn't have a tag? |
22:28:51 | Maxdamantus | Actually, sum types should have tags. |
22:29:04 | Maxdamantus | otherwise they won't correspond to summation. |
22:29:26 | Araq | but a union type doesn't? |
22:29:36 | Maxdamantus | No. |
22:30:19 | Araq | but a tagged union type does? |
22:30:22 | Maxdamantus | Yes. |
22:30:39 | Araq | so Jehan_ used the terms correctly then |
22:31:04 | Araq | a sum type is a tagged union type then |
22:31:16 | Maxdamantus | Yes. |
22:31:22 | Araq | lol |
22:31:57 | Maxdamantus | Although not about the polymorphism thing. |
22:39:34 | * | aidanh quit (Ping timeout: 272 seconds) |
22:40:09 | * | aidanh joined #nim |
22:42:29 | xificurC | what package(s) should I check out as a newcomer for creating a simple 2d toy game? |
22:46:35 | Jehan_ | Class hierarchies are tagged unions also and ADTs are isomorphic to a very specific type of class hierarchy. I.e. how Scala represents ADTs as case classes with a sealed abstract superclass. I think this justifies calling them polymorphic. |
22:47:04 | def- | xificurC: csfml has some nice example games, there's also an sdl2 and urho3d wrapper |
22:49:44 | xificurC | def-: csfml, I see that's a wrapper, will check out, thanks |
22:57:01 | Maxdamantus | Jehan_: then every type with more than two values is polymorphic. |
22:57:44 | Maxdamantus | boolean is a hierarchy containing the types True and False. |
22:57:55 | Maxdamantus | int is a hierarchy containing the types 0, 1, 2, .. |
22:58:14 | * | Maxdamantus does know of languages that work like that. |
22:58:46 | Maxdamantus | er, two or more values* |
22:59:04 | Jehan_ | Do 0, 1, 2 have operations with distinct semantics? |
22:59:10 | Maxdamantus | Yes. |
22:59:17 | Maxdamantus | 0 + 1 = 1 |
22:59:19 | Maxdamantus | 1 + 1 = 2 |
22:59:22 | Jehan_ | I'll note that polymorphism is a vague concept to begin with. |
23:00:11 | Jehan_ | But if you've got a pretty clear isomorphism between two concepts (ADTs and specific kinds of class hierarchies), it's difficult to argue that they are fundamentally different. |
23:00:30 | Jehan_ | You'll have to get really creative with Goedel numberings to say the same thing about integers. |
23:00:44 | * | Maxdamantus also implemented Int64, etc in some language once using an Int{n} → Int{2*n} combinator. |
23:01:11 | Maxdamantus | starting with Int1 as being derived from Bool, which was an interface with True and False as instances. |
23:01:35 | reactormonk | So how exactly do I diff between two version of tests? |
23:01:46 | Maxdamantus | Bool, Int1, Int2, Int4, Int8, Int16, Int32, Int64 |
23:01:59 | Maxdamantus | operations were kind of slow. |
23:02:16 | federico3 | how can I check if a string belongs to a set of strings? |
23:03:22 | Jehan_ | Maxdamantus: Still isomorphic to integers, I presume. |
23:03:36 | Jehan_ | I.e. different implementation, same semantics. |
23:04:32 | Maxdamantus | So are the different types for different constructors exposed in Scala? |
23:04:55 | Maxdamantus | Left 4 :: Either[Int].Left |
23:06:15 | Maxdamantus | Hm. Scala doesn't seem to have ADTs. |
23:06:25 | Maxdamantus | They just write the hierarchy themself. |
23:06:32 | def- | federico3: contains? |
23:06:42 | Jehan_ | http://www.scala-lang.org/api/rc2/scala/Either.html |
23:07:13 | federico3 | def-: if x in ["foo", "bar"] ? |
23:07:34 | def- | federico3: that looks like an array, not a set |
23:08:07 | federico3 | yup, I gather that a set can only contain chars, not strings |
23:08:26 | federico3 | (and afaict a set should support "in" as well) |
23:09:10 | def- | federico3: there are 2 types of sets, these work with strings too: http://nim-lang.org/sets.html#contains,HashSet[A],A |
23:09:58 | Varriount | Hm, I could have sworn there was a special case in the built-in set type for strings. |
23:10:41 | * | xificurC quit (Ping timeout: 265 seconds) |
23:12:34 | Jehan_ | Varriount: Not that I know of, but case works with strings (and uses hashing). |
23:13:42 | Jehan_ | federico3: are you talking about the basic set[T] type or one of the set types provided as a library? |
23:13:43 | Varriount | Jehan_: Ah, yeah, that's right. |
23:14:01 | * | tinAndi quit (Quit: ChatZilla 0.9.91.1 [Firefox 36.0/20150222232811]) |
23:14:48 | Jehan_ | And AFAIK both support `in`. |
23:15:38 | Varriount | Jehan_: Though, you could use the builtin set type with strings of 8 or fewer characters, by casting the characters to an integer |
23:16:09 | Jehan_ | Varriount: cardinality is capped at 65536. |
23:16:22 | Jehan_ | Unless that changed recently. |
23:17:10 | Varriount | Aw. |
23:17:23 | * | brson quit (Ping timeout: 256 seconds) |
23:17:32 | Jehan_ | Well, they're basically bitmaps. You'd trash swap memory. |
23:17:59 | * | reem joined #nim |
23:19:26 | Varriount | Speaking of swap memory, am I the only one here that cringes whenever someone describes swap memory as "memory the os uses when it runs out of real ram"? |
23:20:18 | * | randomwalk joined #nim |
23:20:21 | * | aurora joined #nim |
23:20:32 | * | aurora quit (Remote host closed the connection) |
23:21:49 | randomwalk | When I call values() on an OrderedTable, I get this Error: expression 'pairs' cannot be called |
23:21:53 | * | ^aurora^ joined #nim |
23:22:07 | randomwalk | How do I figure out why? |
23:22:14 | ^aurora^ | hi |
23:22:53 | Varriount | randomwalk: What kind of types is the table holding? What does the stack traceback look like? |
23:22:57 | Varriount | Hi ^aurora^ |
23:23:32 | * | reem quit (Remote host closed the connection) |
23:23:40 | randomwalk | Varriount: I didn't see a traceback in the error message. |
23:24:09 | randomwalk | It's holding (string, float32) |
23:24:15 | flaviu | randomwalk: It's a compile error, there's no traceback. |
23:24:31 | Varriount | Unless you compile the nim compiler with stacktrace:on |
23:25:11 | Varriount | 'koch boot -d:release --stacktrace:on --linetrace:on' is what I always use. |
23:25:28 | Jehan_ | randomwalk: values is an iterator. Are you using it as a procedure? |
23:25:32 | flaviu | Yeah, but that's mostly useful for ICEs. This is a regular error from what I can tell. |
23:25:50 | randomwalk | Jehan_: I'm trying to assign it to a var |
23:26:18 | Jehan_ | Ah, you cannot do that; or at least not the way you're probably trying to. |
23:26:24 | * | BlaXpirit quit (Quit: Quit Konversation) |
23:26:25 | Jehan_ | If you want just a seq of values, use: |
23:26:28 | Jehan_ | import sequtils |
23:26:34 | Jehan_ | let a = toSeq(b.values) |
23:26:53 | randomwalk | maybe @[ot.values] |
23:27:05 | Jehan_ | No, toSeq is something different. |
23:27:27 | Jehan_ | it takes an iterator as its argument, runs through it, and produces a seq of all enumerated values. |
23:28:00 | Jehan_ | values is something that's normally used in a for loop. It doesn't return a seq or other collection. |
23:31:48 | * | Menche quit (Remote host closed the connection) |
23:33:44 | * | Demon_Fox joined #nim |
23:35:05 | * | Menche joined #nim |
23:44:58 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:45:58 | * | reem joined #nim |
23:59:05 | * | reem quit (Remote host closed the connection) |