On Tue, Nov 12, 2013 at 8:28 PM, Sieghard <s_c_...@arcor.de> wrote:
> Hallo Marcos,
>
> Du schriebst am Tue, 12 Nov 2013 12:20:45 -0200:
>
>> Yes. But the problem is if you have two units, both using the same
>> name, and you want to use them at the same project.
>> As I said before in official list, I have -- for many years -- units
>> that have the prefix 'M' so, I have mclasse.pas, mtasks.pas, msystem,
>> etc.
>> You know that MSE sources have mclasses and others that using the
>> prefix 'M'... do you see the problem now?
>>
>> Namespaces, as I explained on official list, will allow the programmer
>> set an 'alias' for units and use this name instead of the unit name.
>
> ISO extended Pascal has a feature allowing the re-export of aliased symbols
> from arbitrary compilation units (they're not named "unit" there).
> It would amount to write an interface unit "use"ing some specific external
> units, creating some declarations of new names aliasing the imported ones
> and exporting those. The imported names cannot be seen external to this
> interface unit, but are indirectly used through the aliases.
> I think this is an elegant solution to the problem you mentioned above.
> (Sadly, I had hardly an opportunity to use this system, as it was issued
> for OS/2 only, and only shortly before that was obsoleted by its producer.)

If I understood right, we can do the same using FPC. You can "rename"
a class or function (using a variable that use the same signature) but
the problem continues if we have two -- or more -- units with the same
name.
The compiler should provide a way to assign a directory to a
'Namespace' named by programmer, eg: Synapse.
This lib has units like httpsend, ftpsend, etc.
If you have, in your own project, these unit names, you could use a
Namespace for Synapse like this:
fpc /src/synapse/* -alias synapse
(of course I invented this sintaxe right now)

In your projects you could use Synapse's units like:
uses
  synapse.httpsend, synapse.ftpsend,
  httpsend; // this is your own unit!

No more unit name collision!
You can implements your lib without worrying about the names of units
used around the world (prefixes more used: id, dx, jv, rx, mse, etc).
IMHO this is better than Java packages.

Regards,
Marcos Douglas

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to