caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] module namespace
@ 2002-11-02  0:24 Yurii A. Rashkovskii
  2002-11-02  8:51 ` Alessandro Baretta
  0 siblings, 1 reply; 18+ messages in thread
From: Yurii A. Rashkovskii @ 2002-11-02  0:24 UTC (permalink / raw)
  To: caml-list


[-- Attachment #1.1: Type: text/plain, Size: 1230 bytes --]

I've developed small preprocessor module that provides kind of
namespace support for the Objective Caml.

It defines following constructs:

* module ModuleName in [Namespace|Namespace.Namespace]

it defines module ModuleName within namespace

Examples:
 module Test in Org.Openeas = struct let test = () end
 module Test in Org.Openeas : sig val test:unit end

* module type ModuleTypeName in [Namespace|Namespace.Namespace] 

it defines module type ModuleTypeName within namespace

Example:
 module type T = sig val test:unit end

* open ModuleName in [Namespace|Namespace.Namespace] 

it opens module ModuleName from namespace

Example:
 open Unix in Org.Ocaml

* open ModuleName in [Namespace|Namespace.Namespace] as NewModuleName 

the same as previous, but also renames module ModuleName to NewModuleName

Example:
 open Unix in Org.Ocaml as CamlUnix

* use [Namespace|Namespace.Namespace]

it opens namespace module. If namespace name contains dots, they are
replaced with underline.

Example:
 use Org.Openeas



If somebody is interested, I want to hear comments, questions,
bugs of current implementation and so on. 

Early source code is attached.

-- 
Thanks,
Yurii.

[-- Attachment #1.2: pa_ns.ml --]
[-- Type: text/plain, Size: 3851 bytes --]

(*******************************************************)
(*                                                     *)
(* OCamlNS                                             *)
(*                                                     *)
(* Copyright (c) 2001, 2002.                           *)
(* E/AS Software Foundation                            *)
(*                                                     *)
(* Author(s):                                          *)
(*    Yurii A. Rashkovskii                             *)
(*                                                     *)
(* This program is free software; you can redistribute *)
(* it and/or modify it under the terms of the GNU      *)
(* Lesser General Public License as published by the   *)
(* Free Software Foundation; version 2 of the License. *)
(*                                                     *)
(*******************************************************)

open Stdpp;;
open Pcaml;;

let mod_ident = Grammar.Entry.create gram "mod_ident";;
let module_binding = Grammar.Entry.create gram "module_binding";;


let rename_module = ref (fun loc -> <:str_item< open Pervasives >>);;

let gen_mod_name l =
    let nsname = ref "" in
    List.iter (fun x -> nsname := !nsname ^ (x ^ "_")) l ; 
    (String.sub !nsname 0 ((String.length !nsname)-1));;

let gen_ns_name l =
    let nsname = ref "" in
    List.iter (fun x -> nsname := !nsname ^ (x ^ "_")) l ; !nsname;;
    
let gen_module loc mn ns me =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__module___" ^ mn in
    <:str_item< module $uid:name$ = $me$ >>
;;    

let gen_module_type loc mn ns mt =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__moduletype___" ^ mn in
    <:str_item< module type$uid:name$ = $mt$ >>
;;    

let gen_module_open loc mn ns =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__module___" ^ mn in
    rename_module := (fun loc -> <:str_item< module $uid:mn$ = $uid:name$>>);    
    <:str_item< open $uid:name$>>
;;    

let gen_module_use loc ns =
    let name = (gen_mod_name ns) in
    <:str_item< open $uid:name$>>
;;    

let gen_module_open_as loc mn ns asn =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__module___" ^ mn in
    rename_module := (fun loc -> <:str_item< module $uid:asn$ = $uid:name$>>);    
    <:str_item< open $uid:name$>>
;;    

let gen_module_sig loc mn ns mt =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__module___" ^ mn in
    <:sig_item< module $uid:name$ : $mt$ >>
;;    

EXTEND

  mod_ident:
    [ RIGHTA
      [ i = UIDENT -> [i]
      | i = LIDENT -> [i]
      | i = UIDENT; "."; j = SELF -> i :: j ] ]
  ;

  module_binding:
    [ RIGHTA
      [ "("; m = UIDENT; ":"; mt = module_type; ")"; mb = SELF ->
          <:module_expr< functor ( $m$ : $mt$ ) -> $mb$ >>
      | ":"; mt = module_type; "="; me = module_expr ->
          <:module_expr< ( $me$ : $mt$ ) >>
      | "="; me = module_expr -> <:module_expr< $me$ >> ] ]
  ;

  str_item: LEVEL "top"
  [
    [ "module"; i = UIDENT; "in" ; ns = mod_ident ; 
       me = module_binding ->
      gen_module loc i ns me
     |
     "module";"type"; i = UIDENT; "in" ; ns = mod_ident ; "=";
       mt = module_type ->
      gen_module_type loc i ns mt
     | 
     "open"; i = UIDENT; "in" ; ns = mod_ident ->
      gen_module_open loc i ns ; !rename_module loc
     | 
     "open"; i = UIDENT; "in" ; ns = mod_ident ; "as" ; asn = UIDENT ->
      gen_module_open_as loc i ns asn; !rename_module loc
     | 
     "use"; ns = mod_ident  ->
      gen_module_use loc ns
    ]

  ];

  sig_item: LEVEL "top"
  [
    [ "module"; i = UIDENT; "in" ; ns = mod_ident ; ":" ; mt = module_type ->
      gen_module_sig loc i ns mt
    ]

  ];

END
;

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-02  0:24 [Caml-list] module namespace Yurii A. Rashkovskii
@ 2002-11-02  8:51 ` Alessandro Baretta
  2002-11-02 16:10   ` Yurii A. Rashkovskii
  0 siblings, 1 reply; 18+ messages in thread
From: Alessandro Baretta @ 2002-11-02  8:51 UTC (permalink / raw)
  To: Yurii A. Rashkovskii, Ocaml

I think this is very interesting.

Yurii A. Rashkovskii wrote:
> I've developed small preprocessor module that provides kind of
> namespace support for the Objective Caml.
> 
> It defines following constructs:
> 
> * module ModuleName in [Namespace|Namespace.Namespace]

This method of defining namespaces would require some form 
of central authority allocating namespace "domains" to 
developers, so as to acertain that no two companies or users 
will use the same namespace for their projects. Since this 
would put unnecessary burden on INRIA and on the developers, 
I advocate, as I already mentioned, the XML solution: a 
namespace is an arbitrary string literal enclosed by double 
quotes. The convention would be for each company or 
developer to use URLs pertaining to domains officially 
belonging to them.


> it defines module type ModuleTypeName within namespace
> 
> Example:
>  module type T = sig val test:unit end

Typo?

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-02  8:51 ` Alessandro Baretta
@ 2002-11-02 16:10   ` Yurii A. Rashkovskii
  2002-11-02 16:34     ` Alessandro Baretta
  0 siblings, 1 reply; 18+ messages in thread
