Re: Questions about windows support
On 02/20/2012 09:31 PM, H. S. Teoh wrote: On Tue, Feb 21, 2012 at 04:24:44AM +0100, Adam D. Ruppe wrote: On Tuesday, 21 February 2012 at 03:13:10 UTC, H. S. Teoh wrote: for x in *; mv $x dest/$x; done Easy. :) And wrong! What if the filename has a space in it? You can say "$x", with quotes, to handle that. Argh, you're right. That's one reason I *hate* the implicit interpolation that shells have the tendency to do. Perl got it right: $x means the value of x as a *single* value, no secret additional interpolation, no multiple layers of re-interpretation, and that nonsense. But, worse yet... a leading dash? Another downside with the shell expansion is the program can't tell if that is an expanded filename or a user option. Heh. Never thought of this before. I can see some fun times to be had with it, though! But you could probably handle it by: mv -- "$x" "$dest/$x" In this case, the mv simply wouldn't work, but you can get some bizarre behavior out of that if you wanted to play with it. try this some day as a joke: $ mkdir evil-unix # toy directory $ cd evil-unix $ touch -- -l # our lol file $ touch cool # just to put a file in there $ ls -l cool $ ls * # the lol file is interpreted as an option! -rw-r--r-- 1 me users 0 2012-02-20 22:18 cool $ imagine the poor newb trying to understand that! +1, LOL. T rsync -aAHX src dest && rm -fr src -- Christopher Nicholson-Sauls
Re: Proposal for std.path replacement
On 03/07/11 00:24, Jonathan M Davis wrote: > On Sunday 06 March 2011 22:09:22 Nick Sabalausky wrote: >> "Jonathan M Davis" wrote in message >> news:mailman.2280.1299459971.4748.digitalmar...@puremagic.com... >> >>> This reminds me. I should look into mime types one of these days to see >>> what the >>> appropriate way (if any) would be to put support for them in Phobos. It >>> would be >>> nice to not have to go by extension for the few programs that I have >>> which have >>> to worry about file type. >> >> I'm no unix expert, but my understanding is that mime types in the >> filesystem don't even exist at all, and that what it *really* does is use >> some complex black-box-ish algorithm that takes into account the first few >> bytes of the file, the extention, the exec flag, and god-knows-what-else to >> determine what type of file it is. Contrary to how people keep making it >> sound, mime type is *not* the determining factor (and cannot possibly be), >> but rather nothing more than the way the *result* of all that analysis is >> represented. > > I thought that the first few bytes of the file _were_ the mime type. > Certainly, > from what I've seen, extension has _no_ effect on most programs. Konqueror > certainly acts like it does everything by mime type - file associations are > set > that way. > > - Jonathan M Davis As someone who uses hex editors quite a bit (resorting these days to using Okteta mainly), I can tell you I have yet to see any file's mime embedded at the beginning, nor have I seen it in any headers/nodes when scanning raw. Doesn't mean it's impossible of course, and certain file systems certainly might do this[1] but I haven't seen it yet[2]. You are quite right, though, that extension doesn't matter at all, except in certain corner cases. Even then, they are reasonable and predictable things -- like SO's having the right extension. Considering the posix convention of "hiding" files/directories by starting the name with a dot, it'd be hard to rely on extensions in any naive way anyhow. ;) -- Chris N-S [1] I'd just about expect the filesystem of BeOS/Haiku to do so, or something similar to it at least. [2] Also not saying I wouldn't want to see it, necessarily. Done right, it'd be a damn nifty thing.
Re: Proposal for std.path replacement
On 03/07/11 00:09, Nick Sabalausky wrote: > "Jonathan M Davis" wrote in message > news:mailman.2280.1299459971.4748.digitalmar...@puremagic.com... >> >> This reminds me. I should look into mime types one of these days to see >> what the >> appropriate way (if any) would be to put support for them in Phobos. It >> would be >> nice to not have to go by extension for the few programs that I have which >> have >> to worry about file type. >> > > I'm no unix expert, but my understanding is that mime types in the > filesystem don't even exist at all, and that what it *really* does is use > some complex black-box-ish algorithm that takes into account the first few > bytes of the file, the extention, the exec flag, and god-knows-what-else to > determine what type of file it is. Contrary to how people keep making it > sound, mime type is *not* the determining factor (and cannot possibly be), > but rather nothing more than the way the *result* of all that analysis is > represented. > > One could likely get a good grip of the "black box" by studying the source of the common "file" utility. It can be surprisingly detailed in some cases, such as the following real example: $ file debug.log debug.log: UTF-8 Unicode English text, with very long lines It does generate mime types as well: $ file -bi debug.log text/plain; charset=utf-8 -- Chris N-S
Re: alias this question
On 02/13/11 10:30, Olli Aalto wrote: > I encountered a problem with alias this, when the aliased member is > private. I'm using the latest dmd2. It reports the follwing: > src\main.d(14): Error: struct K.K member s is not accessible > > If I change the private modifier on the s member to public it works. > > Is this as intended, or a bug? > > O. > There is actually an alternative, but I believe I remember it being said that this would go away. In the meantime, I think it still works and maybe it could be saved. The alternative is to define a method opDot() which returns the entity to forward the call to. Check out std.typecons:Unique for an example. -- Chris N-S
Re: Stupid little iota of an idea
On 02/12/11 04:08, Olivier Pisano wrote: > Le 12/02/11 10:36, Olivier Pisano a écrit : >> 4) I believe a function name should tell what it does. An alphabet >> letter (greek or not) is a poor indication and should be avoided. "sum" >> is a more reasonable choice than "epsilon", even if that what we all >> write in math. > > > Damn fever, I meant Sigma, of course, not epsilon... > Was gonna say... thought epsilon meant "nothing" which is quite apart from "sum." Either that, or we've just waxed existential in this discussion. @__@ -- Chris N-S
Re: Stupid little iota of an idea
On 02/11/11 19:36, Daniel Gibson wrote: > Am 12.02.2011 02:25, schrieb bearophile: >> Michel Fortin: >> >>> No one noticed yet that the a..b:c syntax causes ambiguity? Tell me, >>> how do you rewrite this using the new proposed syntax: >>> >>> auto aa = [iota(a, b, c): 1, iota(d, e): 2]; >> >> Right, that's why in another post I have said that syntax replaces most iota >> usages. There are some situations where you can't use it well. This is >> another situation I've shown in the enhancement request: >> iota(10.,20.) >> Writing it like this is not sane: >> 10...20. >> >> >>> Interval is clear only as long as there's no step value mentioned. >>> Having a step value is quite a stretch from the usual notion of an >>> interval. >> >> Right, but I think it's acceptable still, and better than iota. >> >> >>> I like a lot so's suggestion "walk". I'm not sure it's much clearer >>> than iota though. >> >> It's better than iota, but not by much. >> >> Bye, >> bearophile > > I think it's much better. Even having "steps" (or a stepsize) is obvious with > walk. > > iota only makes sense when you know this from other languages/libraries or if > your native spoken language has a similar word that can be somehow connected. > http://en.wiktionary.org/wiki/iota doesn't give a real connection (and two > English->German dictionaries I've checked don't either - one only listed iota > as > the greek letter, the other had mentions about something tiny) - it's just > something small like that greek i-without-a-dot letter. > There's nothing that connects it to a range of values with a fixed step size. > > Cheers, > - Daniel We have a related usage around here, but it's probably a local thing (western Kentucky). I grew up hearing "iota" as a word for the shortest/smallest distance/difference between two things, or (indirectly) the frequency of a thing. Not really an argument in favor of the name, mind you; but the usage had to originate from *somewhere* and so I submit that it has probably never been "official" but yet common at various times and places. -- Chris N-S
Re: Stupid little iota of an idea
On 02/11/11 18:46, so wrote: >> atob(1, 6) // easy to mix things like atoi >> ptoq(1, 6) // rocks imo! > > walk(1, 6) // now you have admit this is the best. I dunno. When I see 'walk' I think of collections, not ranges. But... I don't think it'd be terribly ambiguous, at least. For the record... I "get" the iota name... and I don't buy the eye-ambiguity with itoa. We should be using to!string, yes? But I'd be happy to see a more descriptive name, so keep at it. -- Chris N-S
Re: inlining or not inlining...
> > All of this is hardly related to the simple feature I initially asked for: > > string escString (string s) @tellmeifnotinlined { > s2 = s.replace("\n","\\n"); > s2 = s.replace("\t","\\t"); > return s2; > } > void show (X x) { > // ... use escString ... > } > ==> > Warning: function 'escString' in module 'foo' (line 123) was not > inlined. > (or else it was actually inlined) > > Which (I guess) is not that a big deal since the compiler needs to > decide anyway. I just wish to be informed of the result of the decision > procedure, only in case of 'no'. > > Denis I could really go for that, myself. Occasionally I've wanted such a beasty. I really do think it makes more sense as a pragma() than an attribute unto itself, though. -- Chris N-S
Re: inlining or not inlining...
On 02/11/11 14:26, Jim wrote: > Jim Wrote: > >> bearophile Wrote: >>> The LLVM back-end of LDC is able to inline much more, but even here a list >>> of inlined/not inlined functions helps. D is almost a system language, so >>> sometimes you need to go lower level (or you just need a program that's not >>> too much slow). >> >> >> If forced inlining is to be supported I think it would be good idea to also >> let the _caller_ decide whether to inline a function. The compiler could >> simply find the function definition, perhaps parameterize it, and then >> insert it. Should it not be able to inline almost any function if asked to? > > > Just had another idea.. > A function would know statically whether it has been inlined or not. If > inlined it could choose to propagate this attribute to any of its own > callees. Not sure it would be useful though, just thinking aloud.. And at this point what once seemed a simple thing starts to show its complexity teeth. Suddenly there are all this adjunct features to be provided in order to make it properly useful. Don't get me wrong, I'd actually like having all this... but I'm not sure of the cost in compiler complexity (and likely slowdown) and language bloat. But, here's some notions: == I really want foo() to be inlined, if even remotely possible! == pragma( inline ) int foo () { ... } == I'll be calling foo(), and I'd like it inlined if possible == int bar () { pragma( inline, foo ); // ... auto x = foo(); } == I'm foo(), and I'd like to know if I am being inlined == int foo () { pragma( inline, true ) { // inline code } pragma( inline, false ) { // ordinary code } } -- or if we ever get that 'meta' namespace some of us want -- int foo () { static if ( meta.inlined ) { // inline code } else { // ordinary code } } My chief complaint with my own notions is that 'pragma(inline' ends up with three different forms. This just isn't typical of a pragma. -- Chris N-S
Re: More on Rust
On 02/10/11 13:49, Andrej Mitrovic wrote: > On 2/10/11, Walter Bright wrote: >> auto x = (localtime().hours >= 8) ? "awake!" : "asleep, go away."; > > Aye, a one liner! > > I hate seeing things like this: > if (funcall()) > { > var = "foo"; > } > else > { > var = "bar"; > } > > So much clutter instead of using the simple: > var = funcall() ? "foo" : "bar"; > > I also see this sometimes: > > auto var = funcall(); > if (var == "foo" || var == "bar" || var == "foobar" || var == "barfoo") > { > // some complex code > } > else if (var == "blue" || var == "green") > { > // some complex code > } > else if ()// more and more code.. > { } > > But not many people seem to know that D supports strings in case statements: > switch(funcall()) > { > case "foo": > case "bar": > case "foobar": > case "barfoo": > { > // complex code > } > break; > case "blue": > case "green": > { >// complex code > } > break; > default: > } > Even better: switch( funcall() ) { case "foo", "bar", "foobar", "barfoo": { // complex code break; } case "blue", "green": { // complex code break; } default: // do nothing -- i like to comment defaults } Also often forgotten, that 'case' clauses take an argument list, not just an expression. And yeah, in this case at least... it still fits in 80 columns. (I prefer 90 myself, but it's moot.) -- Chris N-S
Re: More on the necessity and difficulty of a package management system
On 01/26/11 16:45, Andrei Alexandrescu wrote: > Seems to be unduly difficult in Python: > > http://www.google.com/buzz/michael.bruntonspall/AcMtiMEUgZ2/Packaging-and-deploying-python-web-apps > > > We need to have a good solution for D. > > > Andrei This seems related to a project I've been planning on: https://sites.google.com/site/dagazpreview/home Now if I could just find a little more spare time and get the be-damned thing's design finished and the code written. -- Chris N-S
Re: Writing XML
On 02/06/11 18:18, Tomek Sowiński wrote: > Rainer Schuetze napisał: > >> This looks nice and compact Using opDispatch to specify the tag (I guess >> that is what you are using to create a tag "book" by calling xml.book()) >> feels like misusing opDispatch, though. Does it add readability in >> contrast to passing the tag as a string to some function? >> >> How do you write a tag named "tight"? Or a tag calculated at runtime? > > xml.tag("tight", attributes..., { make content }); > > That's the base implementation. opDispatch is just syntax sugar over it. Might I suggest changing the sugar to have a suffix? Ie, instead of xml.book(...) as sugar for xml.tag("book",...) make it xml.bookTag(...) instead (or something similar). Very easy to check for using an if condition, and in the event that some XML application actually has a "tag" tag... well, xml.tagTag() might look funny, but at least it'd work. Could also support "_tag" as an alternate suffix for those with such sensibilities; xml.book_tag(...). -- Chris N-S
Re: Filtering even numbers in various languages
On 02/08/11 19:02, Andrei Alexandrescu wrote: > https://gist.github.com/817504 > > I added a D version. > > Andrei I would argue that (a & 1 == 0) is a cheaper simple test for evenness... Good show. Not really sure what the point of the list was... but sometimes these things are just (for) fun. -- Chris N-S
Re: Python's partition
On 01/22/11 15:38, Andrei Alexandrescu wrote: > On 1/22/11 3:33 PM, Christopher Nicholson-Sauls wrote: >> On 01/22/11 11:44, Andrei Alexandrescu wrote: >>> Looking through Python's string functions >>> (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed >>> partition(): >>> >>> partition(sep) >>> Split the string at the first occurrence of sep, and return a >>> 3-tuple containing the part before the separator, the separator itself, >>> and the part after the separator. If the separator is not found, return >>> a 3-tuple containing the string itself, followed by two empty strings. >>> New in version 2.5. >>> >>> Right now we find find and findSkip; partition would be a great >>> complement, and can be implemented for all forward ranges. >>> >>> One question is naming - partition() is not good for us because >>> std.algorithm.partition implements Hoare's in-place partition algorithm. >>> How should we call the function? >>> >>> >>> Andrei >> >> Bisect? >> >> -- Chris N-S >> > > Would be rather trisect, but that becomes a bit too cute. > > Andrei Yeah, you're right. I hit on "bi-" because my mental image was like a binary tree search. Anywho, I actually kinda like "trisect," even if it is cute. -- Chris N-S
Re: Python's partition
On 01/22/11 11:44, Andrei Alexandrescu wrote: > Looking through Python's string functions > (http://docs.python.org/release/2.5.2/lib/string-methods.html) I noticed > partition(): > > partition(sep) > Split the string at the first occurrence of sep, and return a > 3-tuple containing the part before the separator, the separator itself, > and the part after the separator. If the separator is not found, return > a 3-tuple containing the string itself, followed by two empty strings. > New in version 2.5. > > Right now we find find and findSkip; partition would be a great > complement, and can be implemented for all forward ranges. > > One question is naming - partition() is not good for us because > std.algorithm.partition implements Hoare's in-place partition algorithm. > How should we call the function? > > > Andrei Bisect? -- Chris N-S
Re: Why is the "in" storage class missing from the ParameterStorageClass enum?
On 01/20/11 21:57, Andrej Mitrovic wrote: > On 1/21/11, Jonathan M Davis wrote: >> Umm. in is never the default. in is essentially an alias for const scope. >> The >> default is non-shared and mutable. >> >> - Jonathan M Davis >> > > That's what I thought. But I did saw it mentioned in this NG a couple > of times, I can't remember by who though. > > In any case, "in" seems to be missing from that enum definition. So > unless there's a specific reason for its absence, I'd file an > enhancement request. It's possible someone was talking about D1 where 'in' meant something very different, and was in fact the default. -- Chris N-S
Re: easy to upgrade OS (was Re: DVCS)
On 01/22/11 03:57, spir wrote: > On 01/22/2011 09:58 AM, Walter Bright wrote: >> Gour wrote: >>> I'm very seriously considering to put PC-BSD on my desktop and of >>> several others in order to reduce my admin-time required to maint. all >>> those machines. >> >> OSX is the only OS (besides DOS) I've had that had painless upgrades. >> Windows upgrades never ever work in place (at least not for me). You >> have to wipe the disk, install from scratch, then reinstall all your >> apps and reconfigure them. > > Same in my experience. I had to recently re-install from scratch my > ubuntu box recently (recently why I have the same amusing info as Walter > telling my machine runs ubuntu 11.04?) because 10.04 --> 10.10 upgrade > miserably crashed (at the end of the procedure, indeed). > > And no, this is not due to me naughtily the system; instead while > userland is highly personalised I do not touch the rest (mainly my brain > cannot cope with the standard unix filesystem hierarchy). > > (I use linux only for philosophical reasons, else would happily switch > to mac.) > > Denis > _ > vita es estrany > spir.wikidot.com > Likewise I had occasional issues with Ubuntu/Kubuntu upgrades when I was using it. Moving to a "rolling release" style distribution (Gentoo) changed everything for me. I haven't had a single major issue since. (I put "major" in there because there have been issues, but of the "glance at the screen, notice the blocker, type out the one very short command that will fix it, continue updating" variety.) Heck, updating has proven so straight-forward that I check for updates almost daily. I originally went to Linux for "philosophical" reasons, as well, but now that I've had a taste of a "real distro" I really don't have any interest in toying around with anything else. I do have a Windows install for development/testing purposes though... running in a VM. ;) Amazingly enough, Windows seems to be perfectly happy running as a guest O/S. If it was possible to do the same with OS X, I would. (Anyone know a little trick for that, using VirtualBox?) -- Chris N-S
Re: What Makes A Programming Language Good
On 01/18/11 03:11, Vladimir Panteleev wrote: > On Tue, 18 Jan 2011 11:05:34 +0200, Walter Bright > wrote: > >> Vladimir Panteleev wrote: >>> On Tue, 18 Jan 2011 07:20:56 +0200, Walter Bright >>> wrote: >>> http://urbanhonking.com/ideasfordozens/2011/01/18/what-makes-a-programming-language-good/ >>> So, why do users still get a scary linker error when they try to >>> compile a program with more than 1 module? >> >> What is that message? > > C:\Temp\D\Build> dmd test1.d > OPTLINK (R) for Win32 Release 8.00.8 > Copyright (C) Digital Mars 1989-2010 All rights reserved. > http://www.digitalmars.com/ctg/optlink.html > test1.obj(test1) > Error 42: Symbol Undefined _D5test21fFZv > --- errorlevel 1 > > 1) The error message is very technical: > a) does not indicate what exactly is wrong (module not passed to > linker, not that the linker knows that) > b) does not give any indication of what the user has to do to fix it > 2) OPTLINK doesn't demangle D mangled names, when it could, and it would > improve the readability of its error messages considerably. >(I know not all mangled names are demangleable, but it'd be a great > improvement regardless) > >> dmd can build entire programs with one command: >> >> dmd file1.d file2.d file3.d ...etc... > > That doesn't scale anywhere. What if you want to use a 3rd-party library > with a few dozen modules? > Then I would expect the library vendor provides either a pre-compiled binary library, or the means to readily generate same -- whether that means a Makefile, a script, or what have you. At that time, there is no need to provide DMD with anything -- unless you are one-lining it a la 'dmd file1 file2 file3 third_party_stuff.lib'. Forgive me if I misunderstand, but I really don't want a language/compiler that goes too far into hand-holding. Let me screw up if I want to. -- Chris N-S
Re: repeat
On 01/18/11 03:07, Walter Bright wrote: > Andrei Alexandrescu wrote: >> I want to generalize the functionality in string's repeat and move it >> outside std.string. There is an obvious semantic clash here. If you >> say repeat("abc", 3) did you mean one string "abcabcabc" or three >> strings "abc", "abc", and "abc"? > > Just a thought: > > concat(repeat("abc",3)) > > yields "abcabcabc" > > ? Nah. Too obvious. On a more serious note, I have no issue with join(repeat("abc",3)). -- Chris N-S
Re: DVCS (was Re: Moving to D)
On 01/11/11 15:36, Walter Bright wrote: > Andrej Mitrovic wrote: >> That's my biggest problem with Linux. Having technical problems is not >> the issue, finding the right solution in the sea of forum posts is the >> problem. > > The worst ones begin with "you might try this..." or "I think this might > work, but YMMV..." How do these wind up being the top ranked results by > google? Who embeds links to that stuff? Nobody. The first "secret" of Linux tech-help is that most real help is dished out via IRC channels. One just has to visit their distro of choice's website and there will inevitably be a listing for an IRC channel or two -- often with one specifically for new users. It may sound like a lot of trouble, but getting help from the source and live is worlds above scanning forum posts hoping the people posting know more than you do. And thanks to the global scale of most FOSS communities, there's always someone around -- and it didn't cost you a dime. That said, a little more integrity in the forums that do exist would be nice. LinuxQuestions.org seems to be one of the better ones, from what I've seen of it. -- Chris N-S
Re: DVCS (was Re: Moving to D)
On 01/10/11 21:14, retard wrote: > Sun, 09 Jan 2011 06:00:21 -0600, Christopher Nicholson-Sauls wrote: > >> On 01/08/11 20:18, Walter Bright wrote: >>> Vladimir Panteleev wrote: >>>> On Sun, 09 Jan 2011 00:34:19 +0200, Walter Bright >>>> wrote: >>>> >>>>> Yeah, I could spend an afternoon doing that. >>>> >>>> sudo apt-get build-dep meld >>>> wget >>>> http://ftp.gnome.org/pub/gnome/sources/meld/1.5/meld-1.5.0.tar.bz2 tar >>>> jxf meld-1.5.0.tar.bz2 >>>> cd meld-1.5.0 >>>> make >>>> sudo make install >>>> >>>> You're welcome ;) >>>> >>> Thanks, I'll give it a try! >> >> I say you should consider moving away from *Ubuntu and to something more >> "developer-friendly" such as Gentoo, where the command to install meld >> is just: >> emerge meld >> >> ...done. And yes, that's an install from source. I just did it myself, >> and it took right at one minute. > > Gentoo really needs a high-end computer to run fast. Tell that to the twelve year old machine here in our living room, running latest Gentoo profile with KDE 4.x all with no problem. FWIW, the same meld > takes 7 seconds to install on my ubuntu. That includes fetching the > package from the internet (1-2 seconds). Probably even faster on Arch. Sure, and my wife's Kubuntu machine would probably do the same -- since *Ubuntu installs pre-compiled binaries (some packages are available as source, as I recall, but very few). I acknowledge that you disclaimed your statement with a "FWIW" but I have to say it isn't much of a comparison: pre-compiled binaries versus locally built from source. I only really brought up how long it took because of Walter's "spend an afternoon" comment anyhow, so really we both "win" in this case. ;) And yes, I'm an unashamed Gentoo advocate to begin with. Been using it as both server and personal desktop OS for years now. (Of course half or more of what I love about it is portage, which can be used with other distros -- and BSD! -- although I know nothing about how one sets that up.) -- Chris N-S
Re: Is this a bug?
On 01/09/11 16:28, Sean Eskapp wrote: > This code works fine: > > int[] arr = [ 1, 2, 3, 4, 5 ]; > auto myMax = function int(int a, int b) { return (a > b) ? a : b; }; > auto biggest = reduce!(myMax)(arr); > > But passing the function literal directly to reduce causes an error. Is this > intentional? I believe this is because binaryFun (which reduce uses) takes a template alias parameter, which must refer to something bound -- aka, having a name. There may be a way around this, to enable using function/delegate literals, but I'm not immediately sure how or if it's needed. So, yes, it is intentional in-so-far as this is how the language feature (template alias parameters) behaves. In the meantime, you can use the string way (so long as 'a' and 'b' are your only variables): auto biggest = reduce!`(a > b) ? a : b`( arr ); Or you can use the max() function from std.algorithm if your actual use case isn't more interesting than this. -- Chris N-S
Re: DVCS (was Re: Moving to D)
On 01/08/11 20:18, Walter Bright wrote: > Vladimir Panteleev wrote: >> On Sun, 09 Jan 2011 00:34:19 +0200, Walter Bright >> wrote: >> >>> Yeah, I could spend an afternoon doing that. >> >> sudo apt-get build-dep meld >> wget http://ftp.gnome.org/pub/gnome/sources/meld/1.5/meld-1.5.0.tar.bz2 >> tar jxf meld-1.5.0.tar.bz2 >> cd meld-1.5.0 >> make >> sudo make install >> >> You're welcome ;) >> > Thanks, I'll give it a try! I say you should consider moving away from *Ubuntu and to something more "developer-friendly" such as Gentoo, where the command to install meld is just: emerge meld ...done. And yes, that's an install from source. I just did it myself, and it took right at one minute. -- Chris N-S
Re: D vs C++
On 12/28/10 12:04, Caligo wrote: > > I just read the section on mixins in chapter 3 and my jaw hit the floor. > Yeah, I had that reaction as well. Combined with CTFE, mixins and string mixins can do some pretty amazing things. Sometimes the addition of Tuples can make it even better. For example, how nice is it to pre-generate a complicated partial argument list, without having to pre-generate the entire function call? Pretty darn nice. -- Chris N-S
Re: Game development is worthless? WTF? (Was: Why Ruby?)
On 12/19/10 14:52, Nick Sabalausky wrote: > "Daniel Gibson" wrote in message > news:mailman.37.1292790264.4748.digitalmar...@puremagic.com... >> On Sun, Dec 19, 2010 at 5:41 PM, Caligo wrote: >>> You are absolutely right; life sucks for many people, and that's why some >>> of >>> them choose to play video games. It gives them a chance to escape >>> reality, >>> and game companies exploit this to make money. Game companies use all >>> kinds >>> of psychology in their games to keep you playing as long as possible. >>> That >>> is why to me there is no honor in game development. >> >> This is bullshit. >> Of course there are games with that goal (WoW, ...), but this doesn't make >> game >> development in general "unhonorable". There are many games that are >> not like this, >> for example most single player only games.. you play them until the end or >> until >> you can't get any further and that's it.. maybe you play them again in >> the future, but >> it's not like a constant addiction. (I'm not saying that multi player >> games are generally >> more "dangerous" or anything, single player games are just an example >> everybody >> should be able to comprehend) >> There are also game developers who openly label games like WoW "unethical", >> e.g. http://en.wikipedia.org/wiki/Jonathan_Blow >> > > Interesting. I don't think I would go so far as to claim that WoW was > unethical...just "uninteresting" ;) But that's just me. This is at least one > thing the videogame world does that I do consider unethical: > Proprietary/Closed platforms. But that's not just a videogame thing, of > course. I consider proprietary/closed platforms in general to be unethical. > (Oh crap, I think I can feel myself turning into Stallman!) > (On the upside, that means you get to grow an epic beard.)
Re: Game development is worthless? WTF? (Was: Why Ruby?)
On 12/19/10 14:00, Nick Sabalausky wrote: > "Caligo" wrote in message > news:mailman.30.1292776925.4748.digitalmar...@puremagic.com... >> You are absolutely right; life sucks for many people, and that's why some >> of >> them choose to play video games. It gives them a chance to escape >> reality, >> and game companies exploit this to make money. Game companies use all >> kinds >> of psychology in their games to keep you playing as long as possible. >> That >> is why to me there is no honor in game development. Also, I never said >> it's >> worthless; they make tons of money, and that's almost always at the >> expense >> of people like you. >> > > The old "games as drugs" argument. > > First of all, anyone who's a slave to psychological tricks is an idiot > anyway. Casinos use many psychological tricks to induce addiction and yet > most people are perfectly able to control themselves. > > Secondly, if you see movies, music, comics and novels as the same > "dishonorable escapism", then I'll grant that your reasoning is at least > logically sound, even though you're in an extremely tiny minority on that > viewpoint. If not, however, then you're whole argument crumbles into a giant > pile of blatant bullshit, and clearly far too much of an imbicile to even > continue discussing this with. > >> If it helps any, I'm not one of those baby boomers. I'm actually in my >> early twenties. So if you are going to insult me at least do it properly. >> > > Fine, but that does make you the exception. > >> You sound way too angry and unhappy. > > I just have no tolerance for such obvious lies and idiocy. > >> Instead of playing video games, you >> should definitely pick up Ruby if you haven't already. I hear it's >> "designed to make programmers happy." >> > > I realize you mean that in jest, but I actually have been using Ruby (Rake) > as the build system for a big web project. It gets the job done, but I'm not > exactly impressed with it. > Take a look at Thor sometime. It's a replacement for Rake, and for some jobs can be better. Rails/3.x is apparently adopting it (or has adopted it... I haven't made the jump to 3 yet). https://github.com/wycats/thor -- Chris N-S
Re: Game development is worthless? WTF? (Was: Why Ruby?)
On 12/20/10 04:25, Max Samukha wrote: > On 12/19/2010 09:48 PM, Nick Sabalausky wrote: > >>> >> >> Assuming you meant that as a sarcastic counter-example: There may be >> ways in >> which they make life suck less, but *overall*, they're generally >> considered >> to make life suck *more*. So the "make life suck less" rule still holds. >> >> Although, if you meant it seriously then nevermind: The whole >> drug-legalization issue is one of the few debates I actively avoid :) >> > > I have no clear opinion about games, though I do believe they carry some > similarity with drugs in the way they make a person neglect stuff > important for his survival in the reality he was born into. That's a (sadly common) problem with people, though; not with games. The same can be validly stated for television (which I usually avoid, anyhow), sports, over-reliance on restaurants (a personal pet peeve), and checking the D newsgroups... oh shi- -- Chris N-S
Re: Game development is worthless? WTF? (Was: Why Ruby?)
On 12/19/10 04:19, bearophile wrote: > Christopher Nicholson-Sauls: > >> So no, games in and of themselves don't contribute anything -- if you >> don't count fun, and honestly, I do count it -- but they have been a >> driving force behind a lot of innovation. > > Yet I hope Walter will not waste 6 hours every day *playing* World of > warcraft :-) > > Bye, > bearophile Touché. ;) But I said 'game' not 'cult.' :D -- Chris N-S
Re: Why Ruby?
On 12/19/10 01:29, spir wrote: > On Sat, 18 Dec 2010 18:13:50 -0800 > Walter Bright wrote: > >>> you could write: >>> sort!(@1>@2)(x); >> [...] >>> I think this idea (or something similar) is worth consideration. It is >>> simply a small extension to an already existing feature that would give D >>> a terser syntax for lambda's than most of the other languages we've been >>> discussing. >> >> but: >> >> sort!("a>b")(x); >> >> is just as short! And it already works. > > Short, but wrong. I mean conceptually. In-code string representation of code > is wrong. I cannot explain why, but something in me refuses that. Seems I'm > not the only one. Maybe it's my history with embedded languages with eval() or eval-like functions, like the BASIC one you referenced... or maybe it's because my "D brain" likens this usage to the very thing that's going on behind the scenes (string mixin), and which has proven to be a very handy feature... I'm not sure what might be the reason, but: I find it suits me fine. I'm not boasting or anything like that; I'm just pointing out that the issues no doubt stem, at least in part, from a difference in individual programmers' experience. I'm used to making valuable use of things like eval() -- which you evidently dislike, and not for invalid reasons. Ultimately, though, I think this whole matter of D lambdas boils down to just plain not liking the use of strings as anything other than self-contained text data snips. One of those weird languages I'm used to had two different kinds of string literal... and the second one was actually a list of explicit character codes, as integers. You'd be surprised the uses one would find for this thing -- such as easily writing escape code sequences. My point? Different language, different environment. When the new environment is drastically different from what we're used to, even if only in a few aspects, we shy from it. At any rate, there's always the MiniD syntax to inspire those who must seek another way. This: func(\a, b -> a * b) ...is rewritten as: func(function(a, b) { return a*b; }) Obviously the backslash would be a potential problem. --Chris N-S
Re: Game development is worthless? WTF? (Was: Why Ruby?)
On 12/18/10 14:12, Nick Sabalausky wrote: > "Nick Sabalausky" wrote in message > news:iej46p$42...@digitalmars.com... >> "Caligo" wrote in message >> news:mailman.5.1292651710.4588.digitalmar...@puremagic.com... >>> >>> IMO there is no honor in game development as it contributes nothing to >>> society. I've rarely played any, >> >> I gotta jump on this as being a giant load of pretentious bullshit. First >> of all, there's the patently obvious "how in the world would you know?" >> considering the "I've rarely played any". >> >> But more importantly, games make life suck less - I can't even imagine any >> more significant contribution to society than that. Even all of the >> endeavors generally considered to be the biggest contributions to society >> are *only* significant contributions *because* that's exactly what they >> do: they make life suck less, and are therefore well-regarded. >> >> Seriously, what up with all those presumptuous assholes out there (mostly >> baby boomer dinos and their even more anachronistic parents, interestingly >> enough) who have barely ever touched a videogame and yet figure they >> actually have reason to believe such absurd pretentious crap? Fuck, they >> all remind me of that pompous Roger Ebert douchebag. (Speaking of ways to >> benefit society, when's he finally gonna keel over? Isn't it about time by >> now? And speaking of "contributions to society" what the fuck's he ever >> done? Collect a salary just to spout off opinions? Fucking useless >> wanker.) >> > > Since it apparently isn't obvious to some people: things don't have to be > dull to qualify as a significant a contribution. > > > There's also the classic example: a game was instrumental in the development of UNIX. http://en.wikipedia.org/wiki/Space_Travel_(video_game) This wasn't arbitrary either; it was something Thompson wanted to do, and he needed a better OS to do it in... so his toy got new polish. Some of this polish became things we now take for granted and hardly know how to live without (like a hierarchial filesystem). Do I mean to say that without the game there would be no UNIX? No; but I do mean to say that games have *always* been a valuable tool for finding the limits of systems, and for inspiring innovative ways to expand those limits. The same research and development that provided pixel shaders to game developers, also provided them to medical imaging developers. The same that provided CPU technologies such as SSE to enable more complex simulations in games, also provide for more complex simulations in supercomputers. And many of these sort of technologies were original conceived just to make games more awesome. Amazing. So no, games in and of themselves don't contribute anything -- if you don't count fun, and honestly, I do count it -- but they have been a driving force behind a lot of innovation. -- Chris N-S
Re: [OT] Mozilla Thunderbird
On 12/16/10 07:39, Justin Johansson wrote: > Just wondering how others rate Thunderbird as a decent newsreader. > > My experience with Thunderbird is that it is not of a standard of > distinction that one would hope for in 2010 coming 2011. > > For one thing, and perhaps this is a newsgroup server problem, but I > doubt it, my Thunderbird client shows a number of D NG topics as being > unread though the folder tree item for d.D shows all items as read. > > Aside from that issue, my experience with Thunderbird is that it is not > particularly innovative in drawing my attention to the high-traffic > topics apart from telling me that one-or-more responses are unread (as > opposed to popular topics for example). > > Overall I think Thunderbird is a bit lame as a newsreader for this day > and age, and, though it owes me nothing and I paid nothing for it, I do > wonder what others think of their NG experience using Mozilla Thunderbird. > > -- Justin For my two cents, all I can say is that I've been using Thunderbird for eons, and whenever I have tried another client I've either found the UI highly unintuitive, or worse yet unintelligible, or I've found it pushing extra features on me that I have no use for. (The old version of Outlook I fiddled with for a short month comes to mind.) I really don't use it for anything other than newsgroups, so I don't care about anything to do with advanced message formatting (that usually isn't quite compatible with other readers anyhow, in my experience) or with many of the side features (such as personal calendars, which I have other more specialized programs for). There are a couple of clients mentioned in this thread I haven't tried before (such as Pan) so I may be giving them a shot. But... Thunderbird has done the job for me, and done it well, for several years. -- Chris N-S -- Thunderbird 3.1.7
Re: ByToken Range
On 12/11/10 22:41, Matthias Walter wrote: > Hi all, > > I wrote a ByToken tokenizer that models Range, i.e. it can be used in a > foreach loop to read from a std.stdio.File. For it to work one has to > supply it with a delegate, taking a current buffer and a controller > class instance. It is called to extract a token from the unprocessed > part of the buffer, but can act as follows (by calling methods from the > controller class): > > - It can skip some bytes. > - It can succeed, by eating some bytes and setting the token to be read > by the front() property. > - It can request more data. > - It can indicate that the data is invalid, in which case further > processing is stopped and a user-supplied delegate is invoked that may > or may not handle this failure. > > > It is efficient, because it reuses the same buffer every time and just > supplies the user with a slice of unprocessed data. If more data is > requested, the remaining unprocessed part is copied to the beginning and > more data is read. If there is no such unprocessed data, the buffer is > enlarged, i.e. length doubled. > > The ByToken class has the type of a token as a template parameter. > > Does this behavior make sense? Any further suggestions? > Is there any interest in having this functionality, i.e. should I create > a dsource project, > or does everybody use parser-generators for everything? > > Matthias I write lexers/parsers relatively often -- and I don't use generators... because I'm masochistic like that! And because there aren't many options for D. There was Enki for D1 a while back, which might still work pretty well, and there's GOLD although I'm not aware of how their D support is right now. I might be forgetting another. So I, for one, like the idea of it at the very least. I'd have to see it in action, though, to say much beyond that. -- Chris N-S
Re: Why Ruby?
On 12/10/10 19:26, Ary Borenszweig wrote: > http://vimeo.com/17420638 > > A very interesting talk. > > I used to like D. To write code in a high level while at the same > time being very close to the machine, with class invariants, unit > tests and many other features seemed very appealing. But I always > felt there was something wrong. > > About a year ago I met Ruby. Now I find languages like Java, C#, > Python and D kind of ugly and uncomfortable. Why? Exactly because of > what it is said in that video. > > This is not to start a flame war or trolling, it's just to show you > why I changed my mind so much about D, and why I think (IMHO) you > should care about naming conventions (like bearophile says), more > powerful unittests (and not having unittests integrated into the > language but rather being able to build your own test frameworks > with ease) and stop caring about being C-syntax friendly. The world > doesn't need that many semicolons and parenthesis. :-) I'm a strange one. I use Ruby, and D. (And a couple of others...) I use the tool that feels best for the job, whatever that may be at a given time. Sitting on a disc somewhere are some personal tools I used to use when working with D... which are themselves written in Ruby (and bash script, but hey). Then again, I'm the same one who really really likes Ruby on Rails... and yet still does most things with PHP. Why? Well for one, because for plenty of projects, Rails is less an aid and more a hindrance. (And yes, before someone brings it up, I'm well aware of CakePHP... and don't care for it much.) There are times in D when I find myself wishing, momentarily, for the loose typing of Ruby... but then there are times in Ruby when I find myself wishing for stricter typing. There are times when I wish D had open classes... but then there are times when Ruby's open classes give me headaches. I could go on like this... but the point was really just: use the right tool for the job. Keep several tools in your toolbox. There is no "THE BEST LANGUAGE OMG!!!" There is just the best one for a given programmer in a given scenario. Some of the things I've done could probably have been better written in, say, Pike! But I don't really know Pike (very well), and don't feel the need to learn it just for those few things that might have benefited. -- Chris N-S
Re: Please vote on std.datetime
On 12/10/10 18:17, Jonathan M Davis wrote: > On Friday, December 10, 2010 15:29:40 Fawzi Mohamed wrote: >> On 10-dic-10, at 20:07, Jonathan M Davis wrote: >>> On Friday, December 10, 2010 09:55:02 Fawzi Mohamed wrote: On 10-dic-10, at 18:02, Jonathan M Davis wrote: thanks for the answers > On Friday 10 December 2010 03:18:29 Fawzi Mohamed wrote: > Clock is used as a namespace of sorts specifically to make the code > clearer. You > can think of it as a sort of singleton which has the functions which > give you > the time from the system clock. I think that it improves useability. having a separate module for it would give a similar effect >>> >>> Having a separate module would defeat the point at least in part. >>> The idea is >>> that you call Clock.currTime() rather than currTime(). You call >>> IRange.everyDayOfWeek!() instead of everyDayOfWeek!(). The benefit >>> is in having >>> the extra name to make it clear what the function is associated >>> with, what it's >>> doing. For instance, conceptually, you're getting the current time >>> from the >>> system clock. This makes it explicit. If it were a separate module, >>> then it >>> would normally just be imported and you'd call currTime() and >>> everyDayOfWeek!() >>> and all the benefit of putting them in that separate namespace is >>> lost. >> >> import Clock=std.time.Clock; >> >> Clock.currTime(); > > Except then you have to go out of your way to do that. It's no longer the > default. > Reminds me of an enhancement request I made ages ago to allow a 'static module' statement which would make 'static import' required. Here we are wishing for it, or something like it, once again. http://d.puremagic.com/issues/show_bug.cgi?id=1297 -- Chris N-S
Re: DMD2 .deb fails to install on Ubuntu 10.10 – just remove »shell« ?
On 12/08/10 19:50, Ellery Newcomer wrote: > Quick - which gets executed first - /usr/bin/* or /usr/local/bin/* ? > > Either way, someone or something is going to be surprised. > > It would probably be a better idea to either remove or rename the less > used ones. 'shell' is uncomfortably generic. > > Don't know if anyone does, but I have never used any of the binaries > except dmd and rdmd. > > Except when I can't remember which is objdump and which is dumpobj. > > On 12/08/2010 07:29 PM, Walter Bright wrote: >> Walter Bright wrote: >>> Andrei Alexandrescu wrote: This seems pretty urgent. Walter? >>> >>> I asked Jordi, who prepares the .deb files. >> >> Should the binaries be installed on /usr/local/bin instead? I've only ever used dmd and objdump myself. Honestly, shell could probably go away with hardly anyone noticing (naked assumption). If not, it could be renamed (dmd-shell?). As for which is scanned first, /usr/bin or /usr/local/bin, my own system scans /usr/local/bin first. Of course this is unreliable, since there's no guarantee of that ordering. I "vote" for renaming it, unless there's a wide consensus to remove it from the package. Disclaimer: I haven't actually used Debian or Ubuntu myself in ages, so I'm used to manually installing DMD anyhow... and these days, I just sandbox each project with it's own. -- Chris N-S