The Meta-Object Facility ( MOF ) is an Object Management Group (OMG) standard for model-driven engineering . Its purpose is to provide a type system for entities in the CORBA architecture and a set of interfaces through which those types can be created and manipulated. MOF may be used for domain-driven software design and object-oriented modelling .
62-506: MOF was developed to provide a type system for use in the CORBA architecture, a set of schemas by which the structure, meaning and behaviour of objects could be defined, and a set of CORBA interfaces through which these schemas could be created, stored and manipulated. MOF is designed as a four-layered architecture. It provides a meta-meta model at the top layer, called the M3 layer. This M3-model
124-475: A dependent type or an effect system , which enables even more program specifications to be verified by a type checker. Beyond simple value-type pairs, a virtual "region" of code is associated with an "effect" component describing what is being done with what , and enabling for example to "throw" an error report. Thus the symbolic system may be a type and effect system , which endows it with more safety checking than type checking alone. Whether automated by
186-402: A floating-point value , then the wrong result will be computed by the invoked function. The C compiler checks the types of the arguments passed to a function when it is called against the types of the parameters declared in the function's definition. If the types do not match, the compiler throws a compile-time error or warning. A compiler may also use the static type of a value to optimize
248-510: A request for proposal was issued by OMG for a third variant, SMOF (Semantic MOF). The variant ECore that has been defined in the Eclipse Modeling Framework is more or less aligned on OMG's EMOF. Another related standard is OCL , which describes a formal language that can be used to define model constraints in terms of predicate logic . QVT , which introduces means to query, view and transform MOF-based models,
310-423: A runtime error . To prove the absence of these defects, other kinds of formal methods , collectively known as program analyses , are in common use. Alternatively, a sufficiently expressive type system, such as in dependently typed languages, can prevent these kinds of errors (for example, expressing the type of non-zero numbers ). In addition, software testing is an empirical method for finding errors that such
372-423: A type system is a logical system comprising a set of rules that assigns a property called a type (for example, integer , floating point , string ) to every term (a word, phrase, or other set of symbols). Usually the terms are various language constructs of a computer program , such as variables , expressions , functions , or modules . A type system dictates the operations that can be performed on
434-639: A DSL operational semantics and readily obtain an interpreter for it. JMI defines a Java API for manipulating MOF models. OMG's MOF is not to be confused with the Managed Object Format (MOF) defined by the Distributed Management Task Force (DMTF) in section 6 of the Common Information Model (CIM) Infrastructure Specification, version 2.5.0. Type system In computer programming ,
496-565: A certain kind of value from being used with values of which that operation does not make sense (validity errors). Type systems allow defining interfaces between different parts of a computer program, and then checking that the parts have been connected in a consistent way. This checking can happen statically (at compile time ), dynamically (at run time ), or as a combination of both. Type systems have other purposes as well, such as expressing business rules, enabling certain compiler optimizations , allowing for multiple dispatch , and providing
558-400: A data type, termed typing , gives meaning to a sequence of bits such as a value in memory or some object such as a variable . The hardware of a general purpose computer is unable to discriminate between for example a memory address and an instruction code , or between a character , an integer , or a floating-point number , because it makes no intrinsic distinction between any of
620-405: A deductive system would be the rules of inference and axioms regarding equality used in first order logic . The two main types of deductive systems are proof systems and formal semantics. Formal proofs are sequences of well-formed formulas (or WFF for short) that might either be an axiom or be the product of applying an inference rule on previous WFFs in the proof sequence. The last WFF in
682-801: A dynamic check is needed to verify that the operation is safe. This requirement is one of the criticisms of downcasting. By definition, dynamic type checking may cause a program to fail at runtime. In some programming languages, it is possible to anticipate and recover from these failures. In others, type-checking errors are considered fatal. Programming languages that include dynamic type checking but not static type checking are often called "dynamically typed programming languages". Some languages allow both static and dynamic typing. For example, Java and some other ostensibly statically typed languages support downcasting types to their subtypes , querying an object to discover its dynamic type and other type operations that depend on runtime type information. Another example
SECTION 10
#1732782524601744-405: A form of documentation . An example of a simple type system is that of the C language . The portions of a C program are the function definitions. One function is invoked by another function. The interface of a function states the name of the function and a list of parameters that are passed to the function's code. The code of an invoking function states the name of the invoked, along with
806-475: A language can be statically typed without requiring type declarations (examples include Haskell , Scala , OCaml , F# , Swift , and to a lesser extent C# and C++ ), so explicit type declaration is not a necessary requirement for static typing in all languages. Dynamic typing allows constructs that some (simple) static type checking would reject as illegal. For example, eval functions, which execute arbitrary data as code, become possible. An eval function
868-513: A line of code divides two integers, and is passed a string of letters instead of an integer. It is an unintended condition which might manifest in multiple stages of a program's development. Thus a facility for detection of the error is needed in the type system. In some languages, such as Haskell , for which type inference is automated, lint might be available to its compiler to aid in the detection of error. Type safety contributes to program correctness , but might only guarantee correctness at
930-402: A logical system may be given interpretations which describe whether a given structure - the mapping of formulas to a particular meaning - satisfies a well-formed formula. A structure that satisfies all the axioms of the formal system is known as a model of the logical system. A logical system is: An example of a logical system is Peano arithmetic . The standard model of arithmetic sets
992-469: A more finely grained rule set than basic type checking, but this comes at a price when the type inferences (and other properties) become undecidable , and when more attention must be paid by the programmer to annotate code or to consider computer-related operations and functioning. It is challenging to find a sufficiently expressive type system that satisfies all programming practices in a type safe manner. A programming language compiler can also implement
1054-818: A reference whose static target type (or manifest type) is equal to either the object's run-time type (its latent type) or a supertype thereof. This is conformant with the Liskov substitution principle , which states that all operations performed on an instance of a given type can also be performed on an instance of a subtype. This concept is also known as subsumption or subtype polymorphism . In some languages subtypes may also possess covariant or contravariant return types and argument types respectively. Certain languages, for example Clojure , Common Lisp , or Cython are dynamically type checked by default, but allow programs to opt into static type checking by providing optional annotations. One reason to use such hints would be to optimize
1116-420: A static type checker. The reason for this is that many useful features or properties are difficult or impossible to verify statically. For example, suppose that a program defines two types, A and B, where B is a subtype of A. If the program tries to convert a value of type A to type B, which is known as downcasting , then the operation is legal only if the value being converted is actually a value of type B. Thus,
1178-407: A strict sense. Static type checking is the process of verifying the type safety of a program based on analysis of a program's text ( source code ). If a program passes a static type checker, then the program is guaranteed to satisfy some set of type safety properties for all possible inputs. Static type checking can be considered a limited form of program verification (see type safety ), and in
1240-417: A string can be analyzed to determine whether it is a member of the language. A deductive system , also called a deductive apparatus , consists of the axioms (or axiom schemata ) and rules of inference that can be used to derive theorems of the system. Such deductive systems preserve deductive qualities in the formulas that are expressed in the system. Usually the quality we are concerned with
1302-436: A term. For variables, the type system determines the allowed values of that term. Type systems formalize and enforce the otherwise implicit categories the programmer uses for algebraic data types , data structures , or other data types , such as "string", "array of float", "function returning boolean". Type systems are often specified as part of programming languages and built into interpreters and compilers , although
SECTION 20
#17327825246011364-467: A type checker would not detect. The process of verifying and enforcing the constraints of types— type checking —may occur at compile time (a static check) or at run-time (a dynamic check). If a language specification requires its typing rules strongly, more or less allowing only those automatic type conversions that do not lose information, one can refer to the process as strongly typed; i f not, as weakly typed . The terms are not usually used in
1426-447: A type-safe language, can also be considered an optimization. If a compiler can prove that a program is well-typed, then it does not need to emit dynamic safety checks, allowing the resulting compiled binary to run faster and to be smaller. Static type checking for Turing-complete languages is inherently conservative. That is, if a type system is both sound (meaning that it rejects all incorrect programs) and decidable (meaning that it
1488-436: A type. Even a type can become associated with a type. An implementation of a type system could in theory associate identifications called data type (a type of a value), class (a type of an object), and kind (a type of a type , or metatype). These are the abstractions that typing can go through, on a hierarchy of levels contained in a system. When a programming language evolves a more elaborate type system, it gains
1550-636: A value between any two types that have the same size, effectively subverting the type concept. Dynamic type checking is the process of verifying the type safety of a program at runtime. Implementations of dynamically type-checked languages generally associate each runtime object with a type tag (i.e., a reference to a type) containing its type information. This runtime type information (RTTI) can also be used to implement dynamic dispatch , late binding , downcasting , reflective programming (reflection), and similar features. Most type-safe languages include some form of dynamic type checking, even if they also have
1612-410: A way to bypass the type checker. Some languages allow programmers to choose between static and dynamic type safety. For example, historically C# declares variables statically, but C# 4.0 introduces the dynamic keyword, which is used to declare variables to be checked dynamically at runtime. Other languages allow writing code that is not type-safe; for example, in C , programmers can freely cast
1674-506: Is C++ RTTI . More generally, most programming languages include mechanisms for dispatching over different 'kinds' of data, such as disjoint unions , runtime polymorphism , and variant types . Even when not interacting with type annotations or type checking, such mechanisms are materially similar to dynamic typing implementations. See programming language for more discussion of the interactions between static and dynamic typing. Objects in object-oriented languages are usually accessed by
1736-455: Is truth as opposed to falsehood. However, other modalities , such as justification or belief may be preserved instead. In order to sustain its deductive integrity, a deductive apparatus must be definable without reference to any intended interpretation of the language. The aim is to ensure that each line of a derivation is merely a logical consequence of the lines that precede it. There should be no element of any interpretation of
1798-465: Is a language that is defined by a formal system. Like languages in linguistics , formal languages generally have two aspects: Usually only the syntax of a formal language is considered via the notion of a formal grammar . The two main categories of formal grammar are that of generative grammars , which are sets of rules for how strings in a language can be written, and that of analytic grammars (or reductive grammar ), which are sets of rules for how
1860-489: Is a very important standard, approved in 2008. See Model Transformation Language for further information. MOF is an international standard: MOF can be viewed as a standard to write metamodels , for example in order to model the abstract syntax of Domain Specific Languages . Kermeta is an extension to MOF allowing executable actions to be attached to EMOF meta-models, hence making it possible to also model
1922-410: Is all there is to mathematics is often called formalism . David Hilbert founded metamathematics as a discipline for discussing formal systems. Any language that one uses to talk about a formal system is called a metalanguage . The metalanguage may be a natural language, or it may be partially formalized itself, but it is generally less completely formalized than the formal language component of
Meta-Object Facility - Misplaced Pages Continue
1984-495: Is an XML-based exchange format for models. From MOF to Java™ there is the Java Metadata Interchange (JMI) specification by Java Community Process . It also provides specs to make easier automatic CORBA IDL interfaces generation. MOF is a closed metamodeling architecture; it defines an M3-model, which conforms to itself. MOF allows a strict meta-modeling architecture; every model element on every layer
2046-427: Is increased. Advocates of dependent typing , implemented in languages such as Dependent ML and Epigram , have suggested that almost all bugs can be considered type errors, if the types used in a program are properly declared by the programmer or correctly inferred by the compiler. Static typing usually results in compiled code that executes faster. When the compiler knows the exact data types that are in use (which
2108-500: Is necessary for static verification, either through declaration or inference) it can produce optimized machine code. Some dynamically typed languages such as Common Lisp allow optional type declarations for optimization for this reason. By contrast, dynamic typing may allow compilers to run faster and interpreters to dynamically load new code, because changes to source code in dynamically typed languages may result in less checking to perform and less code to revisit. This too may reduce
2170-402: Is possible to write an algorithm that determines whether a program is well-typed), then it must be incomplete (meaning there are correct programs, which are also rejected, even though they do not encounter runtime errors). For example, consider a program containing the code: Even if the expression <complex test> always evaluates to true at run-time, most type checkers will reject
2232-713: Is possible with static typing, but requires advanced uses of algebraic data types . Further, dynamic typing better accommodates transitional code and prototyping, such as allowing a placeholder data structure ( mock object ) to be transparently used in place of a full data structure (usually for the purposes of experimentation and testing). Dynamic typing typically allows duck typing (which enables easier code reuse ). Many languages with static typing also feature duck typing or other mechanisms like generic programming that also enable easier code reuse. Dynamic typing typically makes metaprogramming easier to use. For example, C++ templates are typically more cumbersome to write than
2294-408: Is sometimes a rough synonym for formal system , but it also refers to a given style of notation , for example, Paul Dirac 's bra–ket notation . A formal system has the following: A formal system is said to be recursive (i.e. effective) or recursively enumerable if the set of axioms and the set of inference rules are decidable sets or semidecidable sets , respectively. A formal language
2356-582: Is strictly in correspondence with a model element of the layer above. MOF only provides a means to define the structure, or abstract syntax of a language or of data. For defining metamodels, MOF plays exactly the role that EBNF plays for defining programming language grammars. MOF is a Domain Specific Language (DSL) used to define metamodels, just as EBNF is a DSL for defining grammars. Similarly to EBNF, MOF could be defined in MOF. In short, MOF uses
2418-561: Is the language used by MOF to build metamodels, called M2-models. The most prominent example of a Layer 2 MOF model is the UML metamodel, the model that describes the UML itself. These M2-models describe elements of the M1-layer, and thus M1-models. These would be, for example, models written in UML. The last layer is the M0-layer or data layer. It is used to describe real-world objects. Beyond
2480-454: The domain of discourse to be the nonnegative integers and gives the symbols their usual meaning. There are also non-standard models of arithmetic . Early logic systems includes Indian logic of Pāṇini , syllogistic logic of Aristotle, propositional logic of Stoicism, and Chinese logic of Gongsun Long (c. 325–250 BCE) . In more recent times, contributors include George Boole , Augustus De Morgan , and Gottlob Frege . Mathematical logic
2542-600: The M3-model, MOF describes the means to create and manipulate models and metamodels by defining CORBA interfaces that describe those operations. Because of the similarities between the MOF M3-model and UML structure models, MOF metamodels are usually modeled as UML class diagrams. A conversion from MOF specification models (M3-, M2-, or M1-Layer) to W3C XML and XSD are specified by the XMI (ISO/IEC 19503) specification. XMI
Meta-Object Facility - Misplaced Pages Continue
2604-445: The combination of all places where values are created and all places where a certain value is used must be taken into account. A number of useful and common programming language features cannot be checked statically, such as downcasting . Thus, many languages will have both static and dynamic type checking; the static type checker verifies what it can, and dynamic checks verify the rest. Many languages with static type checking provide
2666-399: The compiler or specified by a programmer, a type system renders program behavior illegal if it falls outside the type-system rules. Advantages provided by programmer-specified type systems include: Advantages provided by compiler-specified type systems include: A type error occurs when an operation receives a different type of data than it expected. For example, a type error would happen if
2728-468: The cost of making the type checking itself an undecidable problem (as in the Halting problem ). In a type system with automated type checking, a program may prove to run incorrectly yet produce no compiler errors. Division by zero is an unsafe and incorrect operation, but a type checker which only runs at compile time does not scan for division by zero in most languages; that division would surface as
2790-437: The differences between type systems that lead people to call them "strong" or "weak". Logical system A formal system is an abstract structure and formalization of an axiomatic system used for deducing , using rules of inference , theorems from axioms by a set of inference rules . In 1921, David Hilbert proposed to use formal systems as the foundation of knowledge in mathematics . The term formalism
2852-427: The edit-compile-test-debug cycle. Statically typed languages that lack type inference (such as C and Java prior to version 10 ) require that programmers declare the types that a method or function must use. This can serve as added program documentation, that is active and dynamic, instead of static. This allows a compiler to prevent it from drifting out of synchrony, and from being ignored by programmers. However,
2914-468: The equivalent Ruby or Python code since C++ has stronger rules regarding type definitions (for both functions and variables). This forces a developer to write more boilerplate code for a template than a Python developer would need to. More advanced run-time constructs such as metaclasses and introspection are often harder to use in statically typed languages. In some languages, such features may also be used e.g. to generate new types and behaviors on
2976-450: The fly, based on run-time data. Such advanced constructs are often provided by dynamic programming languages ; many of these are dynamically typed, although dynamic typing need not be related to dynamic programming languages . Languages are often colloquially referred to as strongly typed or weakly typed . In fact, there is no universally accepted definition of what these terms mean. In general, there are more precise terms to represent
3038-458: The formal system under examination, which is then called the object language , that is, the object of the discussion in question. The notion of theorem just defined should not be confused with theorems about the formal system , which, in order to avoid confusion, are usually called metatheorems . A logical system is a deductive system (most commonly first order logic ) together with additional non-logical axioms . According to model theory ,
3100-468: The language that gets involved with the deductive nature of the system. The logical consequence (or entailment) of the system by its logical foundation is what distinguishes a formal system from others which may have some basis in an abstract model. Often the formal system will be the basis for or even identified with a larger theory or field (e.g. Euclidean geometry ) consistent with the usage in modern mathematics such as model theory . An example of
3162-511: The manner of their evaluation affect the typing of the language. A programming language may further associate an operation with various resolutions for each type, in the case of type polymorphism . Type theory is the study of type systems. The concrete types of some programming languages, such as integers and strings, depend on practical issues of computer architecture , compiler implementation, and language design . Formally, type theory studies type systems. A programming language must have
SECTION 50
#17327825246013224-411: The names of variables that hold values to pass to it. During a computer program 's execution, the values are placed into temporary storage, then execution jumps to the code of the invoked function. The invoked function's code accesses the values and makes use of them. If the instructions inside the function are written with the assumption of receiving an integer value, but the calling code passed
3286-463: The notion of MOF::Classes (not to be confused with UML::Classes ), as known from object orientation , to define concepts (model elements) on a metalayer. MOF may be used to define object-oriented metamodels (as UML for example) as well as non object-oriented metamodels (e.g. a Petri net or a Web Service metamodel). As of May 2006, the OMG has defined two compliance points for MOF: In June 2006,
3348-452: The opportunity to type check using the type system whether at compile time or runtime, manually annotated or automatically inferred. As Mark Manasse concisely put it: The fundamental problem addressed by a type theory is to ensure that programs have meaning. The fundamental problem caused by a type theory is that meaningful programs may not have meanings ascribed to them. The quest for richer type systems results from this tension. Assigning
3410-502: The performance of critical sections of a program. This is formalized by gradual typing . The programming environment DrRacket , a pedagogic environment based on Lisp, and a precursor of the language Racket is also soft-typed. Conversely, as of version 4.0, the C# language provides a way to indicate that a variable should not be statically type checked. A variable whose type is dynamic will not be subject to static type checking. Instead,
3472-485: The possible values that a sequence of bits might mean . Associating a sequence of bits with a type conveys that meaning to the programmable hardware to form a symbolic system composed of that hardware and some program. A program associates each value with at least one specific type, but it also can occur that one value is associated with many subtypes . Other entities, such as objects , modules , communication channels , and dependencies can become associated with
3534-415: The program as ill-typed, because it is difficult (if not impossible) for a static analyzer to determine that the else branch will not be taken. Consequently, a static type checker will quickly detect type errors in rarely used code paths. Without static type checking, even code coverage tests with 100% coverage may be unable to find such type errors. The tests may fail to detect such type errors, because
3596-502: The program relies on runtime type information to determine how the variable may be used. In Rust , the dyn std :: any :: Any type provides dynamic typing of ' static types. The choice between static and dynamic typing requires certain trade-offs . Static typing can find type errors reliably at compile time, which increases the reliability of the delivered program. However, programmers disagree over how commonly type errors occur, resulting in further disagreements over
3658-409: The proportion of those bugs that are coded that would be caught by appropriately representing the designed types in code. Static typing advocates believe programs are more reliable when they have been well type-checked, whereas dynamic-typing advocates point to distributed code that has proven reliable and to small bug databases. The value of static typing increases as the strength of the type system
3720-453: The sequence is recognized as a theorem . Once a formal system is given, one can define the set of theorems which can be proved inside the formal system. This set consists of all WFFs for which there is a proof. Thus all axioms are considered theorems. Unlike the grammar for WFFs, there is no guarantee that there will be a decision procedure for deciding whether a given WFF is a theorem or not. The point of view that generating formal proofs
3782-476: The storage it needs and the choice of algorithms for operations on the value. In many C compilers the float data type , for example, is represented in 32 bits , in accord with the IEEE specification for single-precision floating point numbers . They will thus use floating-point-specific microprocessor operations on those values (floating-point addition, multiplication, etc.). The depth of type constraints and
SECTION 60
#17327825246013844-430: The type system of a language can be extended by optional tools that perform added checks using the language's original type syntax and grammar . The main purpose of a type system in a programming language is to reduce possibilities for bugs in computer programs due to type errors . The given type system in question determines what constitutes a type error, but in general, the aim is to prevent operations expecting
#600399