From: Yurii A. Rashkovskii @ 2002-11-02 16:10 UTC (permalink / raw)
  To: Alessandro Baretta; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]

Hi Alessandro!

On Sat, 02 Nov 2002, Alessandro Baretta wrote:

> I think this is very interesting.
> 
> Yurii A. Rashkovskii wrote:
> >I've developed small preprocessor module that provides kind of
> >namespace support for the Objective Caml.
> >
> >It defines following constructs:
> >
> >* module ModuleName in [Namespace|Namespace.Namespace]
> 
> This method of defining namespaces would require some form 
> of central authority allocating namespace "domains" to 
> developers, so as to acertain that no two companies or users 
> will use the same namespace for their projects. Since this 
> would put unnecessary burden on INRIA and on the developers, 
> I advocate, as I already mentioned, the XML solution: a 
> namespace is an arbitrary string literal enclosed by double 
> quotes. The convention would be for each company or 
> developer to use URLs pertaining to domains officially 
> belonging to them.
> 

As you can understand, I've proposed using reverse domains
as namespaces - Org.Ocaml, and so on.
 
> >it defines module type ModuleTypeName within namespace
> >
> >Example:
> > module type T = sig val test:unit end
> 
> Typo?

Yes, of course :)

... T in Org.Openeas = ...

