Tango - shallower hierarchy (was: Phango - questions)

Sean Kelly sean at f4.ca
Tue Nov 27 07:39:14 PST 2007


Aarti_pl wrote:
> Sean Kelly pisze:
>> Marcin Kuszczak wrote:
>>>
>>> Some more thoughts:
>>>
>>> tango.core
>>> - it seems to be another general aggregate type for different things 
>>> like
>>> tango.util. But I would expect modules should be very low level, 
>>> commonly
>>> used stuff (not complex as opposite to util). That said I wonder why 
>>> there
>>> is whole threading package in core? In what sense is threading 'core'? I
>>> think that even on multicore machines it still be a lot of applications
>>> which will be single threaded. What's more I found it counterintuitive:
>>> when I want in my application threading support I would rather look for
>>> tango.concurrency or tango.threading or tango.threads. In this package
>>> should be also 'sync' package.
>>
>> tango.core is roughly akin to java.lang in Java.  It is intended to 
>> contain essential type definitions, utilities, and expose runtime 
>> features.  Threading is actually a runtime feature, which is why it is 
>> in core.  tango.core.sync exists because I feel that simple threading 
>> primitives are an essential language feature.  Any additional 
>> threading utilities will likely go in tango.util.concurrent or the 
>> equivalent.
> 
> Now I understand. Thanks.
> 
> But still think that its not the best choice. Please notice that what 
> you said is more implementor point of view than user point of view. If I 
> want to use threads it's not important for me that its runtime feature. 
>  I just want to make my job quickly without reading too much. Looking 
> for threads in Tango and seeing only  main Tango hierarchy I have pretty 
> good chance that I don't find it at first time. I can of course have 
> "specific knowledge" and immediately go to tango.core. But necessity for 
> "specific knowledge" is worse than relaying only on "general 
> knowledge"/intuition, when creating libraries intended for wide audience.

How would you suggest things be arranged?  To me, the reasoning behind 
tango.core makes sense.  Array extends the functionality of a built-in 
type, so it belongs in core, Thread is essentially a language feature so 
it belongs in core, BitArray is a common and basic type, so is Variant, 
etc.  So I don't have any ideas for how to better separate things.

By the way, I know you may consider it an implementor point of view, but 
another reason for core being distinct was motivated by distribution 
concerns.  It is currently possible to ship and use a Tango library 
containing only core, stdc, and sys (the latter two for their C 
headers).  Spreading this functionality out would make for a more 
confusing core/runtime distribution if we ever decide to do so.  Such 
modularity was originally intended to be a selling point of the library, 
and I will admit to have been somewhat surprised that most people don't 
seem to care about it.


Sean



More information about the Digitalmars-d mailing list