. | Ada, C#, CoffeeScript, E, F#, Go, Haskell, Java, Modula-3, OCaml, Pascal, Python, Ruby, SML, Squeak |
: | XML |
:: | C++, merd, Perl, Ruby, Squeak, Tcl, YCP |
: ::(1) | Common Lisp |
:- | Maple |
' | Perl |
` | Mathematica |
__ | Mercury |
/ | Matlab |
package p; | Java, Perl |
namespace p { ... } | C#, C++ |
namespace p ... | F# |
namespace P; | PHP5 |
namespace eval p ... | Tcl |
module p where ... | Haskell |
module P ... end | Ruby |
module P = struct ... end | OCaml |
{ module "p"; ... } | YCP |
:- module(p) | Prolog |
p = module() ... end module | Maple |
(defpackage p ...) | Common Lisp |
automatically done based on the file name | OCaml, Python, Tcl8.5 |
package declare(2) | Matlab |
Begin["p`"] ... End[] | Mathematica |
BeginPackage["p`"] ... EndPackage[] | Mathematica |
<node xmlns="namespace"> ... </node> | XML |
package p is -- Declare public package members here private -- Declare private package members here end p; package body p is ... -- Define package implementation here end p; | Ada |
package p | Go |
selective export
module p (name1, name2, ...) where ... | Haskell |
@ISA = qw(Exporter); @EXPORT = qw(name1 name2 ...); | Perl |
package p is ... end; package body p is ... end; | Ada |
p = module() export name1, name2, ...; ... end module | Maple |
(export 'name1 'name2) | Common Lisp |
attached to each name (public, private...) | Java, Pike |
namespace export name1 | Tcl |
namespace p val name1 : type1 ... | F# |
append_features | Ruby |
module type PType = sig val name1 : type1 ... end module P : PType = struct ... end | OCaml |
all files in package directory are exported. files in /private sub-directory are not exported, but can be used by the package itself | Matlab |
__all__ = [ ... ] | Python |
Identifier is only exported if the first character of its name is an Unicode upper case letter; and the identifier is declared in the package block or it is a field name or method name. No other identifiers are exported | Go |
everything into current namespace
use p(3) | Perl |
uses p | Pascal |
using p | C# |
using namespace p; | C++ |
(use-package 'p) | Common Lisp |
open p | F#, OCaml |
import | Pike |
import p | Haskell |
IMPORT p; | Modula-2 |
import p.* | Java |
import "p" | YCP |
from p import * | Python |
with p; use p; | Ada |
namespace import p * | Tcl |
inherit c export {NONE} all end | Eiffel |
include or even extend | Ruby |
do | Rebol |
addpath | Matlab |
. p | BourneShell |
source p | BourneShell |
builtin -f /path/to/lib.so | KornShell |
<< p` | Mathematica |
Get["p`"] | Mathematica |
Needs["p`"] | Mathematica |
use P1\P; | PHP5 |
use P1\P as Q; | PHP5 |
selectively
import p (name1, name2, ...) | Haskell |
import p.name1; import p.name2 | Java |
(import '(p:name1 p:name2)) | Common Lisp |
use p qw(name1 name2 ...) | Perl |
from p import name1, name2, ... | Python |
FROM p IMPORT name1, name2, ...; | Modula-2 |
namespace import p name1 | Tcl |
using p::name1; using p::name2; ... | C++ |
with p; use type p.type1; ... | Ada |
with(p[name1, name2,]) | Maple |
def name := <import:p.name> | E |
:- use_module(name1, name2, ...) | Prolog |
package (ie. load the package)
import p | Python |
use p;(4) | Perl |
require p | Perl |
require "p" | Ruby |
require, "p" | Yorick |
(require 'p)(5) | Common Lisp |
with p; | Ada |
with(p) | Maple |
package require p | Tcl |
automatically done(6) | Java, OCaml |
import "p" | Go |