00:00:13 | ldlework | EXetoC: does Nim have like a lightweight coroutine I can use as a timer or something? |
00:01:54 | Araq | ldlework: there are "closure iterators" but since they are syncronous I fail to see how they can act as timers |
00:02:18 | Stefan_Salewski | {.warning[SmallLshouldNotBeUsed]: off.} works fine. Bye. |
00:02:21 | Araq | on the other hand ... they certainly give you coroutines |
00:02:36 | Araq | Stefan_Salewski: why not use a real ident instead? oh wait, generated code |
00:02:40 | ldlework | I guess I can just use a thread |
00:03:47 | Stefan_Salewski | Yes, still glib. But nearly finished now... |
00:03:51 | * | Stefan_Salewski quit () |
00:04:29 | Araq | ldlework: I fail to see the need. nobody has to use timers who has control over the main event loop |
00:04:46 | EXetoC | glib? |
00:05:00 | EXetoC | what about that glib2 module? |
00:05:23 | Triplefox | What kind of timer are we talking about |
00:06:08 | ldlework | Triplefox: in 5 seconds, flip a bool |
00:06:22 | ldlework | but I suppose I need a full event framework |
00:06:33 | ldlework | I did see an async io framework thing |
00:06:40 | * | Stefan_Salewski joined #nimrod |
00:06:46 | Araq | no, you need some basics wrt game loop design :P |
00:07:17 | EXetoC | loop, store the frame delta, etc |
00:07:18 | ldlework | Sure, I could implemented based on a loop and track time but so much easier with a scheduler :P |
00:08:36 | Triplefox | There's nothing completely ideal since it feeds into how much determinism you need in the execution |
00:09:17 | Stefan_Salewski | exotic: latest glib2.40.2 with bigreak names scheme -- cairo is already done this way, gtk3/gdk3 needs some small fixes, remainder pango/gtksourceview will follow... |
00:09:41 | * | Stefan_Salewski quit (Client Quit) |
00:09:44 | EXetoC | why not run nimfix on it? |
00:09:57 | EXetoC | or good old search and replace |
00:10:51 | Araq | ldlework: it's not easier. it sucks for debugging. determinism is king for games |
00:12:27 | * | Stefan_Salewski joined #nimrod |
00:13:02 | ldlework | EXetoC: https://github.com/dustinlacewell/nimbots |
00:13:39 | EXetoC | ok |
00:13:53 | Stefan_Salewski | exetoc: When I did Gtk3 in summer, I discovered that there is some stuff missing from cairo, glib2 and others. And there are some bugs. |
00:13:58 | EXetoC | there's a package now. just got to request inclusion in packages.json |
00:14:05 | EXetoC | Stefan_Salewski: ok |
00:14:53 | ldlework | EXetoC: heh sorry, I'm just excited |
00:14:54 | Stefan_Salewski | So doing it from scratch it for me the simpler and cleaner solution. We discussed that already in the Forum. |
00:14:57 | ldlework | I'll stop pinging you about it :P |
00:15:53 | EXetoC | about what? I'm just saying that I've added a nimble package file |
00:17:20 | EXetoC | ping away |
00:19:02 | * | Stefan_Salewski quit () |
00:24:45 | * | superfunc joined #nimrod |
00:26:41 | ldlework | this language is so flipping awesome |
00:26:58 | ldlework | time to learn about typeclasses |
00:27:34 | superfunc | just so you know, typeclasses are really experimental right now iirc |
00:27:43 | EXetoC | user-defined ones are |
00:28:11 | superfunc | ldlework: here's an article on it you might find helpful: http://vocalbit.com/posts/exploring-type-classes-in-nimrod.html |
00:28:34 | ldlework | Whatever happened to that "oop" library I heard about before |
00:28:37 | ldlework | that provided traits |
00:31:00 | ldlework | One thing I miss in Rust is the ability to do default implementations |
00:32:59 | EXetoC | that issue present in C++? |
00:34:07 | ldlework | Dunno |
00:34:26 | EXetoC | nm |
00:34:34 | superfunc | You mean default implementation for a trait? |
00:34:38 | ldlework | superfunc: yeah |
00:34:43 | EXetoC | oop? traits? |
00:34:50 | EXetoC | haven't seen such a lib. when was that? |
00:35:08 | superfunc | A trait is essentially an interface in C++, so it has a way to do a default implementation |
00:35:25 | ldlework | last post on this page, http://forum.nimrod-lang.org/t/278/2 |
00:35:27 | ldlework | EXetoC: ^ |
00:35:55 | ldlework | Basically I'm going to try to build a simple finite state machine |
00:36:21 | Araq | finite state machine = closure iterator |
00:36:24 | ldlework | And I'm wondering how to model it. Should I use typeclasses? Well then I don't get any default behavior for the states. |
00:36:32 | ldlework | Then I could use inheritance |
00:36:32 | Araq | or a 'case' statement |
00:37:01 | Araq | nobody who hasn't lost his mind models state machines with inheritance |
00:37:25 | ldlework | Araq: I don't want to use inheritance from the user perspective of the library |
00:37:35 | ldlework | just provide a base class which some book-keeping functionality built in |
00:37:41 | * | Trustable quit (Quit: Leaving) |
00:37:47 | ldlework | and you inherit from that and override one or two methods |
00:38:36 | Araq | yeah I've heard that before |
00:38:46 | Araq | did that ever work? :P |
00:38:58 | ldlework | Sure, I've used that pattern for many years in Python |
00:39:35 | Araq | so the answer is 'no' |
00:40:07 | * | ldlework shrugs |
00:55:20 | EXetoC | ldlework: I should've patched the existing lib though |
00:56:02 | EXetoC | he seems to be using int sometimes when it should be cint |
00:57:36 | * | wire_s joined #nimrod |
00:57:58 | ldlework | EXetoC: We never know if that guy is ever going to maintain that thing |
00:58:02 | ldlework | So I'm glad you made a new one |
00:58:25 | Araq | hi wire_s welcome |
00:59:09 | ldlework | Hmm, I can't have a generic type as a struct attribute type? |
00:59:12 | EXetoC | it's easy to fork it |
01:00:03 | ldlework | My Game type should have a 'state' field, but it could be any one of the types satisfying GameState typeclass |
01:00:06 | ldlework | how do I model that? |
01:00:08 | Araq | generic doesn't do what you think it does, I think |
01:00:32 | Araq | well you can use "object of GameState" aka inheritance |
01:01:39 | Araq | but usually a closure is the better design |
01:02:08 | EXetoC | ldlework: do I call this nim-libtcod2 then? |
01:02:20 | Araq | it's hard to explain though ... :P |
01:02:48 | Araq | your way of thinking about 'state' is completely off IMHO |
01:03:47 | ldlework | Araq: I mean that's fine, but this is how I've written games for a long time |
01:04:02 | ldlework | games that work that don't have some fundamental software design issue that causes them not to execute and perform their duty as a game |
01:04:12 | ldlework | I'm totally fine with hearing a better model for them |
01:05:09 | ldlework | Having an object, which has some field which acts as a delegate for some functionality, which you can change to change the behavior is a pretty standard pattern |
01:06:26 | Araq | http://nimrod-lang.org/manual.html#first-class-iterators not sure if it fits your use case though |
01:06:39 | Araq | checkout the "simple tasking" example |
01:09:07 | ldlework | Hmm I'm not sure how this solves anything |
01:10:26 | ldlework | Can two types not refer to each other? |
01:11:15 | EXetoC | put them in the same type block |
01:11:33 | ldlework | I tried that |
01:11:35 | EXetoC | cant refer to eachother by value though |
01:11:42 | ldlework | Error: illegal recursion in type 'BaseState' |
01:11:47 | EXetoC | because you then have infinite recursion |
01:11:59 | EXetoC | you might want 'ref' |
01:12:01 | ldlework | EXetoC: meaning one has to go through a pointer? |
01:12:09 | ldlework | ah that makes sense |
01:12:35 | * | will quit (Remote host closed the connection) |
01:15:26 | ldlework | Error: inheritance only works with non-final objects |
01:16:01 | Araq | the language hates you, so you have to use "object of RootObj" |
01:16:11 | ldlework | ah okay |
01:16:19 | Araq | to make the object non-final |
01:20:36 | ldlework | I have StaticState derriving from BaseState which is defined with "game: ref Game" however I cannot do "var state = StaticState(game: addr(game))" |
01:20:45 | ldlework | I get, Error: undeclared field: 'game' |
01:20:57 | ldlework | Is the inherited fields from BaseState not exposed somehow |
01:21:18 | ldlework | oh right need the * |
01:23:32 | Araq | also if you use 'addr game', you should use 'ptr Game', not 'ref Game' |
01:23:45 | Araq | and you better not allocate 'game' on the stack then |
01:23:51 | ldlework | type mismatch: got (Game) but expected 'ref Game' |
01:23:59 | ldlework | how do I take a ref of Game if the param is defined as ref Game |
01:24:10 | Araq | see above |
01:24:31 | ldlework | addr Game gives me a ptr as you say |
01:24:33 | Araq | 'ref' means you new'ed it |
01:24:46 | Araq | you didn't 'new' it, there is no way to get a 'ref' to it |
01:24:53 | ldlework | I did var game = Game() |
01:24:55 | ldlework | ah |
01:29:10 | ldlework | Araq: do you have to do anything special to override a base type's method? |
01:29:25 | ldlework | I have a draw defined for StaticState, but BaseState's implementation is called |
01:29:27 | ldlework | oh |
01:29:31 | ldlework | because I'm taking BaseState |
01:29:36 | ldlework | do I have to... cast it? |
01:29:36 | Araq | well it needs to be a 'method' to begin with |
01:29:40 | ldlework | oh |
01:29:51 | * | Matthias247 quit (Read error: Connection reset by peer) |
01:30:22 | ldlework | hmm still calls the parent type's implementation |
01:30:45 | Araq | are you on devel? |
01:30:47 | ldlework | Araq: is it because I have the type specified as BaseState, so even if I pass a StaticState (a subclass), it uses the BaseState impelmentation? |
01:30:50 | ldlework | Araq: yeah |
01:31:41 | ldlework | Maybe I need to define a typeclass for these state types |
01:31:46 | Araq | no |
01:31:51 | ldlework | hmm but you can't specify a typeclass as a field |
01:31:58 | Araq | don't use a typeclass |
01:32:04 | ldlework | ok |
01:32:10 | Araq | you don't know what a typeclass is, don't use it |
01:32:26 | ldlework | pretty sure its an interface contract of sorts |
01:32:35 | ldlework | defining what can be done to a type that satisfies the typeclass |
01:33:10 | Araq | the thing is |
01:33:36 | Araq | what you are doing, is you slice the object because you don't use 'ref object' |
01:33:56 | Araq | and so it ends up calling the base, because that's what it is |
01:34:14 | Araq | use 'ref object' with inheritance |
01:34:54 | ldlework | Where am I typing "ref object", on my Game type that currently has a field "state: BaseState" ? |
01:35:32 | Araq | make that 'state: ref BaseState' |
01:37:18 | ldlework | Then, how do I pass a ref of that after instantiating it like "var state = StaticState(game: addr game)" |
01:37:22 | * | johnsoft joined #nimrod |
01:37:31 | ldlework | I need to call "game.init( ... )" and pass the ref BaseState to that |
01:39:25 | ldlework | Yeah not sure how to pass a ref |
01:39:50 | EXetoC | new(T) or new(your ref var) |
01:40:54 | ldlework | EXetoC: when you initailze it like that, how do you initialize the fields? |
01:40:56 | EXetoC | the former returns a 'ref T' of course. see the documentation for system |
01:41:44 | EXetoC | var x = new(T); x.y = ... |
01:42:18 | ldlework | I see |
01:42:21 | ldlework | That worked |
01:42:50 | EXetoC | var x = (ref T)(field1: 1, ...) |
01:43:59 | ldlework | not sure which I like better |
01:44:20 | ldlework | Is there a live nim pastebin thing yet? |
01:47:21 | Araq | EXetoC: does (ref T)(field ...) work? |
01:47:37 | Araq | cause I think the testsuite is still missing it |
01:48:09 | EXetoC | yes |
01:48:17 | Araq | yay |
01:48:41 | EXetoC | I think I had to use #!strongSpaces for it to work before |
01:48:54 | Araq | that makes no sense |
01:49:21 | EXetoC | I know I had to change some option |
01:49:28 | EXetoC | whatever |
01:49:35 | ldlework | It worked for me without any change |
01:49:48 | EXetoC | yep |
01:50:10 | * | bjz quit (Read error: Connection reset by peer) |
01:50:29 | * | bjz joined #nimrod |
01:50:47 | * | irrequietus quit () |
01:52:24 | * | AFKMorpork is now known as AMorpork |
01:53:59 | Araq | good night |
01:54:51 | ldlework | How to deref a ptr? |
01:55:38 | EXetoC | [] |
01:56:41 | NimBot | Araq/Nimrod devel a1c217a Araq [+1 ±1 -0]: fixes #1684 |
01:56:47 | Araq | good night |
01:57:04 | EXetoC | later! |
01:57:50 | ldlework | EXetoC: if I have my type has a ref to State and I create it like, var worker = Worker(), what is that reference set to right now? |
01:58:41 | EXetoC | it will be nil (pointing to 0) |
02:05:04 | * | wire_s left #nimrod ("WeeChat 1.0.1") |
02:07:23 | * | BitPuffin quit (Ping timeout: 240 seconds) |
02:27:57 | ldlework | EXetoC: so is it just that ref is a GC'd pointer and ptr is an unmanaged one? |
02:28:10 | ldlework | (hence why you said 'better not be on the stack') |
02:29:14 | EXetoC | that wasn't me, but yes |
02:29:53 | * | darkf joined #nimrod |
02:30:37 | * | superfunc quit (Ping timeout: 246 seconds) |
02:33:25 | ldlework | EXetoC: I'm just instantiating it like "var worker = Worker()" and then using "addr worker" |
02:33:33 | ldlework | Is my Worker on the stack or heap |
02:34:41 | ldlework | Also, when I have an overridden method in a subclass how can I call the parent implementation? |
02:36:12 | EXetoC | you don't want GC allocation? |
02:36:19 | EXetoC | only the former is relevant, and it will be on the stack |
02:36:43 | EXetoC | assuming that Worker is 'object' and not 'ptr object' for example |
02:36:50 | ldlework | It is |
02:36:57 | ldlework | So 'ptr object' is how to get it onto the heap? |
02:37:10 | ldlework | (I don't want it on the heap I'm just wondering) |
02:37:50 | EXetoC | that's just a shortcut |
02:38:13 | EXetoC | for 'ptr Worker' |
02:38:28 | ldlework | Okay I converted worker over to use a ref |
02:39:01 | ldlework | EXetoC: minimal example thing, https://gist.github.com/412faf911e29e9dbf768 |
02:39:15 | ldlework | o/ |
02:39:28 | EXetoC | I've barely used inheritance. maybe you need to cast: cast[Base](obj) |
02:39:49 | EXetoC | ref Base? |
03:03:09 | * | EXetoC quit (Ping timeout: 264 seconds) |
03:05:43 | * | flaviu quit (Ping timeout: 258 seconds) |
03:12:43 | * | perturbation quit (Quit: Leaving) |
04:08:22 | * | flaviu joined #nimrod |
04:12:05 | * | q66 quit (Quit: Leaving) |
05:51:55 | * | untitaker quit (Ping timeout: 272 seconds) |
05:57:50 | * | untitaker joined #nimrod |
05:59:21 | * | shodan45 quit (Quit: Konversation terminated!) |
06:11:51 | dts | is there something in the standard nimrod library that would allow line 8? http://paste.ubuntu.com/9309992/ |
06:17:24 | * | milosn joined #nimrod |
07:13:13 | * | gour joined #nimrod |
08:28:02 | gokr | ldlework: Read my OO articles. You normally use "ref object" not pr. |
08:28:04 | gokr | ptr. |
08:28:23 | ldlework | Thanks |
08:33:42 | gokr | http://goran.krampe.se/category/nim |
08:33:56 | gokr | Also, the super call issue has been solved in devel - but I haven't had time to write a followup. |
08:34:23 | gokr | I mention Andreas intending to implement "static_call" - and he has done so, but its called "procCall". Works as I describe in the article though. |
08:57:56 | * | kapil__ joined #nimrod |
09:07:33 | * | milosn quit (Remote host closed the connection) |
09:39:44 | Araq | dts: no |
09:40:04 | dts | damn |
09:40:26 | Araq | use this instead: |
09:40:28 | gokr | dts: Thing is, "lines" is an iterator. You don't really know when its going to end. |
09:40:43 | Araq | if result.len == 0: result.add "\n" |
09:40:48 | Araq | result.add line |
09:40:48 | gokr | Since you don't know the number of lines in a file, until you have read them all. |
09:41:10 | Araq | but there is also some readAll that already implements what you're after |
09:41:11 | * | milosn joined #nimrod |
09:41:13 | gokr | Yeah, Araq is simply moving the "\n" to be done "before next line" instead of "after each line" |
09:41:30 | * | BlaXpirit joined #nimrod |
09:41:50 | * | gokr going back to carrying dinner table... |
09:42:20 | dts | gokr, yeah good point. im just used to c++ where iterators have a known end |
09:42:39 | dts | Araq, thanks! |
10:00:19 | * | Matthias247 joined #nimrod |
10:03:02 | * | dts is now known as usandenemies |
10:03:17 | * | usandenemies is now known as dts |
10:13:08 | * | gour quit (Quit: Konversation terminated!) |
10:15:50 | * | gour joined #nimrod |
10:26:24 | * | gour_ joined #nimrod |
10:29:43 | * | gour quit (Ping timeout: 258 seconds) |
10:29:57 | * | gour_ is now known as gour |
10:42:40 | * | Matthias247 quit (Read error: Connection reset by peer) |
10:43:46 | * | gokr quit (Quit: Leaving.) |
10:55:38 | * | gokr joined #nimrod |
10:55:57 | * | gokr_ quit (Ping timeout: 240 seconds) |
11:03:43 | * | BitPuffin joined #nimrod |
11:04:39 | * | EXetoC joined #nimrod |
11:32:50 | * | gokr1 joined #nimrod |
11:44:23 | * | Pisuke quit (Ping timeout: 240 seconds) |
12:24:57 | * | gokr1 quit (Ping timeout: 240 seconds) |
12:35:17 | * | Jesin quit (Quit: Leaving) |
13:08:57 | * | gokr_ joined #nimrod |
13:11:00 | * | gokr quit (Ping timeout: 258 seconds) |
13:16:18 | * | flaviu quit (Remote host closed the connection) |
13:16:39 | * | flaviu joined #nimrod |
13:18:29 | * | wan quit (Quit: WeeChat 1.0.1) |
13:23:24 | * | gokr joined #nimrod |
13:35:54 | * | BitPuffin quit (Ping timeout: 250 seconds) |
13:38:30 | * | EXetoC quit (Ping timeout: 250 seconds) |
13:38:30 | * | gokr_ quit (Read error: Connection reset by peer) |
13:39:09 | * | gokr_ joined #nimrod |
13:43:57 | * | bjz quit (Read error: Connection reset by peer) |
13:44:03 | * | bjz_ joined #nimrod |
13:49:38 | * | gokr_ quit (Remote host closed the connection) |
13:54:04 | * | EXetoC joined #nimrod |
13:58:52 | * | Pisuke joined #nimrod |
13:59:28 | * | milosn quit (Quit: Lost terminal) |
14:07:23 | * | EXetoC quit (Ping timeout: 240 seconds) |
14:14:53 | * | johnsoft quit (Ping timeout: 245 seconds) |
14:16:03 | * | johnsoft joined #nimrod |
14:18:31 | * | gokr_ joined #nimrod |
14:36:52 | * | gokr_ quit (Read error: Connection reset by peer) |
14:37:50 | * | gokr_ joined #nimrod |
14:49:32 | * | q66 joined #nimrod |
15:11:23 | * | kapil__ quit (Quit: Connection closed for inactivity) |
15:22:48 | * | darkf quit (Quit: Leaving) |
15:27:15 | * | flaviu quit (Remote host closed the connection) |
15:27:54 | * | yeye123 joined #nimrod |
15:32:29 | yeye123 | hi everyone, whats the best library for getting some gui up and running with nimrod in a "short" time, I would like to try the language out, but I like to tinker with gui, thanks for helping out |
15:33:11 | BlaXpirit | there aren't many options |
15:33:20 | BlaXpirit | gtk is the only one, or one of the very few |
15:33:47 | yeye123 | ok |
15:37:15 | yeye123 | so I need to install babel package manager and i'm all set? |
15:41:07 | BlaXpirit | i don't know :| |
15:41:15 | * | gour quit (Quit: Konversation terminated!) |
15:41:40 | BlaXpirit | i just ignore gtk's existence |
15:42:16 | * | vendethiel joined #nimrod |
15:43:12 | * | BitPuffin joined #nimrod |
15:43:43 | yeye123 | so then theres no usable gui library for this language, what a shame... |
15:44:03 | * | gour joined #nimrod |
15:49:56 | BlaXpirit | well it's still probaby the 2nd best GUI library |
15:50:07 | BlaXpirit | maaaybe 3rd |
15:52:25 | yeye123 | so what is numer 1 |
15:53:00 | BlaXpirit | this is subjective and off-topic |
15:53:09 | BlaXpirit | but |
15:53:10 | BlaXpirit | Qt |
15:54:48 | yeye123 | is there any tutorial for a simple gui program? |
15:54:57 | * | flaviu joined #nimrod |
15:55:32 | * | j3rky joined #nimrod |
16:03:04 | * | strangelove joined #nimrod |
16:03:27 | strangelove | yeye123: see https://github.com/nim-lang/gtk2/tree/master/examples for some gui examples |
16:04:01 | strangelove | yeye123: some geezer is also making a gtk3 wrapper |
16:04:52 | yeye123 | thanks |
16:09:23 | * | strangelove quit (Quit: Page closed) |
16:11:13 | * | flaviu quit (Quit: Leaving.) |
16:11:22 | * | flaviu joined #nimrod |
16:21:14 | * | xcombelle joined #nimrod |
16:28:06 | * | Demos joined #nimrod |
16:31:37 | * | gokr_ quit (Ping timeout: 240 seconds) |
16:32:14 | * | gokr_ joined #nimrod |
16:46:44 | yeye123 | examples/ex1.nim(2, 2) Error: cannot open 'glib2' <-- sorry for newbie question, anything special i have to do to make the gtk2 examples run? |
16:47:34 | * | geezer joined #nimrod |
16:49:59 | geezer | BlaXpirit wrote; i just ignore gtk's existence |
16:50:20 | geezer | Yes, not all is really fine for GTK+ ... |
16:51:50 | geezer | BlaXpirit: how long will it take you to finish your great Nim Qt wrapper? |
16:52:06 | BlaXpirit | ∞ |
16:52:29 | BlaXpirit | I'm distantiating from Nim anyway |
16:54:30 | yeye123 | import glib2 where does it have to reside |
16:56:02 | yeye123 | same goes for sdl |
16:56:20 | geezer | yeye123: for testing gtk2 you may install aporia, it is a good example. |
16:57:00 | yeye123 | geezer: thanks, i was trying to run the gtk2 examples |
16:57:19 | * | EXetoC joined #nimrod |
16:59:07 | geezer | For final GTK3 we will to have to wait at least some weeks still, a preliminary version is available, see the Forum. But unfortunately no examples yet, sorry. |
16:59:46 | yeye123 | thats ok, i guess i have some issues with nim not finding my libraries through the import statement? |
17:01:01 | yeye123 | how do i tell nim where to find these? |
17:01:04 | geezer | For me the small Gtk2 examples worked after I installed aporia in summer. |
17:01:11 | yeye123 | ok |
17:03:42 | geezer | geezer is now known as Salewski again. |
17:03:45 | * | geezer quit () |
17:04:50 | * | gokr_ quit (Ping timeout: 258 seconds) |
17:08:45 | * | Matthias247 joined #nimrod |
17:11:21 | * | dom96_ quit (Ping timeout: 258 seconds) |
17:13:02 | * | j3rky quit (Quit: Konversation terminated!) |
17:15:25 | yeye123 | ok, i guess it was a bit heavy getting started in nim, does anyone know of a similar language that i easier getting started in? |
17:22:18 | * | wan joined #nimrod |
17:24:49 | * | dom96_ joined #nimrod |
17:25:38 | * | will joined #nimrod |
17:27:33 | will | yeye123: you still struggling to get gtk2 working? afaik you need to install glib2 with nimble and install the gtk2 libs with your package manager |
17:33:12 | EXetoC | there's no glib package, but it's included in the gtk2 package |
17:46:34 | gour | it seems that 13.2 can0t boot if the root and boot are under lvm2? |
17:46:48 | gour | ahh, wrong channel |
18:01:47 | * | milosn joined #nimrod |
18:13:57 | * | BitPuffin quit (Ping timeout: 264 seconds) |
18:23:44 | * | BitPuffin joined #nimrod |
18:42:30 | * | yeye123 quit (Quit: Leaving) |
18:54:46 | * | AMorpork is now known as AFKMorpork |
18:58:39 | EXetoC | was the behavior of ranges modified recently? |
19:03:21 | EXetoC | no, something else is going on |
19:05:40 | * | dts quit (Ping timeout: 250 seconds) |
19:08:43 | * | irrequietus joined #nimrod |
19:30:39 | flaviu | Something like python's `enumerate()` seems like a better solution than having `pairs()` for each iterable data type |
19:31:22 | * | gokr_ joined #nimrod |
19:33:24 | EXetoC | it might not be feasible yet |
19:34:27 | flaviu | EXetoC: Not at this moment, no. But I just reported the bug that prevents it. |
19:35:11 | EXetoC | I've only tried to pass 'iterator' |
19:35:50 | EXetoC | *specify |
19:42:47 | * | yeye123 joined #nimrod |
19:43:24 | * | perturbation joined #nimrod |
19:52:56 | * | yeye123 quit (Quit: Leaving) |
19:58:48 | flaviu | Is there a way to transform a PNimrodNode into the original source? |
20:00:41 | * | BitPuffin quit (Read error: Connection reset by peer) |
20:00:47 | flaviu | `repr` seems to do that, ok |
20:03:19 | * | BitPuffin joined #nimrod |
20:03:57 | * | srlang joined #nimrod |
20:05:06 | * | dts joined #nimrod |
20:10:23 | flaviu | lib/core/macros.nim(278, 10) Error: undeclared identifier: 'Node' |
20:10:38 | flaviu | But line 278 is a comment, wtf? |
20:11:59 | flaviu | The compiler blamed macros.nim for my broken AST output, weird |
20:19:43 | gokr | Evening folks |
20:20:04 | flaviu | hey gokr |
20:20:14 | gokr | Hey :) |
20:23:24 | dts | whats the type of stdin? |
20:24:06 | flaviu | dts: TFile, http://nimrod-lang.org/system.html#stdin |
20:24:11 | dts | ty |
20:24:33 | gokr | Although its "File" in devel. |
20:24:48 | gokr | We are dropping the Ts. |
20:26:46 | * | Trustable joined #nimrod |
20:29:34 | * | srlang quit (Ping timeout: 264 seconds) |
20:32:22 | dts | is there a function for the string type to get the length of it? |
20:32:31 | dts | other than something like this: |
20:32:57 | flaviu | `myString.len`, `len(myString)` are both valid. |
20:33:07 | dts | ok ty |
20:33:09 | * | johnsoft quit (Ping timeout: 264 seconds) |
20:33:57 | * | johnsoft joined #nimrod |
20:35:30 | * | dom96_ quit (Ping timeout: 244 seconds) |
20:38:28 | flaviu | https://gist.github.com/flaviut/53b7f1928c944c010605 if anyone is intersted |
20:41:42 | gokr | flaviu: Daft question: what is it for? |
20:42:19 | flaviu | gokr: It's sugar for creating classes with inheritance |
20:42:37 | flaviu | Like Scala case classes, but less sophisticated ATM |
20:42:38 | gokr | yes, i got that... but... what does it offer compared to the regular style? |
20:42:53 | flaviu | It's more compact syntax |
20:42:57 | gokr | ok :) |
20:43:26 | flaviu | I plan on defining lots of these, so it's much preferable to do it like this than over hundreds of lines. |
20:43:48 | flaviu | And I'll eventually modify the macro to do equality and pretty-printing. |
20:45:05 | gokr | Some mixin support? |
20:45:32 | dts | are blocks like c++ namespaces? |
20:45:40 | dts | or rather |
20:45:44 | flaviu | Nope, blocks are like `{}` |
20:45:46 | dts | unnamed namespaces? |
20:45:54 | dts | oh ok... that makes sense |
20:46:29 | flaviu | `void foo() { int a; { int a; a++; } }` |
20:47:01 | * | vendethiel- joined #nimrod |
20:47:23 | flaviu | gokr: unlikely, it seems like lots more work, and my application doesn't really need it. |
20:48:07 | gokr | Just think Nim needs relatively soon to get a "default OO package". So that there aren't too many experiments around "regular OO" stuff. |
20:48:17 | gokr | I would hate Nim to go the js route. |
20:48:25 | * | vendethiel quit (Ping timeout: 252 seconds) |
20:48:33 | gokr | (everyone invents their own style of OO) |
20:48:39 | * | dom96_ joined #nimrod |
20:51:21 | * | matkuki joined #nimrod |
20:51:40 | dts | so one could use break and block [label] as goto couldnt they? |
20:51:56 | dts | ewiat no never mind |
20:56:10 | * | Pisuke quit (Ping timeout: 244 seconds) |
20:58:57 | ldlework | gokr: +1 |
21:02:54 | ldlework | flaviu: can you write a small example using your classes? |
21:03:02 | ldlework | Like animal->cat/dog something simple |
21:05:30 | flaviu | ldlework: The first comment was supposed to do that, but I changed it to the Animal example you suggested. |
21:06:09 | ldlework | flaviu: so in your macro methods/member procs are provided the normal way |
21:06:18 | * | superfunc joined #nimrod |
21:06:22 | flaviu | Yep. It just shortens the declarations. |
21:06:27 | ldlework | the macro is only defining the type/inheritance |
21:06:29 | ldlework | I see |
21:06:45 | flaviu | I plan on doing equality and pretty printing some time |
21:07:05 | ldlework | flaviu: do the classes have to be on one line like that? |
21:07:29 | ldlework | I don't know how fickle the macros are |
21:07:39 | flaviu | But I don't need it at this moment, so it's not implemented yet. |
21:07:40 | flaviu | ldlework: Nope, as long as a parses to the same thing |
21:07:45 | ldlework | makes sense |
21:07:55 | EXetoC | ooooop |
21:08:18 | flaviu | But as I noted, you can't omit the types. eg, Foo(Base)(field1, field2: string) is invalid. |
21:13:44 | ldlework | flaviu: you should just create a straight up mixin system |
21:14:02 | ldlework | with explicit conflict resolution :) |
21:14:04 | ldlework | kthx |
21:15:04 | flaviu | ldlework: To be honest, I'm not sure what a mixin system is |
21:16:31 | ldlework | flaviu: I'm thinking like, stateful traits |
21:16:51 | ldlework | Basically partial classes, where the composing class must explicitly resolve any naming collisions |
21:18:17 | flaviu | Maybe if I find myself bored one day, I'll look at it. |
21:19:55 | matkuki | Is there a list type that can be accessed by index in Nimrod? |
21:20:35 | flaviu | matkuki: seq[T] isn't a linked list, but it's a variable size array. |
21:20:56 | matkuki | flaviu: thanks |
21:21:09 | * | gokr should get my article on seq out... |
21:21:12 | flaviu | if you know the size at compile-time, you can use an array |
21:21:40 | gokr | matkuki: seq is the "work horse" collection in Nim I would say. A dynamic array basically. |
21:22:03 | gokr | ldlework: There is also that macro for OOP on the nimbyexample page |
21:22:29 | gokr | http://nimrod-by-example.github.io/oop_macro/ |
21:22:34 | matkuki | gokr: is it a builtin or in a library? |
21:22:47 | flaviu | matkuki: Builtin |
21:22:50 | gokr | seq is in system.nim so its "builtin" |
21:23:03 | matkuki | thanks |
21:23:41 | gokr | matkuki: http://nimrod-lang.org/manual.html#array-and-sequence-types |
21:24:07 | matkuki | gokr: was just looking at it :) |
21:24:30 | gokr | One "issue" with Nim is that since it has grown up as an imperative language - a full description of what you can do with each type is typicall a bit "spread out". |
21:24:40 | flaviu | Not everything in system.nim is a builtin. |
21:24:48 | gokr | Which is why I started hunting down all stuff about seq :) |
21:24:55 | gokr | But haven't finished that article yet. |
21:24:58 | flaviu | I would only consider the things that are magic builtin. |
21:25:09 | * | dom96_ quit (Ping timeout: 265 seconds) |
21:25:31 | gokr | flaviu: That's why I used "" |
21:26:07 | * | xcombelle quit (Ping timeout: 265 seconds) |
21:29:43 | * | gour quit (Quit: Konversation terminated!) |
21:30:20 | * | milosn quit (Remote host closed the connection) |
21:42:53 | * | Trustable quit (Quit: Leaving) |
21:45:14 | Araq | flaviu: yeah, magic == builtin |
21:45:22 | Araq | there is no other sane definition |
21:47:13 | EXetoC | seqs. I don't know about that abbreviation |
21:48:09 | EXetoC | flaviu: anyway, it would be a good idea to use the term 'sequence' at least once |
21:48:40 | flaviu | EXetoC: In Nim-by-example? |
21:48:55 | EXetoC | yes |
21:57:24 | EXetoC | and isn't that comment about "value semantics" unrelated to mutability? |
22:00:01 | flaviu | EXetoC: Thanks, that is confusing. I'll fix it. |
22:07:12 | gokr | Ok, spat out a fourth article on OO (procCall): http://goran.krampe.se/2014/11/30/nim-and-oo-part-iv |
22:09:34 | * | flaviu quit (Read error: Connection reset by peer) |
22:09:38 | * | flaviu1 joined #nimrod |
22:10:36 | Araq | gokr: nice! |
22:10:47 | gokr | thanks |
22:11:21 | * | irrequietus quit () |
22:11:55 | NimBot | Araq/Nimrod devel 866ce10 Araq [+0 ±1 -0]: fixes #1687 |
22:12:16 | Araq | in case you wonder why some bugfixes don't get a test case |
22:14:48 | Araq | the reason is simply that I estimate the likehood of the bug ever showing up again |
22:15:15 | Araq | and if it's too small, I might decide it's not worth bloating up the test suite |
22:18:57 | * | dts quit (Ping timeout: 240 seconds) |
22:22:38 | * | superfun1 joined #nimrod |
22:23:34 | * | j3rky joined #nimrod |
22:33:40 | * | johnsoft quit (Ping timeout: 250 seconds) |
22:33:47 | * | johnsoft joined #nimrod |
22:41:14 | * | matkuki quit (Quit: ChatZilla 0.9.91 [Firefox 33.1/20141106120505]) |
23:04:48 | flaviu1 | :/ |
23:04:57 | * | flaviu1 is now known as flaviu |
23:05:28 | flaviu | I don't really like that, isn't most the test suite slowness from a few tests? |
23:07:08 | flaviu | gokr: I found some issues with the line numbers around "As we can see the “syntactic..." |
23:14:06 | flaviu | procCall is interesting solution, I don't think I've seen it before |
23:16:37 | * | superfunc quit (Ping timeout: 246 seconds) |
23:17:01 | EXetoC | what was it again? |
23:19:25 | flaviu | EXetoC: Like super, but more powerful |
23:19:30 | flaviu | http://goran.krampe.se/2014/11/30/nim-and-oo-part-iv/ |
23:20:22 | flaviu | gokr: Another typo to report, "at least all procs _unless_ the concat", in http://goran.krampe.se/2014/11/03/squeak-to-nim/ |
23:36:50 | * | BlaXpirit quit (Quit: Quit Konversation) |
23:38:53 | * | boydgreenfield joined #nimrod |
23:53:28 | * | dom96_ joined #nimrod |