-- 
Regards,
Yurii.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-02 16:10   ` Yurii A. Rashkovskii
@ 2002-11-02 16:34     ` Alessandro Baretta
  2002-11-02 16:57       ` Chris Hecker
                         ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Alessandro Baretta @ 2002-11-02 16:34 UTC (permalink / raw)
  To: Yurii A. Rashkovskii, ocaml



Yurii A. Rashkovskii wrote:
> Hi Alessandro!
> 
> 
> As you can understand, I've proposed using reverse domains
> as namespaces - Org.Ocaml, and so on.
>  

It's not really equivalent. Consider my present work. I have 
three ongoing projects: one named afo, one named lib, and 
one named vsg. It would be natural to have a means of 
identifying my company first, and subsequently identifying 
each single project. Your proposal would be to use such 
namespace ids as Com.Baretta.VSG, Com.Baretta.Lib and 
Com.Baretta.Afo. There's nothing wrong with this, but it is 
much less intuitiva and comprehensible than 
"http://priv.baretta.com/afo", 
"http://priv.baretta.com/lib", 
"http://priv.baretta.com/svg". This latter schema allows for 
the identification of a URL -- in this case a private one on 
an intranet -- associated with the project. Further, such a 
schema allows for multiple versions of the same sw -- i.e. a 
private alpha such as the above, and a public release -- to 
coexist without interfering with each other.

Your schema is viable, and it is good to have your proposal 
around. Hopefully, the developers will take a stand on the 
issue and propose a standard themselves, in which case it's 
likely to resemble what you submitted. Yet, I still advocate 
the use of the XML single layered namespace schema as a 
simple, flexibile and effective solution.

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-02 16:34     ` Alessandro Baretta
@ 2002-11-02 16:57       ` Chris Hecker
  2002-11-02 17:20       ` Yurii A. Rashkovskii
  2002-11-02 22:37       ` Lauri Alanko
  2 siblings, 0 replies; 18+ messages in thread
From: Chris Hecker @ 2002-11-02 16:57 UTC (permalink / raw)
  To: Alessandro Baretta, Yurii A. Rashkovskii, ocaml


>proposal would be to use such namespace ids as Com.Baretta.VSG, 
>Com.Baretta.Lib and Com.Baretta.Afo. There's nothing wrong with this, but 
>it is much less intuitiva and comprehensible than 
>"http://priv.baretta.com/afo", "http://priv.baretta.com/lib", 
>"http://priv.baretta.com/svg". This latter schema allows for the 
>identification of a URL -- in this case a private one on an intranet -- 
>associated with the project. Further, such a schema allows for multiple 
>versions of the same sw -- i.e. a private alpha such as the above, and a 
>public release -- to coexist without interfering with each other.

I think his proposal would be Com.Baretta.Priv.Afo, etc., so multiple 
versions would work fine.

I'm not giving an opinion on the matter (haven't thought about it), just 
pointing out that I assumed his 'grammar' for the namespaces was recursive.

Chris



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-02 16:34     ` Alessandro Baretta
  2002-11-02 16:57       ` Chris Hecker
@ 2002-11-02 17:20       ` Yurii A. Rashkovskii
  2002-11-02 17:40         ` Alessandro Baretta
  2002-11-02 22:37       ` Lauri Alanko
  2 siblings, 1 reply; 18+ messages in thread
From: Yurii A. Rashkovskii @ 2002-11-02 17:20 UTC (permalink / raw)
  To: Alessandro Baretta; +Cc: caml-list


