encyclopegia.org

Magik (programming language)

Magik is an object-oriented programming language that supports multiple inheritance and polymorphism, and it is dynamically typed.[src] It was designed and implemented in 1989 by Arthur Chance of Smallworld Systems Ltd.[src] as part of Smallworld Geographical Information System (GIS).[src] Following Smallworld's acquisition in 2000, Magik is now provided by GE Energy, still as part of its Smallworld technology platform.[src] Magik (Inspirational Magik) was originally introduced in 1990 and has been improved and updated over the years.[src] Its current version is 5.2.[src] In July 2012, Magik developers announced that they were in the process of porting Magik language on the Java virtual machine.[src] The successful porting was confirmed by Oracle Corporation in November of the same year.[src]

Magik is an object-oriented programming language that supports multiple inheritance and polymorphism, and it is dynamically typed.[src] It was designed and implemented in 1989 by Arthur Chance of Smallworld Systems Ltd.[src] as part of Smallworld Geographical Information System (GIS).[src] Following Smallworld's acquisition in 2000, Magik is now provided by GE Energy, still as part of its Smallworld technology platform.[src] Magik (Inspirational Magik) was originally introduced in 1990 and has been improved and updated over the years.[src] Its current version is 5.2.[src] In July 2012, Magik developers announced that they were in the process of porting Magik language on the Java virtual machine.[src] The successful porting was confirmed by Oracle Corporation in November of the same year.[src] ==Similarities with Smalltalk== Magik itself shares some similarities with Smalltalk in terms of its language features and its architecture: the Magik language is compiled into byte codes interpreted by the Magik virtual machine.[src] The Magik virtual machine is available on several platforms including Microsoft Windows, various flavours of Unix and Linux.[src] Magik is console based and code can be modified on the fly even when an application is running.[src] The console can also be used to execute Magik code and to see the results.[src] Compiled code is stored in a single file called an image file.[src] Each image file holds the compiled byte-codes and the state of the session (for example variable values) when the image was last saved.[src] ==Language features== ===Comments=== Magik uses the # token to mark sections of code as comments: # This is a comment.[src] ===Assignments=== Magik uses the operator to make assignments: a For clarity, this notation is read as "a becomes 1.234" or "b becomes b plus a".[src] This terminology separates assignment from comparison.[src] Magik also supports a compressed variation of this operator that works in a similar way to those found in C: b + To print a variable you can use the following command a a ===Dynamic typing=== Magik variables are not typed as they are in say C# and can reference different objects at runtime.[src] Everything in Magik is an object (there is no distinction between objects and primitive types such as integers): a Objects Objects are implemented in Magik using exemplars.[src] Exemplars have similarities to classes in other programming languages such as Java, but with important differences.[src] Magik supports multiple inheritance, and mixins (which implement functionality with no data).[src] New instances are made by cloning an existing instance (which will typically be the exemplar but does not have to be).[src] New exemplars are created using the statement def_slotted_exemplar() , for example: def_slotted_exemplar(:my_object, { {:slot_a, 34}, {:slot_b, "hello"} }, {:parent_object_a, :parent_object_b}) This code fragment will define a new exemplar called my_object that has two slots (or fields) called slot_a (pre-initialised to 34) and slot_b (pre-initialised to "hello") that inherits from two existing exemplars called parent_object_a and parent_object_b .[src] ===Comparison=== Magik implements all usual logical operators ( = , , , > , >= , ~=/<> ) for comparison, as well as a few unusual ones.[src] The _is and _isnt operators are used for comparing specific instances of objects, or object references rather than values.[src] For example: a ===Methods=== Methods are defined on exemplars using the statements _method and _endmethod : _method my_object.my_method(a, b) _return a + b _endmethod It is convention to supply two methods new() (to create a new instance) and init() (to initialise an instance).[src] # New method _method person.new(name, age) _return _clone.init(name, age) _endmethod # Initialise method.[src] _private _method person.init(name, age) # Call the parent implementation.[src] _super.init(name, age) # Initialise the slots.[src] .name The _clone creates a physical copy of the person object.[src] The _super statement allows objects to invoke an implementation of a method on the parent exemplar.[src] Objects can reference themselves using the _self statement.[src] An object's slots are accessed and assigned using a dot notation.[src] Methods that are not part of the public interface of the object can be marked private using the _private statement.[src] Private methods can only be called by _self , _super and _clone .[src] Optional arguments can be declared using the _optional statement.[src] Optional arguments that are not passed are assigned by Magik to the special object _unset (the equivalent of null).[src] The _gather statement can be used to declare a list of optional arguments.[src] _method my_object.my_method(_gather values) _endmethod ===Iteration=== In Magik the _while , _for , _over , _loop and _endloop statements allow iteration.[src] _block _local s > s _endblock Here, the _while is combined with _loop and _endloop.[src] _method my_object.my_method(_gather values) total Here values.elements() is an iterator which helps to iterate the values.[src] In Magik generator methods are called iterator methods.[src] New iterator methods can be defined using the _iter and _loopbody statements: _iter _method my_object.even_elements() _for a _over _self.elements() _loop _if a.even?[src] _is _true _then _loopbody(a) _endif _endloop _endmethod ===Procedures=== Magik also supports functions called procedures.[src] Procedures are also objects and are declared using the _proc and _endproc statements.[src] Procedures are assigned to variables which may then be invoked: my_procedure ===Regular expression=== Magik supports // regular expression syntax: _if /Hello\,\s(\w)+!/.matches?("Hello, Magik!") _then write("Got a match!") _endif and to capture groups in Regex: /sw([0-9]+)-([0-9]+).*/.replace_all("sw65456-324sss", "$1") # "65456" /sw([0-9]+)-([0-9]+).*/.replace_all("sw65456-324sss", "$2") # "324" ===HTTP library=== Magik supports making HTTP or HTTPS requests via http library, see below examples: magikhttp ===Language quirks=== Because Magik was originally developed in England, methods in the core smallworld libraries are spelled using British English.[src] For example: Use "initialise", not "initialize".[src] ===Collections=== Like other programming language Magik too has collections.[src] They include the following: Simple Vector Rope - a dynamic array Hash Table Property List Equality set Bags ==Hello World example== The following is an example of the Hello world program written in Magik: write("Hello World!") ==References== ==External links== Smallworld Product Suite Technology MDT - Magik Development Tools IDE for GE Smallworld GIS developers Open Source (SourceForge) Language forum post on Magik Technical Paper No.[src] 5 - An Overview of Smallworld Magik GE Smallworld, Emacs Extensions for Magik developers Visual Studio Code extension for Smallworld Magik programming language.[src]

58 sentences · 58 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Magik (programming language)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/magik-programming-language. Accessed 28 November 2026.

Chicago

"Magik (programming language)." encyclopegia.org. Accessed November 28, 2026. https://encyclopegia.org/wiki/magik-programming-language.

APA

encyclopegia.org. (2026). Magik (programming language). Retrieved November 28, 2026, from https://encyclopegia.org/wiki/magik-programming-language

Accessed November 28, 2026 · CC BY-SA 4.0 · citation page · JSON

CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1364524401 · 0.5 · snapshot enwiki-001364524401

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners
  • Index — every corpus, paper and record
  • Estate guide — what a public data estate is
  • Founder — Lois-Kleinner Alpasan
  • Records — DOIs and external deposits
  • Documents — one-pagers, PDFs and QR codes
  • Brand kit — logos and share images
  • Papers — plain-language briefs with citations
  • Browser — search engine, PWA and bookmarklet
  • Anticloud — the operator and its projects

As seen in Business Insider · 336 outlets · evidence DOIs · plain-language papers

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.