=== AStorm [n=astralst@host-81-190-179-124.gorzow.mm.pl] has joined #upstart === Amaranth [n=travis@ubuntu/member/Amaranth] has joined #upstart === Md [i=md@freenode/staff/md] has joined #upstart === Amaranth [n=travis@ubuntu/member/Amaranth] has joined #upstart === Keybuk [n=scott@quest.netsplit.com] has joined #upstart [01:44] <_ion> Sigh, doing anything in a virtual machine is simply too slow on this computer. [01:44] <_ion> It probably takes a minute just to finish the initramfs script. :-) [01:45] <_ion> I guess i'll have to hack on replacement-initscripts on this computer directly. [01:59] heh === Keybuk just hacks directly === AStorm [n=astralst@host-81-190-179-124.gorzow.mm.pl] has joined #upstart === j_ack [n=rudi@p508DBB02.dip0.t-ipconnect.de] has joined #upstart [04:19] <_ion> (offtopic: http://johan.kiviniemi.name/blag/2007/02/16/monitorcalc/) [04:58] you really do like ruby, don't you? :p === mbiebl [n=michael@e180072138.adsl.alicedsl.de] has joined #upstart [06:07] <_ion> It's not perfect, but i haven't found any better ones yet. :-) === AStorm [n=astralst@host-81-190-179-124.gorzow.mm.pl] has joined #upstart [06:25] what for though? [06:26] a language can never be perfect for everything [06:26] only perfect for something [06:26] what is ruby's task? [06:27] Theoretically, network programming and Perl's place [06:27] Ruby = better Perl [06:27] so ruby has regular expressions as a first class object? [06:28] As a language construct, you meant? Yes. [06:28] And an object too. [06:28] but then, it isn't all that useful :P [06:28] what does a ruby program that returns all lines from a file matching a regular expression look like? [06:28] Beats me. I don't program in Ruby. [06:28] it would surprise me if it's as good at parsing as Perl is [06:29] Why not? [06:29] since Perl does that so well, at the expense of other langauge niceties [06:29] Anything is as good at parsing as perl. [06:29] eh? [06:29] Though the syntax might be bulkier a bit. [06:29] the syntax is everything [06:29] and the speed at which it can do it [06:29] Nothing at all. [06:29] Speed, yes, that matters. [06:29] you could write a program to extract data from files and generate a report in C... [06:29] ...you just wouldn't [06:29] you would always use Perl [06:30] No, because it doesn't have any good regexp library. [06:30] I would use Python personally. [06:30] of course it does [06:30] Python isn't good at this kind of thing [06:30] pcre you mean [06:30] It is _very_ good [06:30] no, it's quite bad [06:30] if you don't mind re.match("WHATEVER") [06:30] Instead of ~= [06:30] which tends to suck, yes [06:30] It has splitting and other things too. [06:31] while (<>) { [06:31] print $1 if /[a-z] ([0-9] +)/gi; [06:31] } [06:31] -- [06:31] what's the Python equivalent of that? [06:31] for line in stdin: ... [06:31] no, [06:31] not stdin [06:32] for line in stdin: x = re.match("[a-z] ([0-9+)"); if x: print x.groups(1) [06:32] BZZT [06:32] What is that <> thingy? [06:32] Some variable? [06:32] doesn't parse filenames given on the command line in preference to stdin [06:32] doesn't print each number on the line [06:32] and you've tried to bunch it up into one line, which is very bad Python [06:32] Yep [06:32] It's IRCy Python [06:32] :P [06:33] It would probably take 5 lines to do exact the same thing as in Perl. [06:33] Which I don't know. [06:33] I've reached 30 lines so far ... [06:33] :P [06:33] What does that thing means actually? [06:33] *mean === Amaranth [n=travis@ubuntu/member/Amaranth] has joined #upstart [06:33] whatever you want it to mean [06:34] That <> [06:34] the point is that Perl is *VERY* good at extracting information out of files and generating data sets from it [06:34] extraordinarly good [06:34] Well, yep. [06:34] <> is "each line for each file listed on the command line, or stdin" [06:34] Aha. [06:34] That'll be 7 lines of Python [06:34] :P [06:34] One for more [06:34] no, it's still not 7 lines of python [06:34] and two imports [06:34] Ok, 8, miscalculated. [06:35] :P [06:35] two imports? [06:35] Yep. [06:35] oh, right, re [06:36] Heh, one less even. [06:36] http://docs.python.org/lib/module-fileinput.html [06:36] :P [06:36] That's what Perl does with that <>, isn't it? [06:37] yes [06:37] you still can't get anything legible [06:37] You can do even better with Python 2.5 [06:37] print x.groups(1) if x [06:38] s/if/when/ [06:38] print x.groups(1) when x [06:38] or even.. in older Python... [06:38] still not x.groups(1) I'm afraid [06:38] It is. [06:38] no [06:38] Perl will print all matches in the line [06:38] because I used /g [06:38] x is an instance of a matchobjects. [06:39] Aha, one missing flag. [06:39] (python doesn't have this flag ) [06:39] re.GLOBAL [06:39] AttributeError: 'module' object has no attribute 'GLOBAL' [06:39] Oh yes it does :P [06:39] re.findall [06:39] no [06:39] re.finditer [06:39] right, that's not a flag [06:40] import re [06:40] import fileinput [06:40] RE = re.compile(r'[a-z] ([0-9] +)', re.IGNORECASE) [06:40] if __name__ == "__main__": [06:40] for line in fileinput.input() [06:40] for number in line.findall(): [06:40] print number [06:40] is the equivalent Python [06:40] Yep. [06:40] which is infintely less useful than the Perl [06:40] ergo. at parsing, Perl wins [06:40] But you don't have to compile :P [06:40] you do bloody well have to compile [06:40] this file is 2GB! [06:40] No, you don't. [06:40] compiling that regexp every time will run slow as a dog [06:40] 100 latest matches are buffered. [06:40] NO. [06:40] actually [06:40] heh [06:40] Python won't compile it every time. [06:40] Python can't parse that file [06:40] it ENOMEM'd :p [06:41] Perl took under a second [06:41] and used only a few 100K [06:41] Because you used findall [06:41] and not finditer [06:41] :P [06:41] ok [06:41] finditer still running [06:41] Heh. And here I am, a C# user. [06:41] The bane of all of you! [06:41] finditer still running === Keybuk kills it [06:41] Perl wins [06:42] I'm not saying Python is bad, Python is very good at certain things [06:42] it just does emphatically not beat Perl at being a parsing/extraction language [06:42] Why? My 2GB file took actually... like 10s [06:42] Probably not :P [06:42] 10s is well over 10 times longer than Perl [06:42] It's a general purpose language, hell. [06:42] there's no such thing [06:42] no language is ever general purpose [06:43] Eh... [06:43] every single one ends up specialising in being able to do one thing well [06:43] whether deliberately or not [06:43] It's a language with no special purpose in mind [06:43] other than being easily embedded [06:43] easily embedded => Lua [06:43] so Python loses there [06:43] Yep. [06:44] actually, I know why it did regexp so slow [06:44] one of my major, deep-seated, proto-religious hates is people who use one language for every single task [06:44] Object lookups :P [06:44] especially if that language is PHP :p [06:44] but it applies to any [06:44] PHP is evil, yep. [06:44] Especially due to unreadability :P [06:44] you do not write applications with user interfaces in Perl [06:45] you do not write data parsing and report generation apps in Python [06:45] Oh, right, Python isn't too good at threading too. [06:45] well, PHP is kinda sucky. especially at GUIs [06:45] Well, I do. But then, anyway :P [06:45] But these need a bit of special care in tight loops. [06:45] would you beleive that the package manager in KateOS (a linux distro) is written in PHP [06:45] with PHP-GTK2 [06:45] Esp. putting object lookups outside of them. [06:45] OMFG! [06:45] you don't write *anything* in Java, C++ or PHP [06:46] I'd write it in Haskell, blah :P [06:46] C++ is good if you have a requirement on it. [06:46] AStorm: haskell is good for mathmetical or functional data sets [06:46] I hate C++ :) [06:46] Or have to write low-level code. [06:46] C++ is never good [06:46] C++ is useless for low-level code [06:46] and terrible for object oriented code [06:46] No, it isn't :P [06:46] Java... ugh, bloat. [06:46] low-level => C [06:46] object-oriented => C# or Python [06:46] C++ is good enough for low-level semi-OO code. [06:46] I bet you any low-level C++ code you find is really C mangled by a C++ compiler [06:47] Thought C can do still. [06:47] *though [06:47] Keybuk, uh... tell that to guys liking templates :P [06:47] why the hell would you need templates for low-level code?! :p [06:47] C# requires mono runtime, which is ugh. [06:47] one ioport looks much like another [06:47] C++ requires C++ runtime, which is ugh ugh ugh [06:47] That's why :P [06:48] No, it doesn't. [06:48] yes it does [06:48] It's statically compilable. [06:48] libstdc++ [06:48] ^ [06:48] well [06:48] it is [06:48] but [06:48] you can build the mono runtime into the binary [06:48] that makes your application unnecessarily massive [06:48] Keybuk, yep? Tell me about it. [06:48] AlexExtreme, not that much. [06:48] Linkers are quite smart nowadays. [06:48] mono is statically compilable too heh [06:48] apples to apples [06:48] wasabi, yes, it is [06:49] But it's a large runtime :P [06:49] Linkers are dump [06:49] uh, dumb [06:49] it's not that large... [06:49] Not GNU ld :P [06:49] AStorm: have you *looked* at the size of libstdc++ ?! :p [06:49] Yep. 3MB [06:49] AStorm: GNU ld is dump; it does exactly what you tell it [06:49] AStorm: and the size of mono? :p [06:49] (tip: it's about the same size) [06:49] 36MB runtime [06:49] (count libs in!) [06:49] It's not a 36MB runtime heh. [06:49] You have to only count USED libs heh [06:49] AStorm: no, mono libs include a lot more than libstdc++ [06:50] I can include glibc and gtk+, etc. into the stdc++ calculation, if you like [06:50] it wouldn't win :p [06:50] glibc can't be [06:50] mono uses it too [06:50] :P [06:50] -rw-r--r-- 1 root root 2.4M 2007-02-07 16:57 /usr/lib/libmono.so.0.0.0 [06:50] Unless it's implemented in asm [06:50] So, basic VM is 2.4 MB. [06:50] bbl [06:50] Basic VM is nothing. [06:50] So, count the classes you use. [06:50] wasabi, a lot more [06:50] Which I can't do for you since I don't have a program in bind. === Keybuk wonders how big Python is [06:51] all system classes [06:51] Not all system classes. [06:51] Keybuk, exactly... 2.5MB dll [06:51] If you don't use System.Windows.Forms.dll, you don't need it. [06:51] wasabi, ok, most of them :P [06:51] AStorm: compared to a 3MB so? :p [06:51] Harldy. [06:51] System.Web [06:51] Mono is smaller then [06:51] System.Runtime.Remoting [06:51] System.Security, System.Xml [06:51] System.Data, System.Design [06:51] wasabi, ok, anyway. [06:51] Mono.HalfABillion [06:51] the problem is the mono requirement :P [06:51] what's wrong with Mono? [06:51] Why, again? :0 [06:52] That's why Haskell wins :P === Keybuk likes C# - it's a nice language [06:52] haha [06:52] with a good hereditary too [06:52] Compilable to straight machine code. [06:52] Yes, C# is nice [06:52] you can compile any language straight to machine code [06:52] though from .NET I prefer Nemerle. [06:52] admittedly, some of the higher-level ones like Python are damned tricky to do [06:52] Keybuk, to _standalone_ code (semi-standalone) [06:52] Yep. [06:52] but it's possible [06:53] Haskell compiles to C-- [06:53] But it's *pointless* [06:53] simply because if you couldn't express the language as machine code, you could never run the damned thing [06:53] or optionally to C [06:53] Keybuk, JIT != full static compilation [06:53] a runtime is just pre-packaged machine code for language constructs, after all [06:53] And a JIT :P [06:53] AStorm: I'm not talking about JIT [06:53] Every program we write relies on other services. [06:53] Mono uses JITting a lot [06:53] Mono can pre-JIT. [06:53] wasabi, well, some do more, some less [06:53] if a language can be interpreted, on the fly, then it can be compiled to machine code in advance [06:53] If you really give a shit. [06:54] wasabi, yep, somewhat [06:54] But not NET 2.0 [06:54] Hmm. MS 2.0 can pre-JIT. Don't know about Mono. [06:54] Keybuk, of course. [06:54] if a language cannot be compiled, then ergo, it cannot be interpreted [06:54] you could define a language that was literally impossible to compile [06:54] But writing such a compiler is another matter. [06:54] but then you would also not be able to interpret it [06:54] Heck, you can even compile a subset of special Python [06:55] RPython [06:55] simply because the only way to define an un-compilable language is to design a language that requires the machine to do things that it cannot do [06:55] with the use of PyPy toolchain [06:55] you can compile all of Python [06:55] Python is written in C [06:55] C is compiled [06:55] This argument has no goal anymore. [06:55] Keybuk, gah [06:55] ergo all Python constructs can be expressed as machine code [06:55] so all the compiler need to is take the machine code constructs compiled from the C, and chain them together appropriately [06:55] Yeah right. [06:55] Do that and see the app fail like hell :P [06:55] C# is a valuable language. It does work so I don't have to. It makes my software easier to program. It's pretty elegant as it goes for languages. [06:55] why would it fail? [06:55] Hence. YAY. [06:56] Notice import statement. [06:56] notice that import frequently loads C .so files [06:56] C# is ok for me. [06:56] Keybuk, some, most not :P [06:56] so? [06:56] Anyway, please write the compiler :D [06:56] I'd be grateful. [06:56] I don't want to write the compiler [06:56] There's no compiler, because it's a "damn hard" problem [06:56] if the speed that machine code provides were a requirement, I probably wouldn't write it in Python to start with [06:57] note that hard != impossible [06:57] Yep. [06:57] It's already done for restricted python [06:57] actually, I shouldn't imagine it's even that hard [06:57] (not too restricted) [06:57] there are one or two python constructs that would require some exotic games in machine code [06:57] but nothing too untoward [06:57] wasabi, still, I love some constructs of Nemerle more than C# [06:58] you'd end up with more than a few jumping-point routines [06:58] Yeah. I like that you can use them side by side. ;) [06:58] Well. RPython compiles to straight nice C :P [06:58] I'm really excited by a lot of C# features. [06:59] I think LINQ just totally rocks. [06:59] wasabi, examples, because I'm not completely sold on it [06:59] LINQ: language integrated queries. [06:59] For instance: [06:59] ISet strings = new ISet(); /* add a bunch of strings to strings */ [06:59] Python is just a wannabe-Lisp anyway :p [06:59] wasabi, ahha, nice :P [06:59] Keybuk, indeed, OO Lisp [07:00] eh? [07:00] foreach (string s in (from strings as string where string.StartsWith("f")) { do stuff with s; } [07:00] there's no such thing as OO Lisp or non-OO Lisp [07:00] Object-oriented Lisp [07:00] Lisp is Lisp [07:00] You can use the syntax "from" to apply constraints to enumerations in code. [07:00] I was talking about Python :P [07:00] I still prefer Haskell syntax to Scheme one :P [07:00] Only thing missing is . for accessing "members" of a class [07:01] It's currently used for function composition. [07:01] err? Lisp is even more insanely "everything is a first class object" than Python is [07:01] Haskell' (Prime) will resolve this problem. [07:01] Yep, most of the time. [07:01] Except (define ...) [07:01] to the degree that any lisp expression can either be lisp code to evalulate that expression, or a value [07:02] I know. Been there, done Lisp :P [07:02] (define ...) is just def in Python [07:02] Nope. [07:03] def is defun [07:03] define is more powerful [07:03] No equivalent Python construct. [07:03] maybe I'm confused there, it's been a while since I did any serious lisp [07:03] Okay, lets say you have a collection of Person objects... and you wanted to find Person objects with a given age and first name: [07:03] var q = from persons as p where p.Name.FirstName == "Bob" and p.Age = 123; [07:03] foreach (Person p in q) { do stuff with them } [07:04] wasabi, nice sugar :P [07:04] Yup. It turns into a AST, which a ORM tool can implement. [07:04] Not entirely necessary anyway. [07:04] Or it becomes a simple loop. [07:04] Either way, your code looks clear and concise. [07:05] Instead of programatic. [07:05] I don't know if it's entirely clear :P [07:05] Looks like a SQL query. [07:06] Yeah, it is the same idea. YOu are filtering a batch of data. [07:06] But it's completely type safe. [07:06] Well, I actually prefer Haskell :P [07:06] And IDEs can do pop up completion and fun stuff on it. ;) [07:06] filter (\x -> x.Name.FirstName == "Bob" and p.Age == 123) thedb [07:07] That's assuming H' [07:07] not H98 === j_ack [n=rudi@p508DBB02.dip0.t-ipconnect.de] has joined #upstart [07:08] How is that implemented? [07:08] Can that be translated at runtime to a SQL statement? [07:08] Probably :P [07:09] Depends on what x is [07:09] if x is an SQL-alike object [07:09] Of course, it's no syntactic sugar :P [07:10] it depends on the qualities of the p element [07:10] Esp. on its class and implementation of == and . operator [07:11] Ahh. [07:11] So the p class could be a class which completely changes the dynamics of the == and . [07:11] Yes. [07:11] Inorder to formulate one query that can be turned into one SQL statement. [07:11] Another boon is it can be used everywhere :P [07:12] You get an OODB gratis. [07:12] Yeah. [07:12] Ah, wrong [07:12] Python has a 'yield' statement, right? [07:12] this can't be done in this way [07:12] ? [07:12] p would have to be a Monad :P [07:12] wasabi, yes, it does [07:12] Monad? [07:13] I like yield. ;) [07:13] One of my favorite new C# features. [07:13] wasabi, yes, a wrapper around interactions with outside world [07:13] Signifying mostly "this is not a function" [07:13] hmm [07:13] Because it's not :P [07:15] So, it'd have to be written more like x <- (p->Something->SomethingElse); x==blah [07:15] but that can be also "undone" [07:15] Because it's actually a syntactic sugar for some >>= operators [07:15] Which work like a pipe in Linux. [07:16] Etc. etc. [07:16] Yeah. All of the stuff in C# is delayed evaluation too. [07:16] It never actually runs until it's used. [07:16] var q = from whatever; just returns an instance of some class that could potentially do the filter. [07:17] Unfortunately not lazy, just delayed :P [07:17] Could be lazy. If it's not SQL. [07:17] Nemerle does have some lazy eval constructs. [07:17] Default implementation is lazy... it finds the NEXT element, and stops. [07:17] SQL implementation could implement that by streaming results. [07:17] Aha. Ok. [07:18] But generally, C# is strict, right? Is there a method to disable that strictness locally easily? [07:18] No. It is always strict. [07:18] Generators? [07:19] Don't understand the reference. [07:19] Explain. [07:20] I think it supports them. [07:20] You can iterate using .next and .previous, but the objects get accessed only then [07:20] not earlier [07:20] Oh. Yeah. IEnumerable contains .MoveNext() [07:21] yield returns implementations of IEnumerable which access a method statemachine [07:21] And the query stuff does too [07:21] Aha, just what I though. Like Python iterator. [07:21] Yeah. [07:21] A bit of laziness in a strict language. [07:21] Hmm. By strict you mean? It's still completely typesafe. [07:21] What it generates must still be of the declared type. [07:22] IEnumerable [07:22] Basically, using yield looks like. [07:22] public IEnumerable GetString() { yield return "string1"; yield return "string2"; } [07:23] foreach (string s in GetString()) { operate on s; } [07:23] wasabi, strict == not lazy [07:23] The foreach construct basically uses MoveNext() and Current() on the IEnumerable instance. [07:23] Not dynamic. [07:23] lazy != dynamic [07:23] Are there any nice operators/functions to access an Nth object of an IEnumerable? [07:24] No. It's not an IEnumerable then. [07:24] IList contains an indexor. [07:24] IList : IEnumerable [07:25] You could certainly implement an IList which worked on a backing IEnumerable by advancing. [07:25] Aha, correct :P [07:25] But you would prefer not to i'd imagine. [07:25] :> [07:26] As you'd lose the benefits of the delayed evaluation. [07:26] Depends for what. E.g. memoisation [07:26] Simply calling List.Count would force teh entire thing to be evaluated. [07:28] public IEnumerable GetFoos() { for (int i = 0; i < 5; i++) return Foo(); } <--- generator? [07:28] public IEnumerable GetFoos() { for (int i = 0; i < 5; i++) yield return Foo(); } <--- generator? [07:29] bah. I meant "new Foo()" [07:35] wasabi, sure [07:36] Because counting is non-lazy always [07:36] You could have CountAlreadyDone [08:23] Sure. === Md [i=md@freenode/staff/md] has joined #upstart === j_ack [n=rudi@p508DBB02.dip0.t-ipconnect.de] has joined #upstart