[-- Attachment #1.1: Type: text/plain, Size: 1743 bytes --]

Hi Alessandro!

On Sat, 02 Nov 2002, Alessandro Baretta wrote:

> It's not really equivalent. Consider my present work. I have 
> three ongoing projects: one named afo, one named lib, and 
> one named vsg. It would be natural to have a means of 
> identifying my company first, and subsequently identifying 
> each single project. Your proposal would be to use such 
> namespace ids as Com.Baretta.VSG, Com.Baretta.Lib and 
> Com.Baretta.Afo. There's nothing wrong with this, but it is 
> much less intuitiva and comprehensible than 
> "http://priv.baretta.com/afo", 
> "http://priv.baretta.com/lib", 
> "http://priv.baretta.com/svg". This latter schema allows for 
> the identification of a URL -- in this case a private one on 
> an intranet -- associated with the project. Further, such a 
> schema allows for multiple versions of the same sw -- i.e. a 
> private alpha such as the above, and a public release -- to 
> coexist without interfering with each other.

Alexander, attached you'll find new version of ocamlns, that=20
allows both schemas (mine and yours). I should warn you
that it depends on Str library (str.cma) and theoretically
may not work in some cases. New syntax allows defining:

module A in "http://www.domain.org/..."  ...
open A in "http://www.domain.org/..."=20

and so on.

 
> Your schema is viable, and it is good to have your proposal 
> around. Hopefully, the developers will take a stand on the 
> issue and propose a standard themselves, in which case it's 
> likely to resemble what you submitted. Yet, I still advocate 
> the use of the XML single layered namespace schema as a 
> simple, flexibile and effective solution.
> 
> Alex
> 
> 

-- 
Regards,
Yurii.

[-- Attachment #1.2: pa_ns.ml --]
[-- Type: text/plain, Size: 6610 bytes --]

(*******************************************************)
(*                                                     *)
(* OCamlNS                                             *)
(*                                                     *)
(* Copyright (c) 2001, 2002.                           *)
(* E/AS Software Foundation                            *)
(*                                                     *)
(* Author(s):                                          *)
(*    Yurii A. Rashkovskii                             *)
(*                                                     *)
(* This program is free software; you can redistribute *)
(* it and/or modify it under the terms of the GNU      *)
(* Lesser General Public License as published by the   *)
(* Free Software Foundation; version 2 of the License. *)
(*                                                     *)
(*******************************************************)

open Stdpp;;
open Pcaml;;

let mod_ident = Grammar.Entry.create gram "mod_ident";;
let module_binding = Grammar.Entry.create gram "module_binding";;


let rename_module = ref (fun loc -> <:str_item< open Pervasives >>);;

let gen_mod_name l =
    let nsname = ref "" in
    List.iter (fun x -> nsname := !nsname ^ (x ^ "_")) l ; 
    (String.sub !nsname 0 ((String.length !nsname)-1));;

let gen_ns_name l =
    let nsname = ref "" in
    List.iter (fun x -> nsname := !nsname ^ (x ^ "_")) l ; !nsname;;

let gen_ns_name_s ns =
    let slash s = Str.global_replace (Str.regexp "/") "_slash_" s and 
        colon s = Str.global_replace (Str.regexp ":") "_colon_" s and 
        amp s = Str.global_replace (Str.regexp "&") "_amp_" s and 
        q s = Str.global_replace (Str.regexp "?") "_q_" s and 
        qe s = Str.global_replace (Str.regexp "=") "_eq_" s and 
        p s = Str.global_replace (Str.regexp "%") "_p_" s and 
        d s = Str.global_replace (Str.regexp "#") "_d_" s and 
        at s = Str.global_replace (Str.regexp "@") "_at_" s and
        dot s = Str.global_replace (Str.regexp "\\.") "_dot_" s in
     (slash (colon (amp (q (qe (p (d (at (dot ns)))))))));; 

let gen_mod_name_s ns =
    if (String.sub (gen_ns_name_s ns) ((String.length (gen_ns_name_s ns))-1) 1)
     = "_" then
    (String.sub (gen_ns_name_s ns) 0 ((String.length (gen_ns_name_s ns))-1))
    else (gen_ns_name_s ns)
  
    
let gen_module loc mn ns me =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__module___" ^ mn in
    <:str_item< module $uid:name$ = $me$ >>
;;    

let gen_module_s loc mn ns me =
    let name = "caml_namespace___" ^ (gen_ns_name_s ns) ^ "__module___" ^ mn in
    <:str_item< module $uid:name$ = $me$ >>
;;    

let gen_module_type loc mn ns mt =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__moduletype___" ^ mn in
    <:str_item< module type$uid:name$ = $mt$ >>
;;    

let gen_module_type_s loc mn ns mt =
    let name = "caml_namespace___" ^ (gen_ns_name_s ns) ^ "__moduletype___" ^ mn in
    <:str_item< module type$uid:name$ = $mt$ >>
;;    

let gen_module_open loc mn ns =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__module___" ^ mn in
    rename_module := (fun loc -> <:str_item< module $uid:mn$ = $uid:name$>>);    
    <:str_item< open $uid:name$>>
;;    

let gen_module_open_s loc mn ns =
    let name = "caml_namespace___" ^ (gen_ns_name_s ns) ^ "__module___" ^ mn in
    rename_module := (fun loc -> <:str_item< module $uid:mn$ = $uid:name$>>);    
    <:str_item< open $uid:name$>>
;;    

let gen_module_use loc ns =
    let name = (gen_mod_name ns) in
    <:str_item< open $uid:name$>>
;;    

let gen_module_use_s loc ns =
    let name = (gen_mod_name_s ns) in
    <:str_item< open $uid:name$>>
;;    

let gen_module_open_as loc mn ns asn =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__module___" ^ mn in
    rename_module := (fun loc -> <:str_item< module $uid:asn$ = $uid:name$>>);    
    <:str_item< open $uid:name$>>
;;    

let gen_module_open_as_s loc mn ns asn =
    let name = "caml_namespace___" ^ (gen_ns_name_s ns) ^ "__module___" ^ mn in
    rename_module := (fun loc -> <:str_item< module $uid:asn$ = $uid:name$>>);    
    <:str_item< open $uid:name$>>
;;    

let gen_module_sig loc mn ns mt =
    let name = "caml_namespace___" ^ (gen_ns_name ns) ^ "__module___" ^ mn in
    <:sig_item< module $uid:name$ : $mt$ >>
;;    

let gen_module_sig_s loc mn ns mt =
    let name = "caml_namespace___" ^ (gen_ns_name_s ns) ^ "__module___" ^ mn in
    <:sig_item< module $uid:name$ : $mt$ >>
;;    

EXTEND

  mod_ident:
    [ RIGHTA
      [ i = UIDENT -> [i]
      | i = LIDENT -> [i]
      | i = UIDENT; "."; j = SELF -> i :: j ] ]
  ;

  module_binding:
    [ RIGHTA
      [ "("; m = UIDENT; ":"; mt = module_type; ")"; mb = SELF ->
          <:module_expr< functor ( $m$ : $mt$ ) -> $mb$ >>
      | ":"; mt = module_type; "="; me = module_expr ->
          <:module_expr< ( $me$ : $mt$ ) >>
      | "="; me = module_expr -> <:module_expr< $me$ >> ] ]
  ;

  str_item: LEVEL "top"
  [
    [ "module"; i = UIDENT; "in" ; ns = mod_ident ; 
       me = module_binding ->
      gen_module loc i ns me
     |
      "module"; i = UIDENT; "in" ; ns = STRING ; 
       me = module_binding ->
      gen_module_s loc i ns me
     |
     "module";"type"; i = UIDENT; "in" ; ns = mod_ident ; "=";
       mt = module_type ->
      gen_module_type loc i ns mt
     |
     "module";"type"; i = UIDENT; "in" ; ns = STRING ; "=";
       mt = module_type ->
      gen_module_type_s loc i ns mt
     | 
     "open"; i = UIDENT; "in" ; ns = mod_ident ->
      gen_module_open loc i ns ; !rename_module loc
     | 
     "open"; i = UIDENT; "in" ; ns = STRING ->
      gen_module_open_s loc i ns ; !rename_module loc
     | 
     "open"; i = UIDENT; "in" ; ns = mod_ident ; "as" ; asn = UIDENT ->
      gen_module_open_as loc i ns asn; !rename_module loc
     | 
     "open"; i = UIDENT; "in" ; ns = STRING ; "as" ; asn = UIDENT ->
      gen_module_open_as_s loc i ns asn; !rename_module loc
     | 
     "use"; ns = mod_ident  ->
      gen_module_use loc ns
     | 
     "use"; ns = STRING  ->
      gen_module_use_s loc ns
    ]

  ];

  sig_item: LEVEL "top"
  [
    [ "module"; i = UIDENT; "in" ; ns = mod_ident ; ":" ; mt = module_type ->
      gen_module_sig loc i ns mt
     |
      "module"; i = UIDENT; "in" ; ns = STRING ; ":" ; mt = module_type ->
      gen_module_sig_s loc i ns mt
    ]

  ];

END
;

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-02 17:20       ` Yurii A. Rashkovskii
@ 2002-11-02 17:40         ` Alessandro Baretta
  2002-11-02 19:14           ` Yurii A. Rashkovskii
  0 siblings, 1 reply; 18+ messages in thread
From: Alessandro Baretta @ 2002-11-02 17:40 UTC (permalink / raw)
  To: Yurii A. Rashkovskii, Ocaml



Yurii A. Rashkovskii wrote:
> Hi Alessandro!
> 
> On Sat, 02 Nov 2002, Alessandro Baretta wrote:
> 

> Alexander, attached you'll find new version of ocamlns, that=20
> allows both schemas (mine and yours). I should warn you
> that it depends on Str library (str.cma) and theoretically
> may not work in some cases. New syntax allows defining:
> 
> module A in "http://www.domain.org/..."  ...
> open A in "http://www.domain.org/..."=20
> 
> and so on.

Now that's cool! I'll start using it in my alpha work for 
the sake of testing it. Thank you very much.

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-02 17:40         ` Alessandro Baretta
@ 2002-11-02 19:14           ` Yurii A. Rashkovskii
  0 siblings, 0 replies; 18+ messages in thread
From: Yurii A. Rashkovskii @ 2002-11-02 19:14 UTC (permalink / raw)
  To: Alessandro Baretta; +Cc: Ocaml

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

Hi Alessandro!

On Sat, 02 Nov 2002, Alessandro Baretta wrote:

> >module A in "http://www.domain.org/..."  ...
> >open A in "http://www.domain.org/..."=20
> >
> >and so on.
> 
> Now that's cool! I'll start using it in my alpha work for 
> the sake of testing it. Thank you very much.

Cool :-) BTW, I will rewrite URL encoding function in it soon,
to make the code more qualitative (now it is awful).
If you want, I can send it to you when it will be ready.

-- 
Regards,
Yurii.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-02 16:34     ` Alessandro Baretta
  2002-11-02 16:57       ` Chris Hecker
  2002-11-02 17:20       ` Yurii A. Rashkovskii
@ 2002-11-02 22:37       ` Lauri Alanko
  2002-11-04  8:07         ` Alessandro Baretta
  2 siblings, 1 reply; 18+ messages in thread
From: Lauri Alanko @ 2002-11-02 22:37 UTC (permalink / raw)
  To: caml-list

On Sat, Nov 02, 2002 at 05:34:45PM +0100, Alessandro Baretta wrote:
> each single project. Your proposal would be to use such 
> namespace ids as Com.Baretta.VSG, Com.Baretta.Lib and 
> Com.Baretta.Afo. There's nothing wrong with this, but it is 
> much less intuitiva and comprehensible than 
> "http://priv.baretta.com/afo", 
> "http://priv.baretta.com/lib", 
> "http://priv.baretta.com/svg".

Pardon, but I at least don't find it particularly intuitive to find the
name of a network protocol in every namespace identifier. Domain and
path, yes.


Lauri Alanko
la@iki.fi
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-02 22:37       ` Lauri Alanko
@ 2002-11-04  8:07         ` Alessandro Baretta
  2002-11-05 16:27           ` Jeffrey Palmer
  0 siblings, 1 reply; 18+ messages in thread
From: Alessandro Baretta @ 2002-11-04  8:07 UTC (permalink / raw)
  To: Lauri Alanko, ocaml



Lauri Alanko wrote:
> On Sat, Nov 02, 2002 at 05:34:45PM +0100, Alessandro Baretta wrote:
> 
>>"http://priv.baretta.com/afo", 
>>"http://priv.baretta.com/lib", 
>>"http://priv.baretta.com/svg".
> 
> 
> Pardon, but I at least don't find it particularly intuitive to find the
> name of a network protocol in every namespace identifier. Domain and
> path, yes.
> 
> 
> Lauri Alanko
> la@iki.fi

I agree with you, but unless we agree that any resource or 
documentation available on the defined namespace can be 
reached via http at the specified address/path, then we must 
specify the protocol. Choosing http as a standard protocol 
for acessing documentation is definitely reasonable now, but 
in the future other protocols might emerge and dominate the 
scene.

I'm willing to go with "xxx.domain.com/path" if there is 
some consensus about this form of namespace identification.

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-04  8:07         ` Alessandro Baretta
@ 2002-11-05 16:27           ` Jeffrey Palmer
  2002-11-05 22:30             ` Alessandro Baretta
  2002-11-06 10:30             ` Andreas Rossberg
  0 siblings, 2 replies; 18+ messages in thread
From: Jeffrey Palmer @ 2002-11-05 16:27 UTC (permalink / raw)
  To: Alessandro Baretta, Lauri Alanko, ocaml

On Monday 04 November 2002 02:07 am, Alessandro Baretta wrote:
> I agree with you, but unless we agree that any resource or
> documentation available on the defined namespace can be
> reached via http at the specified address/path, then we must
> specify the protocol.

Interesting. Is this model in common usage elsewhere (i.e., relying on a 
namespace specification to indicate documentation repositories)?

I've personally never come across it in other programming languages, but then 
again, I obviously haven't used all of the languages out there... (and I'm 
guessing that the Java org.ocaml.etc hierarchy doesn't fulfill this 
requirement?)

	- jeff


-- 
The river is moving.
The blackbird must be flying.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-05 16:27           ` Jeffrey Palmer
@ 2002-11-05 22:30             ` Alessandro Baretta
  2002-11-06 10:30             ` Andreas Rossberg
  1 sibling, 0 replies; 18+ messages in thread
From: Alessandro Baretta @ 2002-11-05 22:30 UTC (permalink / raw)
  To: Ocaml



Jeffrey Palmer wrote:
> On Monday 04 November 2002 02:07 am, Alessandro Baretta wrote:
> 
>>I agree with you, but unless we agree that any resource or
>>documentation available on the defined namespace can be
>>reached via http at the specified address/path, then we must
>>specify the protocol.
> 
> 
> Interesting. Is this model in common usage elsewhere (i.e., relying on a 
> namespace specification to indicate documentation repositories)?
> 

It is the de facto standard with XML namespaces, although 
the W3C does not mandate it.

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-05 16:27           ` Jeffrey Palmer
  2002-11-05 22:30             ` Alessandro Baretta
@ 2002-11-06 10:30             ` Andreas Rossberg
  2002-11-06 14:17               ` Yurii A. Rashkovskii
  1 sibling, 1 reply; 18+ messages in thread
From: Andreas Rossberg @ 2002-11-06 10:30 UTC (permalink / raw)
  To: ocaml

Jeffrey Palmer wrote:
> 
> > I agree with you, but unless we agree that any resource or
> > documentation available on the defined namespace can be
> > reached via http at the specified address/path, then we must
> > specify the protocol.
> 
> Interesting. Is this model in common usage elsewhere (i.e., relying on a
> namespace specification to indicate documentation repositories)?
> 
> I've personally never come across it in other programming languages

Oz uses URIs to identify and locate modules. By default, the system
recognizes file:, http: and x-oz: schemes, the latter denoting the
standard library. Module management is programmable however, so that it
may be extended to handle other schemes/protocols.

	- Andreas

-- 
Andreas Rossberg, rossberg@ps.uni-sb.de

"Computer games don't affect kids; I mean if Pac Man affected us
 as kids, we would all be running around in darkened rooms, munching
 magic pills, and listening to repetitive electronic music."
 - Kristian Wilson, Nintendo Inc.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-06 10:30             ` Andreas Rossberg
@ 2002-11-06 14:17               ` Yurii A. Rashkovskii
  2002-11-06 16:27                 ` Alessandro Baretta
  0 siblings, 1 reply; 18+ messages in thread
From: Yurii A. Rashkovskii @ 2002-11-06 14:17 UTC (permalink / raw)
  To: Andreas Rossberg; +Cc: ocaml

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

Moin Andreas!

Andreas Rossberg schrieb am Wednesday, den 06. November 2002:

> Oz uses URIs to identify and locate modules. By default, the system
> recognizes file:, http: and x-oz: schemes, the latter denoting the
> standard library. Module management is programmable however, so that it
> may be extended to handle other schemes/protocols.

BTW, it's a nice idea. Most probably next release of OCamlNS will
deprecate my style of namespaces (Org.Ocaml.[...]) and let namespace
be "proto://..." and I'll develop ocamlnsc and ocamlnsopt that will
use namespace URLs to get the modules (even via http) and pass them
to ocamlc|ocamlopt (in way like ocamlfind). I don't know whether this
feature is demanded by ocaml users community, but for me it looks
very attractive and probably I'll use it my project. 

In my thoughts I think that URL should point to a kinda textual
module description (with dependencies and so on).

-- 
Regards,
Yurii.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-06 14:17               ` Yurii A. Rashkovskii
@ 2002-11-06 16:27                 ` Alessandro Baretta
  2002-11-06 16:56                   ` Yurii A. Rashkovskii
  0 siblings, 1 reply; 18+ messages in thread
From: Alessandro Baretta @ 2002-11-06 16:27 UTC (permalink / raw)
  To: Yurii A. Rashkovskii, ocaml



Yurii A. Rashkovskii wrote:
> Moin Andreas!
> 
> Andreas Rossberg schrieb am Wednesday, den 06. November 2002:
> 
> 
>>Oz uses URIs to identify and locate modules. By default, the system
>>recognizes file:, http: and x-oz: schemes, the latter denoting the
>>standard library. Module management is programmable however, so that it
>>may be extended to handle other schemes/protocols.
> 
> 
> BTW, it's a nice idea. Most probably next release of OCamlNS will
> deprecate my style of namespaces (Org.Ocaml.[...]) and let namespace
> be "proto://..." and I'll develop ocamlnsc and ocamlnsopt that will
> use namespace URLs to get the modules (even via http) and pass them
> to ocamlc|ocamlopt (in way like ocamlfind). I don't know whether this
> feature is demanded by ocaml users community, but for me it looks
> very attractive and probably I'll use it my project. 
> 
> In my thoughts I think that URL should point to a kinda textual
> module description (with dependencies and so on).

I think this is a very cool feature. It has some interesting 
  implications which must be worked out first. Consider the 
case where the user is not connected to the same service 
that provides the package. A portable computer user, for 
example, or simply someone wishing to install from 
disk-based source distribution. There must be an alternative 
way of resolving packages. One solution might be defining a 
CAMLPATH environment variable à la Java CLASSPATH, and 
looking for the modules in 
<camlpath_directory>/<ns_url_path> before actually 
attempting a network connection.

Finally, a really cool, cool, cool feature would be dynamic 
linking of Ocaml modules from their namespace URL, with 
static typechecking at compile time against the 
corresponding .mli files. How do you like this idea, Yurii?

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-06 16:27                 ` Alessandro Baretta
@ 2002-11-06 16:56                   ` Yurii A. Rashkovskii
  2002-11-06 19:30                     ` Christian Lindig
  0 siblings, 1 reply; 18+ messages in thread
From: Yurii A. Rashkovskii @ 2002-11-06 16:56 UTC (permalink / raw)
  To: Alessandro Baretta; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1791 bytes --]

Hi Alessandro!

On Wed, 06 Nov 2002, Alessandro Baretta wrote:

> >BTW, it's a nice idea. Most probably next release of OCamlNS will
> >deprecate my style of namespaces (Org.Ocaml.[...]) and let namespace
> >be "proto://..." and I'll develop ocamlnsc and ocamlnsopt that will
> >use namespace URLs to get the modules (even via http) and pass them
> >to ocamlc|ocamlopt (in way like ocamlfind). I don't know whether this
> >feature is demanded by ocaml users community, but for me it looks
> >very attractive and probably I'll use it my project. 
> 
> I think this is a very cool feature. It has some interesting 
>  implications which must be worked out first. Consider the 
> case where the user is not connected to the same service 
> that provides the package. A portable computer user, for 
> example, or simply someone wishing to install from 
> disk-based source distribution. There must be an alternative 
> way of resolving packages. One solution might be defining a 
> CAMLPATH environment variable ? la Java CLASSPATH, and 
> looking for the modules in 
> <camlpath_directory>/<ns_url_path> before actually 
> attempting a network connection.

I've already thought of it and have an idea how to resolve
this problem. It is basically matches yours (something
like local-proxy). In fact, since a lot of my development
goes at my home PC w/ only dialup, it is a very important
thing for me, so this problem will be resolved at the best
way :)
 
> Finally, a really cool, cool, cool feature would be dynamic 
> linking of Ocaml modules from their namespace URL, with 
> static typechecking at compile time against the 
> corresponding .mli files. How do you like this idea, Yurii?

Well, I like and will implement it soon.

-- 
Regards,
Yurii.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-06 16:56                   ` Yurii A. Rashkovskii
@ 2002-11-06 19:30                     ` Christian Lindig
  2002-11-06 20:36                       ` Alessandro Baretta
  0 siblings, 1 reply; 18+ messages in thread
From: Christian Lindig @ 2002-11-06 19:30 UTC (permalink / raw)
  To: caml-list

On Wed, Nov 06, 2002 at 06:56:23PM +0200, Yurii A. Rashkovskii wrote:
> > Finally, a really cool, cool, cool feature would be dynamic linking
> > of Ocaml modules from their namespace URL, with static typechecking
> > at compile time against the corresponding .mli files. How do you
> > like this idea, Yurii?
> 
> Well, I like and will implement it soon.

Dynamic linking suggests that you are linking *.cmo files but the
previous author talked about *.mli files. Anyway, linking binary object
files and hence libraries is a can of worms: files from different
compiler versions are incompatible. Any ideas about this?

-- Christian
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Caml-list] module namespace
  2002-11-06 19:30                     ` Christian Lindig
@ 2002-11-06 20:36                       ` Alessandro Baretta
  0 siblings, 0 replies; 18+ messages in thread
From: Alessandro Baretta @ 2002-11-06 20:36 UTC (permalink / raw)
  To: Ocaml



Christian Lindig wrote:
> On Wed, Nov 06, 2002 at 06:56:23PM +0200, Yurii A. Rashkovskii wrote:
> 
>>>Finally, a really cool, cool, cool feature would be dynamic linking
>>>of Ocaml modules from their namespace URL, with static typechecking
>>>at compile time against the corresponding .mli files. How do you
>>>like this idea, Yurii?
>>
>>Well, I like and will implement it soon.
> 
> 
> Dynamic linking suggests that you are linking *.cmo files but the
> previous author talked about *.mli files. Anyway, linking binary object
> files and hence libraries is a can of worms: files from different
> compiler versions are incompatible. Any ideas about this?
> 
> -- Christian

This is no big deal really. Compiled modules and compiled 
interfaces are "signed" by the compiler with an MD5 checksum 
and with the compiler's own version number. Here's a brief 
discussion of the topic by Xavier: 
http://caml.inria.fr/archives/200208/msg00004.html.

The runtime system will simply have to throw an exception at 
runtime if it is unable to locate the appropriate module, 
with the correct checksum and version number. Runtime 
exceptions are the price to pay for runtime linking.

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2002-11-06 20:36 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-02  0:24 [Caml-list] module namespace Yurii A. Rashkovskii
2002-11-02  8:51 ` Alessandro Baretta
2002-11-02 16:10   ` Yurii A. Rashkovskii
2002-11-02 16:34     ` Alessandro Baretta
2002-11-02 16:57       ` Chris Hecker
2002-11-02 17:20       ` Yurii A. Rashkovskii
2002-11-02 17:40         ` Alessandro Baretta
2002-11-02 19:14           ` Yurii A. Rashkovskii
2002-11-02 22:37       ` Lauri Alanko
2002-11-04  8:07         ` Alessandro Baretta
2002-11-05 16:27           ` Jeffrey Palmer
2002-11-05 22:30             ` Alessandro Baretta
2002-11-06 10:30             ` Andreas Rossberg
2002-11-06 14:17               ` Yurii A. Rashkovskii
2002-11-06 16:27                 ` Alessandro Baretta
2002-11-06 16:56                   ` Yurii A. Rashkovskii
2002-11-06 19:30                     ` Christian Lindig
2002-11-06 20:36                       ` Alessandro Baretta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).