[erlang-questions] package namespaces question

wde <>
Tue Nov 10 21:37:39 CET 2009


you can't import all "system "modules.

you can't do somehting like that : import system.*

you must import each module or you can prefix module names by a "." 

erlang package system is not really flexible.







======= le 10/11/2009, 20:58:05 vous écriviez: =======

>Gracias Enrique!
>
>But how can i import all system modules and apps?
>
>Has gs become lib.gs or something alike?
>
>Well, the URLS from 2004 were bit old ive just found the current version at http://www.erlang.org/doc/man/packages.html  
>
>I saw no prior examples of packcages used on the list certainly not back in 2008/2009 so an " almost deprecated" notice at the top 
>of the page is all i need to stop at here and continue reading other things....
>
>/Angel
>
>El Martes, 10 de Noviembre de 2009 Enrique Marcote escribió:
>> Hola Angel,
>> 
>> Try importing gs.
>> 
>> Saludos,
>> 
>> Enrique
>> 
>> 
>> El 10/11/2009, a las 20:10, Angel Alvarez escribió:
>> 
>> > Hi Guys!
>> > 
>> > Im currently reading erlang archives from 2004
>> > 
>> > On 10/05/2004 Someone talked about package namespaces ("Is erlang too small" thread) so i decided to just test this "new2 erlang knowledge.
>> > 
>> > iv just borrowed some little code from a gs article... :-)
>> > 
>> > the module starts like this:
>> > 
>> > 
>> > -module(gui).
>> > -export([init/0]).
>> > 
>> > init() ->
>> >    S = gs:start(),
>> >    Win = gs:create(window, S, [{width, 350}, {height, 100}]),
>> >    gs:create(button, quit, Win, [{label, {text, "Quit"}}, {x, 0}]),
>> > ...
>> > 
>> > so on the erlang shell gui:init(). just runs the example..
>> > So i changed the module to use package style names...
>> > 
>> > 
>> > -module(angel.tests.gui).
>> > -export([init/0]).
>> > 
>> > init() ->
>> >    S = gs:start(),
>> >    Win = gs:create(window, S, [{width, 350}, {height, 100}]),
>> >    gs:create(button, quit, Win, [{label, {text, "Quit"}}, {x, 0}]),
>> > ...
>> > 
>> > and moved the gui.erl to $PWD/angel/test/gui.erl
>> > 
>> > 
>> >> :~/Datos/Docs/Personal/Erlang/Code/angel/test> erlc gui.erl
>> >> cd ../../
>> >> :~/Datos/Docs/Personal/Erlang/Code/ 
>> > 
>> > but now firing at the shell results in :
>> > 
>> > :~/Datos/Docs/Personal/Erlang/Code> erl
>> > Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]
>> > 
>> > Eshell V5.7.2  (abort with ^G)
>> > 1> angel.test.gui:init().
>> > ** exception error: undefined function 'angel.test.gs':start/0
>> >     in function  'angel.test.gui':init/0
>> > 
>> > What's wrong? 
>> > Is needed the same convention on the rest of modules 
>> > after you start using package name styles?
>> > 
>> > 
>> > From http://www.erlang.se/publications/packages.html
>> > 
>> > "m2:g(X) becomes a call to foo.bar.m2 
>> > 
>> > If this is not what was intended, the call can be written explicitly, as in 
>> >    -module(foo.bar.m1).
>> >    -export([f/1]).
>> > 
>> >    f(X) -> fee.fie.foe.m2:g(X)."
>> > 
>> > it seems bit embarrasing, i think is why perhaps no one is using this feature 5 years later...
>> > 
>> > 
>> > Thanks Angel
>> > -- 
>> > No imprima este correo si no es necesario. El medio ambiente está en nuestras manos.
>> > ->>-----------------------------------------------
>> >    Clist UAH a.k.a Angel
>> > ---------------------------------[www.uah.es]-<<--
>> > 
>> > Tú lo compras, yo lo copio. Todo legal.
>> > 
>> > ________________________________________________________________
>> > erlang-questions mailing list. See http://www.erlang.org/faq.html
>> > erlang-questions (at) erlang.org
>> > 
>> 
>> 
>
>
>
>-- 
>Agua para todo? No, Agua para Todos.
>->>-----------------------------------------------
>    Clist UAH a.k.a Angel
>---------------------------------[www.uah.es]-<<--
>
>No le daría Cocacola Zero, ni a mi peor enemigo. Para eso está el gas Mostaza que es mas piadoso.
>
>________________________________________________________________
>erlang-questions mailing list. See http://www.erlang.org/faq.html
>erlang-questions (at) erlang.org

= = = = = = = = = ========= = = = = = = = = = =
			
wde

10/11/2009



More information about the erlang-questions mailing list