questions on PhanTango 'merger' (was Merging Tangobos into Tango) - long-term vision

Kris foo at bar.com
Thu Oct 11 21:33:44 PDT 2007


"Regan Heath" <regan at netmail.co.nz> wrote in message 
news:felol1$2fte$1 at digitalmars.com...
> Kris wrote:
>> "Christopher Wright" <dhasenan at gmail.com> wrote in message 
>> news:fel8ir$1crd$1 at digitalmars.com...
>>> I don't care about free functions versus objects, but I care about the 
>>> amount of typing I have to do. And it seems that object names are about 
>>> as long as function names, and method names are about as long as 
>>> function names, so using an object-oriented interface involves twice as 
>>> much typing.
>>>
>>> If you had "alias formatln fln" in Print, for instance, I could just 
>>> write:
>>> Stdout.fln("whatever");
>>>
>>> That's about a three character penalty above writefln, which I wouldn't 
>>> notice. The current seven-character penalty is slightly annoying.
>>
>> Noted, and thank you
>>
>>
>>> I don't like instantiating objects in order to do a simple test:
>>> if (new FilePath(path).exists && !new FilePath(path).isFolder) {
>>>    // do stuff
>>> }
>>>
>>> versus:
>>> if (Path.exists(path) && Path.isFolder(path)) {
>>>    // do stuff
>>> }
>>
>> This is definately a pain point I've heard often. The approach in Tango 
>> would be something like:
>>
>> auto path = FilePath ("some path");
>>  if (path.exists && !path.isFolder) {
>>     // do stuff
>>
>> That's not so bad, is it?
>
> Well.. if we make the assumption that isFolder will return false if is 
> doesn't exist all you're really asking is:
>
> if (isFolder("some path")) {
>
> and if that is the extent of it then the free function is more 
> appropriate, it's quicker, easier, involves no heap allocation, etc.
>
> In a more complicated situation I would argue for the class but that's the 
> point I'm trying to make, in some situations one is more appropriate than 
> the other.
>
> Regan
>
> p.s. to my mind the amount of typing involved isn't really important as 
> copy+paste has been my friend for a long time and auto-completion almost 
> as long.


Point taken ... I was actually doing copy/paste myself, using the OP's 
example :) 





More information about the Digitalmars-d mailing list