Index: doc/next-migration.html =================================================================== diff -u -rc4f449cb353be812ba6502ef8e9587e87881f59b -r367fd6fc64a1631117a00d57c15c33bc972fc41e --- doc/next-migration.html (.../next-migration.html) (revision c4f449cb353be812ba6502ef8e9587e87881f59b) +++ doc/next-migration.html (.../next-migration.html) (revision 367fd6fc64a1631117a00d57c15c33bc972fc41e) @@ -1,6473 +1,6473 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" - "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> -<head> -<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> -<meta name="generator" content="AsciiDoc 8.6.9" /> -<title>Migration Guide for the Next Scripting Language</title> -<style type="text/css"> -/* Shared CSS for AsciiDoc xhtml11 and html5 backends */ - -/* Default font. */ -body { - font-family: Georgia,serif; -} - -/* Title font. */ -h1, h2, h3, h4, h5, h6, -div.title, caption.title, -thead, p.table.header, -#toctitle, -#author, #revnumber, #revdate, #revremark, -#footer { - font-family: Arial,Helvetica,sans-serif; -} - -body { - margin: 1em 5% 1em 5%; -} - -a { - color: blue; - text-decoration: underline; -} -a:visited { - color: fuchsia; -} - -em { - font-style: italic; - color: navy; -} - -strong { - font-weight: bold; - color: #083194; -} - -h1, h2, h3, h4, h5, h6 { - color: #527bbd; - margin-top: 1.2em; - margin-bottom: 0.5em; - line-height: 1.3; -} - -h1, h2, h3 { - border-bottom: 2px solid silver; -} -h2 { - padding-top: 0.5em; -} -h3 { - float: left; -} -h3 + * { - clear: left; -} -h5 { - font-size: 1.0em; -} - -div.sectionbody { - margin-left: 0; -} - -hr { - border: 1px solid silver; -} - -p { - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -ul, ol, li > p { - margin-top: 0; -} -ul > li { color: #aaa; } -ul > li > * { color: black; } - -.monospaced, code, pre { - font-family: "Courier New", Courier, monospace; - font-size: inherit; - color: navy; - padding: 0; - margin: 0; -} -pre { - white-space: pre-wrap; -} - -#author { - color: #527bbd; - font-weight: bold; - font-size: 1.1em; -} -#email { -} -#revnumber, #revdate, #revremark { -} - -#footer { - font-size: small; - border-top: 2px solid silver; - padding-top: 0.5em; - margin-top: 4.0em; -} -#footer-text { - float: left; - padding-bottom: 0.5em; -} -#footer-badges { - float: right; - padding-bottom: 0.5em; -} - -#preamble { - margin-top: 1.5em; - margin-bottom: 1.5em; -} -div.imageblock, div.exampleblock, div.verseblock, -div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, -div.admonitionblock { - margin-top: 1.0em; - margin-bottom: 1.5em; -} -div.admonitionblock { - margin-top: 2.0em; - margin-bottom: 2.0em; - margin-right: 10%; - color: #606060; -} - -div.content { /* Block element content. */ - padding: 0; -} - -/* Block element titles. */ -div.title, caption.title { - color: #527bbd; - font-weight: bold; - text-align: left; - margin-top: 1.0em; - margin-bottom: 0.5em; -} -div.title + * { - margin-top: 0; -} - -td div.title:first-child { - margin-top: 0.0em; -} -div.content div.title:first-child { - margin-top: 0.0em; -} -div.content + div.title { - margin-top: 0.0em; -} - -div.sidebarblock > div.content { - background: #ffffee; - border: 1px solid #dddddd; - border-left: 4px solid #f0f0f0; - padding: 0.5em; -} - -div.listingblock > div.content { - border: 1px solid #dddddd; - border-left: 5px solid #f0f0f0; - background: #f8f8f8; - padding: 0.5em; -} - -div.quoteblock, div.verseblock { - padding-left: 1.0em; - margin-left: 1.0em; - margin-right: 10%; - border-left: 5px solid #f0f0f0; - color: #888; -} - -div.quoteblock > div.attribution { - padding-top: 0.5em; - text-align: right; -} - -div.verseblock > pre.content { - font-family: inherit; - font-size: inherit; -} -div.verseblock > div.attribution { - padding-top: 0.75em; - text-align: left; -} -/* DEPRECATED: Pre version 8.2.7 verse style literal block. */ -div.verseblock + div.attribution { - text-align: left; -} - -div.admonitionblock .icon { - vertical-align: top; - font-size: 1.1em; - font-weight: bold; - text-decoration: underline; - color: #527bbd; - padding-right: 0.5em; -} -div.admonitionblock td.content { - padding-left: 0.5em; - border-left: 3px solid #dddddd; -} - -div.exampleblock > div.content { - border-left: 3px solid #dddddd; - padding-left: 0.5em; -} - -div.imageblock div.content { padding-left: 0; } -span.image img { border-style: none; vertical-align: text-bottom; } -a.image:visited { color: white; } - -dl { - margin-top: 0.8em; - margin-bottom: 0.8em; -} -dt { - margin-top: 0.5em; - margin-bottom: 0; - font-style: normal; - color: navy; -} -dd > *:first-child { - margin-top: 0.1em; -} - -ul, ol { - list-style-position: outside; -} -ol.arabic { - list-style-type: decimal; -} -ol.loweralpha { - list-style-type: lower-alpha; -} -ol.upperalpha { - list-style-type: upper-alpha; -} -ol.lowerroman { - list-style-type: lower-roman; -} -ol.upperroman { - list-style-type: upper-roman; -} - -div.compact ul, div.compact ol, -div.compact p, div.compact p, -div.compact div, div.compact div { - margin-top: 0.1em; - margin-bottom: 0.1em; -} - -tfoot { - font-weight: bold; -} -td > div.verse { - white-space: pre; -} - -div.hdlist { - margin-top: 0.8em; - margin-bottom: 0.8em; -} -div.hdlist tr { - padding-bottom: 15px; -} -dt.hdlist1.strong, td.hdlist1.strong { - font-weight: bold; -} -td.hdlist1 { - vertical-align: top; - font-style: normal; - padding-right: 0.8em; - color: navy; -} -td.hdlist2 { - vertical-align: top; -} -div.hdlist.compact tr { - margin: 0; - padding-bottom: 0; -} - -.comment { - background: yellow; -} - -.footnote, .footnoteref { - font-size: 0.8em; -} - -span.footnote, span.footnoteref { - vertical-align: super; -} - -#footnotes { - margin: 20px 0 20px 0; - padding: 7px 0 0 0; -} - -#footnotes div.footnote { - margin: 0 0 5px 0; -} - -#footnotes hr { - border: none; - border-top: 1px solid silver; - height: 1px; - text-align: left; - margin-left: 0; - width: 20%; - min-width: 100px; -} - -div.colist td { - padding-right: 0.5em; - padding-bottom: 0.3em; - vertical-align: top; -} -div.colist td img { - margin-top: 0.3em; -} - -@media print { - #footer-badges { display: none; } -} - -#toc { - margin-bottom: 2.5em; -} - -#toctitle { - color: #527bbd; - font-size: 1.1em; - font-weight: bold; - margin-top: 1.0em; - margin-bottom: 0.1em; -} - -div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { - margin-top: 0; - margin-bottom: 0; -} -div.toclevel2 { - margin-left: 2em; - font-size: 0.9em; -} -div.toclevel3 { - margin-left: 4em; - font-size: 0.9em; -} -div.toclevel4 { - margin-left: 6em; - font-size: 0.9em; -} - -span.aqua { color: aqua; } -span.black { color: black; } -span.blue { color: blue; } -span.fuchsia { color: fuchsia; } -span.gray { color: gray; } -span.green { color: green; } -span.lime { color: lime; } -span.maroon { color: maroon; } -span.navy { color: navy; } -span.olive { color: olive; } -span.purple { color: purple; } -span.red { color: red; } -span.silver { color: silver; } -span.teal { color: teal; } -span.white { color: white; } -span.yellow { color: yellow; } - -span.aqua-background { background: aqua; } -span.black-background { background: black; } -span.blue-background { background: blue; } -span.fuchsia-background { background: fuchsia; } -span.gray-background { background: gray; } -span.green-background { background: green; } -span.lime-background { background: lime; } -span.maroon-background { background: maroon; } -span.navy-background { background: navy; } -span.olive-background { background: olive; } -span.purple-background { background: purple; } -span.red-background { background: red; } -span.silver-background { background: silver; } -span.teal-background { background: teal; } -span.white-background { background: white; } -span.yellow-background { background: yellow; } - -span.big { font-size: 2em; } -span.small { font-size: 0.6em; } - -span.underline { text-decoration: underline; } -span.overline { text-decoration: overline; } -span.line-through { text-decoration: line-through; } - -div.unbreakable { page-break-inside: avoid; } - - -/* - * xhtml11 specific - * - * */ - -div.tableblock { - margin-top: 1.0em; - margin-bottom: 1.5em; -} -div.tableblock > table { - border: 3px solid #527bbd; -} -thead, p.table.header { - font-weight: bold; - color: #527bbd; -} -p.table { - margin-top: 0; -} -/* Because the table frame attribute is overridden by CSS in most browsers. */ -div.tableblock > table[frame="void"] { - border-style: none; -} -div.tableblock > table[frame="hsides"] { - border-left-style: none; - border-right-style: none; -} -div.tableblock > table[frame="vsides"] { - border-top-style: none; - border-bottom-style: none; -} - - -/* - * html5 specific - * - * */ - -table.tableblock { - margin-top: 1.0em; - margin-bottom: 1.5em; -} -thead, p.tableblock.header { - font-weight: bold; - color: #527bbd; -} -p.tableblock { - margin-top: 0; -} -table.tableblock { - border-width: 3px; - border-spacing: 0px; - border-style: solid; - border-color: #527bbd; - border-collapse: collapse; -} -th.tableblock, td.tableblock { - border-width: 1px; - padding: 4px; - border-style: solid; - border-color: #527bbd; -} - -table.tableblock.frame-topbot { - border-left-style: hidden; - border-right-style: hidden; -} -table.tableblock.frame-sides { - border-top-style: hidden; - border-bottom-style: hidden; -} -table.tableblock.frame-none { - border-style: hidden; -} - -th.tableblock.halign-left, td.tableblock.halign-left { - text-align: left; -} -th.tableblock.halign-center, td.tableblock.halign-center { - text-align: center; -} -th.tableblock.halign-right, td.tableblock.halign-right { - text-align: right; -} - -th.tableblock.valign-top, td.tableblock.valign-top { - vertical-align: top; -} -th.tableblock.valign-middle, td.tableblock.valign-middle { - vertical-align: middle; -} -th.tableblock.valign-bottom, td.tableblock.valign-bottom { - vertical-align: bottom; -} - - -/* - * manpage specific - * - * */ - -body.manpage h1 { - padding-top: 0.5em; - padding-bottom: 0.5em; - border-top: 2px solid silver; - border-bottom: 2px solid silver; -} -body.manpage h2 { - border-style: none; -} -body.manpage div.sectionbody { - margin-left: 3em; -} - -@media print { - body.manpage div#toc { display: none; } -} - - -</style> -<script type="text/javascript"> -/*<![CDATA[*/ -var asciidoc = { // Namespace. - -///////////////////////////////////////////////////////////////////// -// Table Of Contents generator -///////////////////////////////////////////////////////////////////// - -/* Author: Mihai Bazon, September 2002 - * http://students.infoiasi.ro/~mishoo - * - * Table Of Content generator - * Version: 0.4 - * - * Feel free to use this script under the terms of the GNU General Public - * License, as long as you do not remove or alter this notice. - */ - - /* modified by Troy D. Hanson, September 2006. License: GPL */ - /* modified by Stuart Rackham, 2006, 2009. License: GPL */ - -// toclevels = 1..4. -toc: function (toclevels) { - - function getText(el) { - var text = ""; - for (var i = el.firstChild; i != null; i = i.nextSibling) { - if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. - text += i.data; - else if (i.firstChild != null) - text += getText(i); - } - return text; - } - - function TocEntry(el, text, toclevel) { - this.element = el; - this.text = text; - this.toclevel = toclevel; - } - - function tocEntries(el, toclevels) { - var result = new Array; - var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); - // Function that scans the DOM tree for header elements (the DOM2 - // nodeIterator API would be a better technique but not supported by all - // browsers). - var iterate = function (el) { - for (var i = el.firstChild; i != null; i = i.nextSibling) { - if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { - var mo = re.exec(i.tagName); - if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { - result[result.length] = new TocEntry(i, getText(i), mo[1]-1); - } - iterate(i); - } - } - } - iterate(el); - return result; - } - - var toc = document.getElementById("toc"); - if (!toc) { - return; - } - - // Delete existing TOC entries in case we're reloading the TOC. - var tocEntriesToRemove = []; - var i; - for (i = 0; i < toc.childNodes.length; i++) { - var entry = toc.childNodes[i]; - if (entry.nodeName.toLowerCase() == 'div' - && entry.getAttribute("class") - && entry.getAttribute("class").match(/^toclevel/)) - tocEntriesToRemove.push(entry); - } - for (i = 0; i < tocEntriesToRemove.length; i++) { - toc.removeChild(tocEntriesToRemove[i]); - } - - // Rebuild TOC entries. - var entries = tocEntries(document.getElementById("content"), toclevels); - for (var i = 0; i < entries.length; ++i) { - var entry = entries[i]; - if (entry.element.id == "") - entry.element.id = "_toc_" + i; - var a = document.createElement("a"); - a.href = "#" + entry.element.id; - a.appendChild(document.createTextNode(entry.text)); - var div = document.createElement("div"); - div.appendChild(a); - div.className = "toclevel" + entry.toclevel; - toc.appendChild(div); - } - if (entries.length == 0) - toc.parentNode.removeChild(toc); -}, - - -///////////////////////////////////////////////////////////////////// -// Footnotes generator -///////////////////////////////////////////////////////////////////// - -/* Based on footnote generation code from: - * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html - */ - -footnotes: function () { - // Delete existing footnote entries in case we're reloading the footnodes. - var i; - var noteholder = document.getElementById("footnotes"); - if (!noteholder) { - return; - } - var entriesToRemove = []; - for (i = 0; i < noteholder.childNodes.length; i++) { - var entry = noteholder.childNodes[i]; - if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") - entriesToRemove.push(entry); - } - for (i = 0; i < entriesToRemove.length; i++) { - noteholder.removeChild(entriesToRemove[i]); - } - - // Rebuild footnote entries. - var cont = document.getElementById("content"); - var spans = cont.getElementsByTagName("span"); - var refs = {}; - var n = 0; - for (i=0; i<spans.length; i++) { - if (spans[i].className == "footnote") { - n++; - var note = spans[i].getAttribute("data-note"); - if (!note) { - // Use [\s\S] in place of . so multi-line matches work. - // Because JavaScript has no s (dotall) regex flag. - note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; - spans[i].innerHTML = - "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + - "' title='View footnote' class='footnote'>" + n + "</a>]"; - spans[i].setAttribute("data-note", note); - } - noteholder.innerHTML += - "<div class='footnote' id='_footnote_" + n + "'>" + - "<a href='#_footnoteref_" + n + "' title='Return to text'>" + - n + "</a>. " + note + "</div>"; - var id =spans[i].getAttribute("id"); - if (id != null) refs["#"+id] = n; - } - } - if (n == 0) - noteholder.parentNode.removeChild(noteholder); - else { - // Process footnoterefs. - for (i=0; i<spans.length; i++) { - if (spans[i].className == "footnoteref") { - var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); - href = href.match(/#.*/)[0]; // Because IE return full URL. - n = refs[href]; - spans[i].innerHTML = - "[<a href='#_footnote_" + n + - "' title='View footnote' class='footnote'>" + n + "</a>]"; - } - } - } -}, - -install: function(toclevels) { - var timerId; - - function reinstall() { - asciidoc.footnotes(); - if (toclevels) { - asciidoc.toc(toclevels); - } - } - - function reinstallAndRemoveTimer() { - clearInterval(timerId); - reinstall(); - } - - timerId = setInterval(reinstall, 500); - if (document.addEventListener) - document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); - else - window.onload = reinstallAndRemoveTimer; -} - -} -asciidoc.install(3); -/*]]>*/ -</script> -</head> -<body class="article"> -<div id="header"> -<h1>Migration Guide for the Next Scripting Language</h1> -<span id="author">Gustaf Neumann</span><br /> -<span id="email"><code><<a href="mailto:neumann@wu-wien.ac.at">neumann@wu-wien.ac.at</a>></code></span><br /> -<span id="revnumber">version 2.1.0,</span> -<span id="revdate">December 2016</span> -<br /><span id="revremark"></span> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> +<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> +<meta name="generator" content="AsciiDoc 8.6.9" /> +<title>Migration Guide for the Next Scripting Language</title> +<style type="text/css"> +/* Shared CSS for AsciiDoc xhtml11 and html5 backends */ + +/* Default font. */ +body { + font-family: Georgia,serif; +} + +/* Title font. */ +h1, h2, h3, h4, h5, h6, +div.title, caption.title, +thead, p.table.header, +#toctitle, +#author, #revnumber, #revdate, #revremark, +#footer { + font-family: Arial,Helvetica,sans-serif; +} + +body { + margin: 1em 5% 1em 5%; +} + +a { + color: blue; + text-decoration: underline; +} +a:visited { + color: fuchsia; +} + +em { + font-style: italic; + color: navy; +} + +strong { + font-weight: bold; + color: #083194; +} + +h1, h2, h3, h4, h5, h6 { + color: #527bbd; + margin-top: 1.2em; + margin-bottom: 0.5em; + line-height: 1.3; +} + +h1, h2, h3 { + border-bottom: 2px solid silver; +} +h2 { + padding-top: 0.5em; +} +h3 { + float: left; +} +h3 + * { + clear: left; +} +h5 { + font-size: 1.0em; +} + +div.sectionbody { + margin-left: 0; +} + +hr { + border: 1px solid silver; +} + +p { + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +ul, ol, li > p { + margin-top: 0; +} +ul > li { color: #aaa; } +ul > li > * { color: black; } + +.monospaced, code, pre { + font-family: "Courier New", Courier, monospace; + font-size: inherit; + color: navy; + padding: 0; + margin: 0; +} +pre { + white-space: pre-wrap; +} + +#author { + color: #527bbd; + font-weight: bold; + font-size: 1.1em; +} +#email { +} +#revnumber, #revdate, #revremark { +} + +#footer { + font-size: small; + border-top: 2px solid silver; + padding-top: 0.5em; + margin-top: 4.0em; +} +#footer-text { + float: left; + padding-bottom: 0.5em; +} +#footer-badges { + float: right; + padding-bottom: 0.5em; +} + +#preamble { + margin-top: 1.5em; + margin-bottom: 1.5em; +} +div.imageblock, div.exampleblock, div.verseblock, +div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, +div.admonitionblock { + margin-top: 1.0em; + margin-bottom: 1.5em; +} +div.admonitionblock { + margin-top: 2.0em; + margin-bottom: 2.0em; + margin-right: 10%; + color: #606060; +} + +div.content { /* Block element content. */ + padding: 0; +} + +/* Block element titles. */ +div.title, caption.title { + color: #527bbd; + font-weight: bold; + text-align: left; + margin-top: 1.0em; + margin-bottom: 0.5em; +} +div.title + * { + margin-top: 0; +} + +td div.title:first-child { + margin-top: 0.0em; +} +div.content div.title:first-child { + margin-top: 0.0em; +} +div.content + div.title { + margin-top: 0.0em; +} + +div.sidebarblock > div.content { + background: #ffffee; + border: 1px solid #dddddd; + border-left: 4px solid #f0f0f0; + padding: 0.5em; +} + +div.listingblock > div.content { + border: 1px solid #dddddd; + border-left: 5px solid #f0f0f0; + background: #f8f8f8; + padding: 0.5em; +} + +div.quoteblock, div.verseblock { + padding-left: 1.0em; + margin-left: 1.0em; + margin-right: 10%; + border-left: 5px solid #f0f0f0; + color: #888; +} + +div.quoteblock > div.attribution { + padding-top: 0.5em; + text-align: right; +} + +div.verseblock > pre.content { + font-family: inherit; + font-size: inherit; +} +div.verseblock > div.attribution { + padding-top: 0.75em; + text-align: left; +} +/* DEPRECATED: Pre version 8.2.7 verse style literal block. */ +div.verseblock + div.attribution { + text-align: left; +} + +div.admonitionblock .icon { + vertical-align: top; + font-size: 1.1em; + font-weight: bold; + text-decoration: underline; + color: #527bbd; + padding-right: 0.5em; +} +div.admonitionblock td.content { + padding-left: 0.5em; + border-left: 3px solid #dddddd; +} + +div.exampleblock > div.content { + border-left: 3px solid #dddddd; + padding-left: 0.5em; +} + +div.imageblock div.content { padding-left: 0; } +span.image img { border-style: none; vertical-align: text-bottom; } +a.image:visited { color: white; } + +dl { + margin-top: 0.8em; + margin-bottom: 0.8em; +} +dt { + margin-top: 0.5em; + margin-bottom: 0; + font-style: normal; + color: navy; +} +dd > *:first-child { + margin-top: 0.1em; +} + +ul, ol { + list-style-position: outside; +} +ol.arabic { + list-style-type: decimal; +} +ol.loweralpha { + list-style-type: lower-alpha; +} +ol.upperalpha { + list-style-type: upper-alpha; +} +ol.lowerroman { + list-style-type: lower-roman; +} +ol.upperroman { + list-style-type: upper-roman; +} + +div.compact ul, div.compact ol, +div.compact p, div.compact p, +div.compact div, div.compact div { + margin-top: 0.1em; + margin-bottom: 0.1em; +} + +tfoot { + font-weight: bold; +} +td > div.verse { + white-space: pre; +} + +div.hdlist { + margin-top: 0.8em; + margin-bottom: 0.8em; +} +div.hdlist tr { + padding-bottom: 15px; +} +dt.hdlist1.strong, td.hdlist1.strong { + font-weight: bold; +} +td.hdlist1 { + vertical-align: top; + font-style: normal; + padding-right: 0.8em; + color: navy; +} +td.hdlist2 { + vertical-align: top; +} +div.hdlist.compact tr { + margin: 0; + padding-bottom: 0; +} + +.comment { + background: yellow; +} + +.footnote, .footnoteref { + font-size: 0.8em; +} + +span.footnote, span.footnoteref { + vertical-align: super; +} + +#footnotes { + margin: 20px 0 20px 0; + padding: 7px 0 0 0; +} + +#footnotes div.footnote { + margin: 0 0 5px 0; +} + +#footnotes hr { + border: none; + border-top: 1px solid silver; + height: 1px; + text-align: left; + margin-left: 0; + width: 20%; + min-width: 100px; +} + +div.colist td { + padding-right: 0.5em; + padding-bottom: 0.3em; + vertical-align: top; +} +div.colist td img { + margin-top: 0.3em; +} + +@media print { + #footer-badges { display: none; } +} + +#toc { + margin-bottom: 2.5em; +} + +#toctitle { + color: #527bbd; + font-size: 1.1em; + font-weight: bold; + margin-top: 1.0em; + margin-bottom: 0.1em; +} + +div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { + margin-top: 0; + margin-bottom: 0; +} +div.toclevel2 { + margin-left: 2em; + font-size: 0.9em; +} +div.toclevel3 { + margin-left: 4em; + font-size: 0.9em; +} +div.toclevel4 { + margin-left: 6em; + font-size: 0.9em; +} + +span.aqua { color: aqua; } +span.black { color: black; } +span.blue { color: blue; } +span.fuchsia { color: fuchsia; } +span.gray { color: gray; } +span.green { color: green; } +span.lime { color: lime; } +span.maroon { color: maroon; } +span.navy { color: navy; } +span.olive { color: olive; } +span.purple { color: purple; } +span.red { color: red; } +span.silver { color: silver; } +span.teal { color: teal; } +span.white { color: white; } +span.yellow { color: yellow; } + +span.aqua-background { background: aqua; } +span.black-background { background: black; } +span.blue-background { background: blue; } +span.fuchsia-background { background: fuchsia; } +span.gray-background { background: gray; } +span.green-background { background: green; } +span.lime-background { background: lime; } +span.maroon-background { background: maroon; } +span.navy-background { background: navy; } +span.olive-background { background: olive; } +span.purple-background { background: purple; } +span.red-background { background: red; } +span.silver-background { background: silver; } +span.teal-background { background: teal; } +span.white-background { background: white; } +span.yellow-background { background: yellow; } + +span.big { font-size: 2em; } +span.small { font-size: 0.6em; } + +span.underline { text-decoration: underline; } +span.overline { text-decoration: overline; } +span.line-through { text-decoration: line-through; } + +div.unbreakable { page-break-inside: avoid; } + + +/* + * xhtml11 specific + * + * */ + +div.tableblock { + margin-top: 1.0em; + margin-bottom: 1.5em; +} +div.tableblock > table { + border: 3px solid #527bbd; +} +thead, p.table.header { + font-weight: bold; + color: #527bbd; +} +p.table { + margin-top: 0; +} +/* Because the table frame attribute is overriden by CSS in most browsers. */ +div.tableblock > table[frame="void"] { + border-style: none; +} +div.tableblock > table[frame="hsides"] { + border-left-style: none; + border-right-style: none; +} +div.tableblock > table[frame="vsides"] { + border-top-style: none; + border-bottom-style: none; +} + + +/* + * html5 specific + * + * */ + +table.tableblock { + margin-top: 1.0em; + margin-bottom: 1.5em; +} +thead, p.tableblock.header { + font-weight: bold; + color: #527bbd; +} +p.tableblock { + margin-top: 0; +} +table.tableblock { + border-width: 3px; + border-spacing: 0px; + border-style: solid; + border-color: #527bbd; + border-collapse: collapse; +} +th.tableblock, td.tableblock { + border-width: 1px; + padding: 4px; + border-style: solid; + border-color: #527bbd; +} + +table.tableblock.frame-topbot { + border-left-style: hidden; + border-right-style: hidden; +} +table.tableblock.frame-sides { + border-top-style: hidden; + border-bottom-style: hidden; +} +table.tableblock.frame-none { + border-style: hidden; +} + +th.tableblock.halign-left, td.tableblock.halign-left { + text-align: left; +} +th.tableblock.halign-center, td.tableblock.halign-center { + text-align: center; +} +th.tableblock.halign-right, td.tableblock.halign-right { + text-align: right; +} + +th.tableblock.valign-top, td.tableblock.valign-top { + vertical-align: top; +} +th.tableblock.valign-middle, td.tableblock.valign-middle { + vertical-align: middle; +} +th.tableblock.valign-bottom, td.tableblock.valign-bottom { + vertical-align: bottom; +} + + +/* + * manpage specific + * + * */ + +body.manpage h1 { + padding-top: 0.5em; + padding-bottom: 0.5em; + border-top: 2px solid silver; + border-bottom: 2px solid silver; +} +body.manpage h2 { + border-style: none; +} +body.manpage div.sectionbody { + margin-left: 3em; +} + +@media print { + body.manpage div#toc { display: none; } +} + + +</style> +<script type="text/javascript"> +/*<![CDATA[*/ +var asciidoc = { // Namespace. + +///////////////////////////////////////////////////////////////////// +// Table Of Contents generator +///////////////////////////////////////////////////////////////////// + +/* Author: Mihai Bazon, September 2002 + * http://students.infoiasi.ro/~mishoo + * + * Table Of Content generator + * Version: 0.4 + * + * Feel free to use this script under the terms of the GNU General Public + * License, as long as you do not remove or alter this notice. + */ + + /* modified by Troy D. Hanson, September 2006. License: GPL */ + /* modified by Stuart Rackham, 2006, 2009. License: GPL */ + +// toclevels = 1..4. +toc: function (toclevels) { + + function getText(el) { + var text = ""; + for (var i = el.firstChild; i != null; i = i.nextSibling) { + if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. + text += i.data; + else if (i.firstChild != null) + text += getText(i); + } + return text; + } + + function TocEntry(el, text, toclevel) { + this.element = el; + this.text = text; + this.toclevel = toclevel; + } + + function tocEntries(el, toclevels) { + var result = new Array; + var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); + // Function that scans the DOM tree for header elements (the DOM2 + // nodeIterator API would be a better technique but not supported by all + // browsers). + var iterate = function (el) { + for (var i = el.firstChild; i != null; i = i.nextSibling) { + if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { + var mo = re.exec(i.tagName); + if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { + result[result.length] = new TocEntry(i, getText(i), mo[1]-1); + } + iterate(i); + } + } + } + iterate(el); + return result; + } + + var toc = document.getElementById("toc"); + if (!toc) { + return; + } + + // Delete existing TOC entries in case we're reloading the TOC. + var tocEntriesToRemove = []; + var i; + for (i = 0; i < toc.childNodes.length; i++) { + var entry = toc.childNodes[i]; + if (entry.nodeName.toLowerCase() == 'div' + && entry.getAttribute("class") + && entry.getAttribute("class").match(/^toclevel/)) + tocEntriesToRemove.push(entry); + } + for (i = 0; i < tocEntriesToRemove.length; i++) { + toc.removeChild(tocEntriesToRemove[i]); + } + + // Rebuild TOC entries. + var entries = tocEntries(document.getElementById("content"), toclevels); + for (var i = 0; i < entries.length; ++i) { + var entry = entries[i]; + if (entry.element.id == "") + entry.element.id = "_toc_" + i; + var a = document.createElement("a"); + a.href = "#" + entry.element.id; + a.appendChild(document.createTextNode(entry.text)); + var div = document.createElement("div"); + div.appendChild(a); + div.className = "toclevel" + entry.toclevel; + toc.appendChild(div); + } + if (entries.length == 0) + toc.parentNode.removeChild(toc); +}, + + +///////////////////////////////////////////////////////////////////// +// Footnotes generator +///////////////////////////////////////////////////////////////////// + +/* Based on footnote generation code from: + * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html + */ + +footnotes: function () { + // Delete existing footnote entries in case we're reloading the footnodes. + var i; + var noteholder = document.getElementById("footnotes"); + if (!noteholder) { + return; + } + var entriesToRemove = []; + for (i = 0; i < noteholder.childNodes.length; i++) { + var entry = noteholder.childNodes[i]; + if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") + entriesToRemove.push(entry); + } + for (i = 0; i < entriesToRemove.length; i++) { + noteholder.removeChild(entriesToRemove[i]); + } + + // Rebuild footnote entries. + var cont = document.getElementById("content"); + var spans = cont.getElementsByTagName("span"); + var refs = {}; + var n = 0; + for (i=0; i<spans.length; i++) { + if (spans[i].className == "footnote") { + n++; + var note = spans[i].getAttribute("data-note"); + if (!note) { + // Use [\s\S] in place of . so multi-line matches work. + // Because JavaScript has no s (dotall) regex flag. + note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; + spans[i].innerHTML = + "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + + "' title='View footnote' class='footnote'>" + n + "</a>]"; + spans[i].setAttribute("data-note", note); + } + noteholder.innerHTML += + "<div class='footnote' id='_footnote_" + n + "'>" + + "<a href='#_footnoteref_" + n + "' title='Return to text'>" + + n + "</a>. " + note + "</div>"; + var id =spans[i].getAttribute("id"); + if (id != null) refs["#"+id] = n; + } + } + if (n == 0) + noteholder.parentNode.removeChild(noteholder); + else { + // Process footnoterefs. + for (i=0; i<spans.length; i++) { + if (spans[i].className == "footnoteref") { + var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); + href = href.match(/#.*/)[0]; // Because IE return full URL. + n = refs[href]; + spans[i].innerHTML = + "[<a href='#_footnote_" + n + + "' title='View footnote' class='footnote'>" + n + "</a>]"; + } + } + } +}, + +install: function(toclevels) { + var timerId; + + function reinstall() { + asciidoc.footnotes(); + if (toclevels) { + asciidoc.toc(toclevels); + } + } + + function reinstallAndRemoveTimer() { + clearInterval(timerId); + reinstall(); + } + + timerId = setInterval(reinstall, 500); + if (document.addEventListener) + document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); + else + window.onload = reinstallAndRemoveTimer; +} + +} +asciidoc.install(3); +/*]]>*/ +</script> +</head> +<body class="article"> +<div id="header"> +<h1>Migration Guide for the Next Scripting Language</h1> +<span id="author">Gustaf Neumann</span><br /> +<span id="email"><code><<a href="mailto:neumann@wu-wien.ac.at">neumann@wu-wien.ac.at</a>></code></span><br /> +<span id="revnumber">version 2.1.0,</span> +<span id="revdate">December 2016</span> +<br /><span id="revremark"></span> <div id="toc"> <div id="toctitle">Table of Contents</div> <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript> -</div> -</div> -<div id="content"> -<div id="preamble"> -<div class="sectionbody"> -<div class="sidebarblock"> -<div class="content"> -<div class="title">Abstract</div> -<div class="paragraph"><p>This document describes the differences between the Next Scripting -Language Framework and XOTcl 1. In particular, it presents a -migration guide from XOTcl 1 to NX, and presents potential -incompatibilities between XOTcl 1 and XOTcl 2.</p></div> -</div></div> -<div class="paragraph"><p>The Next Scripting Language (NX) is a successor of XOTcl 1 and is -based on 10 years of experience with XOTcl in projects containing -several hundert thousand lines of code. While XOTcl was the first -language designed to provide language support for design patterns, the -focus of the Next Scripting Framework and NX are on combining this -with Language Oriented Programming. In many respects, NX was designed -to ease the learning of the language by novices (by using a more -mainstream terminology, higher orthogonality of the methods, less -predefined methods), to improve maintainability (remove sources of -common errors) and to encourage developer to write better structured -programs (to provide interfaces) especially for large projects, where -many developers are involved.</p></div> -<div class="paragraph"><p>The Next Scripting Language is based on the Next Scripting Framework -which was developed based on the notion of language oriented -programming. The Next Scripting Frameworks provides C-level support -for defining and hosting multiple object systems in a single Tcl -interpreter. The whole definition of NX is fully scripted -(e.g. defined in <code>nx.tcl</code>). The Next Scripting Framework is shipped -with three language definitions, containing NX and XOTcl 2. Most of -the existing XOTcl 1 programs can be used without modification in the -Next Scripting Framework by using XOTcl 2. The Next Scripting -Framework requires Tcl 8.5 or newer.</p></div> -<div class="paragraph"><p>Although NX is fully scripted (as well as XOTcl 2), our benchmarks -show that scripts based on NX are often 2 or 4 times faster than the -counterparts in XOTcl 1. But speed was not the primary focus on the -Next Scripting Environment: The goal was primarily to find ways to -repackage the power of XOTcl in an easy to learn environment, highly -orthogonal environment, which is better suited for large projects, -trying to reduce maintenance costs.</p></div> -<div class="paragraph"><p>We expect that many user will find it attractive to upgrade -from XOTcl 1 to XOTcl 2, and some other users will upgrade to NX. -This document focuses mainly on the differences between XOTcl 1 and -NX, but addresses as well potential incompatibilities between XOTcl 1 -and XOTcl 2. For an introduction to NX, please consult the NX tutorial.</p></div> -</div> -</div> -<div class="sect1"> -<h2 id="_differences_between_xotcl_and_nx">1. Differences Between XOTcl and NX</h2> -<div class="sectionbody"> -<div class="paragraph"><p>The Next Scripting Framework supports <em>Language Oriented Programming</em> -by providing means to define potentially multiple object systems with -different naming and functionality in a single interpreter. This -makes the Next Scripting Framework a powerful instrument for defining -multiple languages such as e.g. domain specific languages. This focus -differs from XOTcl 1.</p></div> -<div class="paragraph"><p>Technically, the language framework approach means that the languages -implemented by the Next Scripting Framework (most prominently XOTcl 2 -and NX) are typically fully scripted and can be loaded via the usual -Tcl <code>package require</code> mechanism.</p></div> -<div class="paragraph"><p>Some of the new features below are provided by the Next Scripting -Framework, some are implemented via the script files for XOTcl 2 and -NX.</p></div> -<div class="sect2"> -<h3 id="_features_of_nx">1.1. Features of NX</h3> -<div class="paragraph"><p>In general, the Next Scripting Language (NX) differs from XOTcl -in the following respects:</p></div> -<div class="olist arabic"><ol class="arabic"> -<li> -<p> -<strong>Stronger Encapsulation:</strong> The Next Scripting Language favors - a <em>stronger form of encapsulation</em> than XOTcl. Calling the own - methods or accessing the own instance variables is typographically - easier and computationally faster than these operations on other - objects. This behavior is achieved via <em>resolvers</em>, which make some - methods necessary in XOTcl 1 obsolete in NX (especially for importing - instance variables). The encapsulation of NX is stronger than in - XOTcl but still weak compared to languages like C++; a developer can - still access other objects' variables via some idioms, but NX <em>makes - accesses to other objects' variables explicit</em>. The requiredness to - make these accesses explicit should encourage developer to implement - well defined interfaces to provide access to instance variables. -</p> -</li> -<li> -<p> -<strong>Additional Forms of Method Definition and Reuse:</strong> - The Next Scripting Language - provides much more orthogonal means to <em>define, reuse and - introspect</em> scripted and C-implemented methods. -</p> -<div class="olist loweralpha"><ol class="loweralpha"> -<li> -<p> -It is possible to use NX <code>alias</code> to register methods - under arbitrary names for arbitrary objects or classes. -</p> -</li> -<li> -<p> -NX provides means for <em>method protection</em> (method modifiers - <code>public</code>, <code>protected</code>, and <code>private</code>). Therefore developers have - to define explicitly public interfaces in order to use methods - from other objects. -</p> -</li> -<li> -<p> -One can invoke in NX fully qualified methods to invoke - methods outside the precedence path. -</p> -</li> -<li> -<p> -One can define in NX <em>hierarchical method names</em> (similar to - commands and subcommands, called method ensembles) in a - convenient way to provide extensible, hierarchical naming of - methods. -</p> -</li> -<li> -<p> -One can use in NX the same interface to query (introspect) - C-implemented and scripted methods/commands. -</p> -</li> -</ol></div> -</li> -<li> -<p> -<strong>Orthogonal Parameterization:</strong> - The Next Scripting Language provides an <em>orthogonal framework for - parametrization</em> of methods and objects. -</p> -<div class="olist loweralpha"><ol class="loweralpha"> -<li> -<p> -In NX, the same argument parser is used for -</p> -<div class="ulist"><ul> -<li> -<p> -Scripted Methods -</p> -</li> -<li> -<p> -C-implemented methods and Tcl commands -</p> -</li> -<li> -<p> -Object Parametrization -</p> -</li> -</ul></div> -</li> -<li> -<p> -While XOTcl 1 provided only value-checkers for non-positional - arguments for methods, the Next Scripting Framework provides - the same value checkers for positional and non-positional - arguments of methods, as well as for positional and - non-positional configure parameters (<code>-parameter</code> in - XOTcl 1). -</p> -</li> -<li> -<p> -While XOTcl 1 supported only non-positional arguments at the - begin of the argument list, these can be used now at arbitrary - positions. -</p> -</li> -</ol></div> -</li> -<li> -<p> -<strong>Value Checking:</strong> -</p> -<div class="olist loweralpha"><ol class="loweralpha"> -<li> -<p> -The Next Scripting Language supports checking of the <em>input - parmeters</em> and the <em>return values</em> of scripted and C-implemented - methods and commands. -</p> -</li> -<li> -<p> -NX provides a set of predefined checkers (like e.g. <code>integer</code>, - <code>boolean</code>, <code>object</code>, …) which can be extended by the - applications. -</p> -</li> -<li> -<p> -Value Checking can be used for <em>single</em> and <em>multi-valued</em> - parameters. One can e.g. define a list of integers - with at least one entry by the parameter specification - <code>integer,1..n</code>. -</p> -</li> -<li> -<p> -Value Checking can be turned on/off globally or on the - method/command level. -</p> -</li> -</ol></div> -</li> -<li> -<p> -<strong>Scripted Init Blocks:</strong> The Next Scripting Language provides - <em>scripted init blocks</em> for objects and classes (replacement for the - dangerous dash "-" mechanism in XOTcl that allows to set variables - and invoke methods upon object creation). -</p> -</li> -<li> -<p> -<strong>More Conventional Naming for Predefined Methods:</strong> The naming of - the methods in the Next Scripting Language is much more in line with - the mainstream naming conventions in OO languages. While for example - XOTcl uses <code>proc</code> and <code>instproc</code> for object specific and inheritable - methods, NX uses simply <code>method</code>. -</p> -</li> -<li> -<p> -<strong>Profiling Support:</strong> The Next Scripting Language provides now two - forms of profiling -</p> -<div class="ulist"><ul> -<li> -<p> -Profiling via a DTrace provider (examples are e.g. in the dtrace - subdirectory of the source tree) -</p> -</li> -<li> -<p> -Significantly improved built-in profiling (results can be - processed in Tcl). -</p> -</li> -</ul></div> -</li> -<li> -<p> -<strong>Significantly Improved Test Suite:</strong> The regression test suite of - Next Scripting Scripting framework contain now more than - 5.000 tests, and order of magnitude more than in XOTcl 1.6 -</p> -</li> -<li> -<p> -<strong>Much Smaller Interface:</strong> The Next Scripting Language has a much - <em>smaller interface</em> (i.e. provides less predefined methods) than - XOTcl (see Table 1), although the expressiveness was increased in - NX. -</p> -</li> -</ol></div> -<div class="tableblock"> -<table rules="all" -width="50%" -frame="hsides" -cellspacing="0" cellpadding="4"> -<caption class="title">Table 1. Comparison of the Number of Predefined Methods in NX and XOTcl</caption> -<col width="60%" /> -<col width="20%" /> -<col width="20%" /> -<thead> -<tr> -<th align="left" valign="top"></th> -<th align="right" valign="top">NX</th> -<th align="right" valign="top">XOTcl</th> -</tr> -</thead> -<tfoot> -<tr> -<td align="left" valign="top"><p class="table">Total</p></td> -<td align="right" valign="top"><p class="table">45</p></td> -<td align="right" valign="top"><p class="table">124</p></td> -</tr> -</tfoot> -<tbody> -<tr> -<td align="left" valign="top"><p class="table">Methods for Objects</p></td> -<td align="right" valign="top"><p class="table">14</p></td> -<td align="right" valign="top"><p class="table">51</p></td> -</tr> -<tr> -<td align="left" valign="top"><p class="table">Methods for Classes</p></td> -<td align="right" valign="top"><p class="table">9</p></td> -<td align="right" valign="top"><p class="table">24</p></td> -</tr> -<tr> -<td align="left" valign="top"><p class="table">Info-methods for Objects</p></td> -<td align="right" valign="top"><p class="table">11</p></td> -<td align="right" valign="top"><p class="table">25</p></td> -</tr> -<tr> -<td align="left" valign="top"><p class="table">Info-methods for Classes</p></td> -<td align="right" valign="top"><p class="table">11</p></td> -<td align="right" valign="top"><p class="table">24</p></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>This comparison list compares mostly XOTcl 1 with NX, some features -are also available in XOTcl 2 (2a, 2c 2d, 3, 4).</p></div> -</div> -<div class="sect2"> -<h3 id="_nx_and_xotcl_scripts">1.2. NX and XOTcl Scripts</h3> -<div class="paragraph"><p>Below is a small, introductory example showing an implementation of a -class <code>Stack</code> in NX and XOTcl. The purpose of this first example is -just a quick overview. We will go into much more detailed comparison -in the next sections.</p></div> -<div class="paragraph"><p>NX supports a block syntax, where the methods are defined during the -creation of the class. The XOTcl syntax is slightly more redundant, -since every definition of a method is a single toplevel command -starting with the class name (also NX supports the style used in -XOTcl). In NX, all methods are per default protected (XOTcl does not -support protection). In NX methods are defined in the definition of -the class via <code>:method</code> or <code>:public method</code>. In XOTcl methods are -defined via the <code>instproc</code> method.</p></div> -<div class="paragraph"><p>Another difference is the notation to refer to instance variables. In -NX, instance variable are named with a single colon in the front. In -XOTcl, instance variables are imported using <code>instvar</code>.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="top">Stack example in NX </th> -<th align="left" valign="top">Stack example in XOTcl</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="top"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Stack { - - <span class='nx-comment'># -</span> <span class='nx-comment'># Stack of Things -</span> <span class='nx-comment'># -</span> - <span class='nx-keyword'>:variable</span> things <span class='nx-string'>""</span> - - <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> push {thing} { - <span class='nx-keyword'>set</span> :things [<span class='nx-keyword'>linsert</span> <span class='nx-variable'>${</span><span class='nx-variable'>:things}</span> 0 <span class='nx-variable'>$thing</span>] - <span class='nx-keyword'>return</span> <span class='nx-variable'>$thing</span> - } - - <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> pop {} { - <span class='nx-keyword'>set</span> top [<span class='nx-keyword'>lindex</span> <span class='nx-variable'>${</span><span class='nx-variable'>:things}</span> 0] - <span class='nx-keyword'>set</span> :things [<span class='nx-keyword'>lrange</span> <span class='nx-variable'>${</span><span class='nx-variable'>:things}</span> 1 end] - <span class='nx-keyword'>return</span> <span class='nx-variable'>$top</span> - } -}</pre></div></div></div></td> -<td align="left" valign="top"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># -</span><span class='nx-comment'># Stack of Things -</span><span class='nx-comment'># -</span> -<span class='nx-keyword'>Class</span> Stack - -Stack instproc <span class='nx-keyword'>init</span> {} { - <span class='nx-keyword'>my</span> instvar things - <span class='nx-keyword'>set</span> things <span class='nx-string'>""</span> -} - -Stack instproc push {thing} { - <span class='nx-keyword'>my</span> instvar things - <span class='nx-keyword'>set</span> things [<span class='nx-keyword'>linsert</span> <span class='nx-variable'>$things</span> 0 <span class='nx-variable'>$thing</span>] - <span class='nx-keyword'>return</span> <span class='nx-variable'>$thing</span> -} - -Stack instproc pop {} { - <span class='nx-keyword'>my</span> instvar things - <span class='nx-keyword'>set</span> top [<span class='nx-keyword'>lindex</span> <span class='nx-variable'>$things</span> 0] - <span class='nx-keyword'>set</span> things [<span class='nx-keyword'>lrange</span> <span class='nx-variable'>$things</span> 1 end] -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect2"> -<h3 id="_using_xotcl_2_0_and_the_next_scripting_language_in_a_single_interpreter">1.3. Using XOTcl 2.0 and the Next Scripting Language in a Single Interpreter</h3> -<div class="paragraph"><p>In general, the Next Scripting Framework supports multiple object -systems concurrently. Effectively, every object system has different -base classes for creating objects and classes. Therefore, these object -systems can have different interfaces and names of built-in -methods. Currently, the Next Scripting Framework is packaged with -three object systems:</p></div> -<div class="ulist"><ul> -<li> -<p> -NX -</p> -</li> -<li> -<p> -XOTcl 2.0 -</p> -</li> -<li> -<p> -TclCool -</p> -</li> -</ul></div> -<div class="paragraph"><p>XOTcl 2 is highly compatible with XOTcl 1, the language NX is -described below in more details, the language TclCool was introduced -in Tip#279 and serves primarily an example of a small OO language.</p></div> -<div class="paragraph"><p>A single Tcl interpreter can host multiple Next Scripting Object -Systems at the same time. This fact makes migration from XOTcl to NX -easier. The following example script shows to use XOTcl and NX in a -single script:</p></div> -<div class="listingblock"> -<div class="title">Using Multiple Object Systems in a single Script</div> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>namespace</span> <span class='nx-keyword'>eval</span> mypackage { - - <span class='nx-keyword'>package</span> <span class='nx-keyword'>require</span> XOTcl 2.0 - - <span class='nx-comment'># Define a class with a public method foo using XOTcl -</span> <span class='nx-keyword'>xotcl::Class</span> C1 - C1 instproc foo {} {<span class='nx-keyword'>puts</span> <span class='nx-string'>"hello world"</span>} - - <span class='nx-keyword'>package</span> <span class='nx-keyword'>require</span> nx - - <span class='nx-comment'># Define a class with a public method foo using NX -</span> <span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> C2 { - <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> foo {} {<span class='nx-keyword'>puts</span> <span class='nx-string'>"hello world"</span>} - } -}</pre></div></div> -<div class="paragraph"><p>One could certainly create object or classes from the different object -systems via fully qualified names (e.g. using e.g. <code>::xotcl::Class</code> or -<code>::nx::Class</code>), but for migration for systems without explicit -namespaces switching between the object systems eases migration. -"Switching" between XOTcl and NX effectively means the load some -packages (if needed) and to import either the base classes (Object and -Class) of XOTcl or NX into the current namespace.</p></div> -</div> -</div> -</div> -<div class="sect1"> -<h2 id="_xotcl_idioms_in_the_next_scripting_language">2. XOTcl Idioms in the Next Scripting Language</h2> -<div class="sectionbody"> -<div class="paragraph"><p>The following sections are intended for reader familiar with XOTcl and -show, how certain language Idioms of XOTcl can be expressed in NX. In -some cases, multiple possible realizations are listed</p></div> -<div class="sect2"> -<h3 id="_defining_objects_and_classes">2.1. Defining Objects and Classes</h3> -<div class="paragraph"><p>When creating objects or classes, one should use the method <code>create</code> -explicitly. In XOTcl, a default <code>unknown</code> method handler was provided for -classes, which create for every unknown method invocation an -object/class with the name of the invoked method. This technique was -convenient, but as well dangerous, since typos in method names lead -easily to unexpected behavior. This default unknown method handler is not -provided in NX (but can certainly be provided as a one-liner in NX by -the application).</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> ClassName</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> ClassName</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Object</span> ObjectName</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> ObjectName</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect2"> -<h3 id="_defining_methods">2.2. Defining Methods</h3> -<div class="paragraph"><p>In general, both XOTcl and NX support methods on the object level -(per-object methods, i.e. methods only applicable to a single object) -and on the class level (methods inherited to instances of the -classes). While the naming in XOTcl tried to follow closely the Tcl -tradition (using the term <code>proc</code> for functions/methods), NX uses the -term <code>method</code> for defining scripted methods.</p></div> -<div class="paragraph"><p>XOTcl uses the prefix <code>inst</code> to denote that methods are provided for -instances, calling therefore scripted methods for instances -<code>instproc</code>. This is certainly an unusual term. The approach with the -name prefix has the disadvantage, that for every different kind of -method, two names have to be provided (eg. <code>proc</code> and <code>instproc</code>, -<code>forward</code> and <code>instforward</code>).</p></div> -<div class="paragraph"><p>NX on the contrary uses the same term for defining instance method or -object-specific methods. When the term (e.g. <code>method</code>) is used on a -class, the method will be an instance method (i.e. applicable to the -instances of the class). When the term is used on an object with the -modifier <code>object</code>, an object-specific method is defined. This way one -can define the same way object specific methods on an object as well -as on a class.</p></div> -<div class="paragraph"><p>Furthermore, both XOTcl and NX distinguish between scripted methods -(section 3.2.1) and C-defined methods (section 3.2.2). Section 3.2.3 -introduces method protection, which is only supported by NX.</p></div> -<div class="sect3"> -<h4 id="_scripted_methods_defined_in_the_init_block_of_a_class_object_or_with_separate_calls">2.2.1. Scripted Methods Defined in the Init-block of a Class/Object or with Separate Calls</h4> -<div class="paragraph"><p>The following examples show the definition of a class and its methods -in the init-block of a class (NX only), and the definition of methods -via separate top level calls (XOTcl and NX).</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define instance method 'foo' and object -</span><span class='nx-comment'># method 'bar' for a Class 'C' with separate -</span><span class='nx-comment'># toplevel commands -</span> -<span class='nx-keyword'>Class</span> C -C instproc foo args {...} -C <span class='nx-keyword'>proc</span> bar args {...}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define instance method and object method -</span><span class='nx-comment'># in the init-block of a class -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { - <span class='nx-keyword'>:method</span> foo args {...} - <span class='nx-keyword'>:object</span> <span class='nx-keyword'>method</span> bar args {...} -}</pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define instance method and object method -</span><span class='nx-comment'># with separate commands -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C -C <span class='nx-keyword'>method</span> foo args {...} -C <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> bar args {...}</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define object-specific method foo -</span><span class='nx-comment'># for an object 'o' with separate commands -</span> -<span class='nx-keyword'>Object</span> o -o <span class='nx-keyword'>set</span> x 1 -o <span class='nx-keyword'>proc</span> foo args {...}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define object method and set -</span><span class='nx-comment'># instance variable in the init-block of -</span><span class='nx-comment'># an object -</span> -<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { - <span class='nx-keyword'>set</span> :x 1 - <span class='nx-keyword'>:object</span> <span class='nx-keyword'>method</span> foo args {...} -}</pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define object method and set -</span><span class='nx-comment'># instance variable with separate -</span><span class='nx-comment'># commands -</span> -<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o -o <span class='nx-keyword'>eval</span> {<span class='nx-keyword'>set</span> :x 1} -o <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> foo args {...}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_different_kinds_of_methods">2.2.2. Different Kinds of Methods</h4> -<div class="paragraph"><p>This section describes various kinds of methods. The different kinds -of methods are defined via different method-defining methods, which -are summarized in the following table for XOTcl and NX.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Methods for defining methods: -</span><span class='nx-comment'># -</span><span class='nx-comment'># proc -</span><span class='nx-comment'># instproc -</span><span class='nx-comment'># forward -</span><span class='nx-comment'># instforward -</span><span class='nx-comment'># parametercmd -</span><span class='nx-comment'># instparametercmd -</span><span class='nx-comment'># -</span><span class='nx-comment'># All these methods return empty.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Methods for defining methods: -</span><span class='nx-comment'># -</span><span class='nx-comment'># alias -</span><span class='nx-comment'># forward -</span><span class='nx-comment'># method -</span><span class='nx-comment'># -</span><span class='nx-comment'># All these methods return method-handles.</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>In addition to scripted methods (previous section) XOTcl supports -forwarder (called <code>forward</code> and <code>instforward</code>) and accessor functions -to variables (called <code>parametercmd</code> and <code>instparametercmd</code>). The -accessor functions are used normally internally when object-specific -parameters are defined (see Section 3.4).</p></div> -<div class="paragraph"><p>In NX forwarders are called <code>forward</code>. NX does not provide an public -available method to define variable accessors like <code>parametercmd</code> in -XOTcl, but use internally the Next Scripting Framework primitive -<code>nsf::method::setter</code> when appropriate.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> C -C instforward f1 ... -C <span class='nx-keyword'>forward</span> f2 ... - -<span class='nx-keyword'>Object</span> o -o <span class='nx-keyword'>forward</span> f3 ...</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define forwarder -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { - <span class='nx-keyword'>:forward</span> f1 ... - <span class='nx-keyword'>:object</span> <span class='nx-keyword'>forward</span> f2 ... -} - -<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { - <span class='nx-keyword'>:object</span> <span class='nx-keyword'>forward</span> f3 ... -}</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define setter and getter methods in XOTcl. -</span><span class='nx-comment'># -</span><span class='nx-comment'># XOTcl provides methods for these. -</span> -<span class='nx-keyword'>Class</span> C -C instparametercmd p1 -C parametercmd p2 - -<span class='nx-keyword'>Object</span> o -o parametercmd p3</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define setter and getter methods in NX. -</span><span class='nx-comment'># -</span><span class='nx-comment'># NX does not provide own methods, but uses -</span><span class='nx-comment'># the low level framework commands, since -</span><span class='nx-comment'># application developer will only seldom -</span><span class='nx-comment'># need it. -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C -::nsf::method::setter C p1 -::nsf::method::setter C -per-object p2 - -<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o -::nsf::method::setter o p3</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>NX supports in contrary to XOTcl the method <code>alias</code> which can be used -to register arbitrary Tcl commands or methods for an object or class -under a provided method name. Aliases can be used to reuse a certain implementation in -e.g. different object systems under potentially different names. In -some respects aliases are similar to forwarders, but they do not -involve forwarding overhead.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Method "alias" not available</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define method aliases -</span><span class='nx-comment'># (to scripted or non-scripted methods) -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { - <span class='nx-keyword'>:alias</span> a1 ... - <span class='nx-keyword'>:object</span> <span class='nx-keyword'>alias</span> a2 ... -} - -<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { - <span class='nx-keyword'>:object</span> <span class='nx-keyword'>alias</span> a3 ... -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="method-protect-example">2.2.3. Method Modifiers and Method Protection</h4> -<div class="paragraph"><p>NX supports four method modifiers <code>object</code>, <code>public</code>, <code>protected</code> and -<code>private</code>. All method modifiers can be written in front of every -method defining command. The method modifier <code>object</code> is used to denote -object-specific methods (see above). The concept of method protection -is new in NX.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Method modifiers -</span><span class='nx-comment'># -</span><span class='nx-comment'># "object", -</span><span class='nx-comment'># "public", -</span><span class='nx-comment'># "protected", and -</span><span class='nx-comment'># "private" -</span><span class='nx-comment'># -</span><span class='nx-comment'># are not available</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Method modifiers -</span><span class='nx-comment'># -</span><span class='nx-comment'># "object", -</span><span class='nx-comment'># "public", -</span><span class='nx-comment'># "protected" -</span><span class='nx-comment'># -</span><span class='nx-comment'># are applicable for all kinds of -</span><span class='nx-comment'># method defining methods: -</span><span class='nx-comment'># -</span><span class='nx-comment'># method, forward, alias -</span><span class='nx-comment'># -</span><span class='nx-comment'># The modifier "private" is available for -</span><span class='nx-comment'># -</span><span class='nx-comment'># method, forward, alias -</span><span class='nx-comment'># -</span><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { - :/<span class='nx-keyword'>method</span>-definition-method/ ... - <span class='nx-keyword'>:public</span> /<span class='nx-keyword'>method</span>-definition-method/ ... - <span class='nx-keyword'>:protected</span> /<span class='nx-keyword'>method</span>-definition-method/ ... - <span class='nx-keyword'>:private</span> /<span class='nx-keyword'>method</span>-definition-method/ ... - <span class='nx-keyword'>:object</span> /<span class='nx-keyword'>method</span>-definition-method/ ... - <span class='nx-keyword'>:public</span> <span class='nx-keyword'>object</span> /<span class='nx-keyword'>method</span>-definition-method/ ... - <span class='nx-keyword'>:protected</span> <span class='nx-keyword'>object</span> /<span class='nx-keyword'>method</span>-definition-method/ ... - <span class='nx-keyword'>:private</span> <span class='nx-keyword'>object</span> /<span class='nx-keyword'>method</span>-definition-method/ ... -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>XOTcl does not provide method protection. In NX, all methods are -defined per default as protected. This default can be changed by the -application developer in various ways. The command <code>::nx::configure -defaultMethodCallProtection true|false</code> can be used to set the default -call protection for scripted methods, forwarder and aliases. -The defaults can be overwritten also on a class level.</p></div> -<div class="paragraph"><p>NX provides means for method hiding via the method modifier -<code>private</code>. Hidden methods can be invoked only via the <code>-local</code> flag, -which means: "call the specified method defined in the same -class/object as the currently executing method".</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># XOTcl provides no means for -</span><span class='nx-comment'># method hiding</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Hiding of methods via "private" -</span><span class='nx-comment'># -</span><span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> Base { - <span class='nx-keyword'>:private</span> <span class='nx-keyword'>method</span> baz {a b} {<span class='nx-keyword'>expr</span> {<span class='nx-variable'>$a</span> + <span class='nx-variable'>$b</span>}} - <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> foo {a b} {: -local baz <span class='nx-variable'>$a</span> <span class='nx-variable'>$b</span>} -} - -<span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> Sub -superclass Base { - <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> bar {a b} {: -local baz <span class='nx-variable'>$a</span> <span class='nx-variable'>$b</span>} - <span class='nx-keyword'>:private</span> <span class='nx-keyword'>method</span> baz {a b} {<span class='nx-keyword'>expr</span> {<span class='nx-variable'>$a</span> * <span class='nx-variable'>$b</span>}} - - <span class='nx-keyword'>:create</span> s1 -} - -s1 foo 3 4 ;<span class='nx-comment'># returns 7 -</span>s1 bar 3 4 ;<span class='nx-comment'># returns 12 -</span>s1 baz 3 4 ;<span class='nx-comment'># unable to dispatch method 'baz'</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="method-deletion">2.2.4. Method Deletion</h4> -<div class="paragraph"><p>NX provides an explicit <code>delete</code> method for the deletion of methods.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># XOTcl provides only method deletion with -</span><span class='nx-comment'># the equivalent of Tcl's "proc foo {} {}" -</span><span class='nx-placeholder'>/cls/</span> instproc foo {} {} -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>proc</span> foo {} {}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Deletion of Methods -</span><span class='nx-comment'># -</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>method</span> <span class='nx-placeholder'>/name/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -</div> -<div class="sect2"> -<h3 id="_resolvers">2.3. Resolvers</h3> -<div class="paragraph"><p>The Next Scripting Framework defines Tcl resolvers for method and -variable names to implement object specific behavior. Within the -bodies of scripted methods these resolver treat variable and function -names starting with a colon <code>:</code> specially. In short, a colon-prefixed -variable name refers to an instance variable, and a colon-prefixed -function name refers to a method. The sub-sections below provide -detailed examples.</p></div> -<div class="paragraph"><p>Note that the resolvers of the Next Scripting Framework can be used in -the XOTcl 2.* environment as well.</p></div> -<div class="sect3"> -<h4 id="_invoking_methods">2.3.1. Invoking Methods</h4> -<div class="paragraph"><p>In XOTcl, a method of the same object can be invoked via <code>my</code>, or in -general via using the name of the object in front of the method name.</p></div> -<div class="paragraph"><p>In NX, the own methods are called via the method name prefixed with a -single colon. The invocation of the methods of other objects is the -same in NX and XOTcl.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> C -C instproc foo args {...} -C instproc bar args { - <span class='nx-keyword'>my</span> foo 1 2 3 ;<span class='nx-comment'># invoke own method -</span> o baz ;<span class='nx-comment'># invoke other object's method -</span>} -<span class='nx-keyword'>Object</span> o -o <span class='nx-keyword'>proc</span> baz {} {...}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { - <span class='nx-keyword'>:method</span> foo args {...} - <span class='nx-keyword'>:method</span> bar args { - :foo 1 2 3 ;<span class='nx-comment'># invoke own method -</span> o baz ;<span class='nx-comment'># invoke other object's method -</span> } -} -<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { - <span class='nx-keyword'>:public</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> baz {} {...} -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_accessing_own_instance_variables_from_method_bodies">2.3.2. Accessing Own Instance Variables from Method Bodies</h4> -<div class="paragraph"><p>In general, the Next Scripting Language favors the access to an -objects’s own instance variables over variable accesses of other -objects. This means that in NX it is syntactically easier to access -the own instance variables. On the contrary, in XOTcl, the variable -access to own and other variables are fully symmetric.</p></div> -<div class="paragraph"><p>In XOTcl, the following approaches are used to access instance -variables:</p></div> -<div class="ulist"><ul> -<li> -<p> -Import instance variables via <code>instvar</code> and access variables via <code>$varName</code> -</p> -</li> -<li> -<p> -Set or get instance variables via <code>my set varName ?value?</code> or other - variable accessing methods registered on <code>xotcl::Object</code> such as - <code>append</code>, <code>lappend</code>, <code>incr</code>, etc. -</p> -</li> -<li> -<p> -Register same-named accessor functions and set/get values - of instance variables via <code>my varName ?value?</code> -</p> -</li> -</ul></div> -<div class="paragraph"><p>In NX, the favored approach to access instance variables is to use -the name resolvers, although it is as well possible to import -variables via <code>nx::var import</code> or to check for the existence of -instance variables via <code>nx::var exists</code>.</p></div> -<div class="paragraph"><p>The following examples summary the use cases for accessing the own and -other instance variables.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> C -C instproc foo args { - <span class='nx-comment'># Method scoped variable a -</span> <span class='nx-keyword'>set</span> a 1 - <span class='nx-comment'># Instance variable b -</span> <span class='nx-keyword'>my</span> instvar b - <span class='nx-keyword'>set</span> b 2 - <span class='nx-comment'># Global variable/namespaced variable c -</span> <span class='nx-keyword'>set</span> ::c 3 -}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { - <span class='nx-keyword'>:method</span> foo args {...} - <span class='nx-comment'># Method scoped variable a -</span> <span class='nx-keyword'>set</span> a 1 - <span class='nx-comment'># Instance variable b -</span> <span class='nx-keyword'>set</span> :b 2 - <span class='nx-comment'># Global variable/namespaced variable c -</span> <span class='nx-keyword'>set</span> ::c 3 - } -}</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>... instproc ... { - <span class='nx-keyword'>my</span> <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> -}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Set own instance variable to a value via -</span><span class='nx-comment'># resolver (preferred and fastest way) -</span> -... <span class='nx-keyword'>method</span> ... { - <span class='nx-keyword'>set</span> :<span class='nx-placeholder'>/newVar/</span> <span class='nx-placeholder'>?value?</span> -}</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>... instproc ... { - <span class='nx-keyword'>my</span> instvar <span class='nx-placeholder'>/varName/</span> - <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> -}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Set own instance variable via -</span><span class='nx-comment'># variable import -</span> -... <span class='nx-keyword'>method</span> ... { - ::nx::var import [<span class='nx-keyword'>self</span>] <span class='nx-placeholder'>/varName/</span> - <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> -}</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>... instproc ... { - <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> [<span class='nx-keyword'>my</span> <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/otherVar/</span>] -}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Read own instance variable -</span> -... <span class='nx-keyword'>method</span> ... { - <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> [<span class='nx-keyword'>set</span> :<span class='nx-placeholder'>/otherVar/</span>] -}</pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>... <span class='nx-keyword'>method</span> ... { - <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/newVar/</span> <span class='nx-variable'>${</span><span class='nx-variable'>:/otherVar/}</span> -}</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>... instproc ... { - <span class='nx-keyword'>my</span> exists <span class='nx-placeholder'>/varName/</span> -}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Test existence of own instance variable -</span> -... <span class='nx-keyword'>method</span> ... { - <span class='nx-keyword'>info</span> :<span class='nx-placeholder'>/varName/</span> -}</pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'> ... <span class='nx-keyword'>method</span> ... { - ::nx::var exists [<span class='nx-keyword'>self</span>] <span class='nx-placeholder'>/varName/</span> -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_accessing_instance_variables_of_other_objects">2.3.3. Accessing Instance Variables of other Objects</h4> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Set instance variable of object obj to a -</span><span class='nx-comment'># value via resolver -</span><span class='nx-comment'># (preferred way: define property on obj) -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>eval</span> [<span class='nx-keyword'>list</span> <span class='nx-keyword'>set</span> :<span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span>]</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> [<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/otherVar/</span>]</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Read instance variable of object obj -</span><span class='nx-comment'># via resolver -</span> -<span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> [<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>eval</span> {<span class='nx-keyword'>set</span> :<span class='nx-placeholder'>/otherVar/</span>}]</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>... instproc ... { - <span class='nx-placeholder'>/obj/</span> instvar <span class='nx-placeholder'>/varName/</span> - <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> -}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Read instance variable of object /obj/ -</span><span class='nx-comment'># via import -</span> -... <span class='nx-keyword'>method</span> ... { - ::nx::var import <span class='nx-placeholder'>/obj/</span> <span class='nx-placeholder'>/varName/</span> - <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> -}</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> exists varName</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Test existence of instance variable of -</span><span class='nx-comment'># object obj -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>eval</span> {<span class='nx-keyword'>info</span> exists :<span class='nx-placeholder'>/varName/</span>}</pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>::nx::var exists <span class='nx-placeholder'>/obj/</span> <span class='nx-placeholder'>/varName/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -</div> -<div class="sect2"> -<h3 id="_parameters">2.4. Parameters</h3> -<div class="paragraph"><p>While XOTcl 1 had very limited forms of parameters, XOTcl 2 and NX -provide a generalized and highly orthogonal parameter machinery -handling various kinds of value constraints (also called value -checkers). Parameters are used to specify,</p></div> -<div class="ulist"><ul> -<li> -<p> -how objects and classes are initialized (we call these parameter types - <em>Configure Parameters</em>), and -</p> -</li> -<li> -<p> -what values can be passed to methods (we call these <em>Method - Parameters</em>). -</p> -</li> -</ul></div> -<div class="paragraph"><p>Furthermore, parameters might be positional or non-positional, they -might be optional or required, they might have a defined multiplicity, -and value-types, they might be introspected, etc. The Next Scripting -Framework provide a unified, C-implemented infrastructure to handle -both, object and method parameters in the same way with a high degree -of orthogonality.</p></div> -<div class="paragraph"><p>Configuration parameters were specified in XOTcl 1 primarily via the -method <code>parameter</code> in a rather limited way, XOTcl 1 only supported -non-positional parameters in front of positional ones, supported no -value constraints for positional parameters, provided no distinction -between optional and required, and did not support multiplicity.</p></div> -<div class="paragraph"><p>Furthermore, the Next Scripting Framework provides optionally <em>Return -Value Checking</em> based on the same mechanism to check whether some -methods return always the values as specified.</p></div> -<div class="sect3"> -<h4 id="_parameters_for_configuring_objects_variables_and_properties">2.4.1. Parameters for Configuring Objects: Variables and Properties</h4> -<div class="paragraph"><p>Configure parameters are used for specifying values for configuring -objects when they are created (i.e. how instance variables are -initialized, what parameters can be passed in for initialization, what -default values are used, etc.). Such configuration parameters are -supported in XOTcl primarily via the method <code>parameter</code>, which is used -in XOTcl to define multiple parameters via a list of parameter -specifications.</p></div> -<div class="paragraph"><p>Since the term "parameter" is underspecified, NX uses a more -differentiated terminology. NX distinguishes between configurable -instance variables (also called <em>properties</em>) and non configurable -instance variables (called <em>variables</em>), which might have as well -e.g. default values. The values of configurable properties can be -queried at runtime via <code>cget</code>, and their values can be altered via -<code>configure</code>. When the value of a configure parameter is provided or -changed, the value checkers from the variable definition are used to -ensure, the value is permissible (i.e. it is for example an integer -value). The sum of all configurable object parameters are called -<em>configure parameters</em>. To define a define a configurable variable, NX -uses the method <code>property</code>, for non-configurable variables, the method -<code>variable</code> is used.</p></div> -<div class="paragraph"><p>Optionally, one can define in NX, that a <code>property</code> or a -<code>variable</code> should have a public, protected or private accessor. Such -an accessor is a method with the same name as the variable. In XOTcl, -every <code>parameter</code> defined as well automatically a same-named accessor -method, leading to potential name conflicts with other method names.</p></div> -<div class="paragraph"><p>In the examples below we show the definition of configurable an -non-configurable instance variables using <code>variable</code> and <code>property</code> -respectively.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define class "Foo" with instance -</span><span class='nx-comment'># variables "x" and "y" initialized -</span><span class='nx-comment'># on instance creation. The initialization -</span><span class='nx-comment'># has to be performed in the constructor. -</span> -<span class='nx-keyword'>Class</span> Foo -Foo instproc <span class='nx-keyword'>init</span> args { - instvar x y - <span class='nx-keyword'>set</span> x 1 - <span class='nx-keyword'>set</span> y 2 -} - -<span class='nx-comment'># Create instance of the class Foo -</span>Foo f1 - -<span class='nx-comment'># Object f1 has instance variables -</span><span class='nx-comment'># x == 1 and y == 2</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define class "Foo" with instance variables -</span><span class='nx-comment'># "x" and "y" initialized on instance creation. -</span><span class='nx-comment'># The method "variable" is similar in syntax -</span><span class='nx-comment'># to Tcl's "variable" command. During -</span><span class='nx-comment'># instance creation, the variable -</span><span class='nx-comment'># definitions are used for the -</span><span class='nx-comment'># initialization of the variables of the object. -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { - <span class='nx-keyword'>:variable</span> x 1 - <span class='nx-keyword'>:variable</span> y 2 -} - -<span class='nx-comment'># Create instance of the class Foo -</span>Foo <span class='nx-keyword'>create</span> f1 - -<span class='nx-comment'># Object f1 has instance variables -</span><span class='nx-comment'># x == 1 and y == 2</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>While XOTcl follows a procedural way to initialize variables via the -constructor <code>init</code>, NX follows a more declarative approach. Often, -classes have superclasses, which often want to provide their own -instance variables and default values. The declarative approach from -NX solves this via inheritance, while an procedural approach via -assign statements in the constructor requires explicit constructor -calls, which are often error-prone. Certainly, when a user prefers to -assign initial values to instance variables via explicit assign -operations in constructors, this is as well possible in NX.</p></div> -<div class="paragraph"><p>NX uses the same mechanism to define class variables or object -variables.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># No syntactic support for creating -</span><span class='nx-comment'># class variables</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'> -<span class='nx-comment'># Define a object variable "V" with value 100 and -</span><span class='nx-comment'># an instance variable "x". "V" is defined for the -</span><span class='nx-comment'># class object Foo, "x" is defined in the -</span><span class='nx-comment'># instances of the class. "object variable" works -</span><span class='nx-comment'># similar to "object method". -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { - <span class='nx-keyword'>:object</span> <span class='nx-keyword'>variable</span> V 100 - <span class='nx-keyword'>:variable</span> x 1 -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>In the next step, we define configurable instance variables which we -call <em>properties</em> in NX.</p></div> -<div class="paragraph"><p>XOTcl uses the method <code>parameter</code> is a shortcut for creating multiple -configurable variables with automatically created accessors (methods for -reading and writing of the variables). In NX, the preferred way to -create configurable variables is to use the method <code>property</code>. The -method <code>property</code> in NX is similar to <code>variable</code>, but makes the -variables configurable, which means that</p></div> -<div class="olist arabic"><ol class="arabic"> -<li> -<p> -one can specify the property as a non-positional parameter upon - creation of the object, -</p> -</li> -<li> -<p> -one can query the value via the method <code>cget</code>, and -</p> -</li> -<li> -<p> -one can modify the value of the underlying variable via the method - <code>configure</code>. -</p> -</li> -</ol></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Parameters specified as a list -</span><span class='nx-comment'># (short form); parameter -</span><span class='nx-comment'># "a" has no default, "b" has default "1" -</span> -<span class='nx-keyword'>Class</span> Foo -parameter {a {b 1}} - -<span class='nx-comment'># Create instance of the class Foo -</span>Foo f1 -a 0 - -<span class='nx-comment'># Object f1 has instance variables -</span><span class='nx-comment'># a == 0 and b == 1 -</span> -<span class='nx-comment'># XOTcl registers automatically accessors -</span><span class='nx-comment'># for the parameters. Use the accessor -</span><span class='nx-comment'># "b" to output the value of variable "b" -</span><span class='nx-keyword'>puts</span> [f1 b] - -<span class='nx-comment'># Use the setter to alter value of -</span><span class='nx-comment'># instance variable "b" -</span>f1 b 100</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define property "a" and "b". The -</span><span class='nx-comment'># property "a" has no default, "b" has -</span><span class='nx-comment'># default value "1" -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { - <span class='nx-keyword'>:property</span> a - <span class='nx-keyword'>:property</span> {b 1} -} - -<span class='nx-comment'># Create instance of the class Foo -</span>Foo <span class='nx-keyword'>create</span> f1 -a 0 - -<span class='nx-comment'># Object f1 has instance variables -</span><span class='nx-comment'># a == 0 and b == 1 -</span> -<span class='nx-comment'># Use the method "cget" to query the value -</span><span class='nx-comment'># of a configuration parameter -</span><span class='nx-keyword'>puts</span> [f1 <span class='nx-keyword'>cget</span> -b] - -<span class='nx-comment'># Use the method "configure" to alter the -</span><span class='nx-comment'># value of instance variable "b" -</span>f1 <span class='nx-keyword'>configure</span> -b 100</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>In general, NX allows to create variables and properties with and -without accessor methods. The created accessor methods might be -<code>public</code>, <code>protected</code> or <code>public</code>. When the value <code>none</code> is provided -to <code>-accessor</code>, no accessor will be created. This is actually the -default in NX. In order to change the default behavior in NX, one can use -<code>::nx::configure defaultAccessor none|public|protected|private</code>.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># "parameter" creates always accessor -</span><span class='nx-comment'># methods, accessor methods are -</span><span class='nx-comment'># always public, no "cget" is available. -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo -parameter {a {b1}} - -<span class='nx-comment'># Use the accessor method to query -</span><span class='nx-comment'># the value of a configuration parameter -</span><span class='nx-keyword'>puts</span> [f1 b] - -<span class='nx-comment'># Use the accessor method to set the -</span><span class='nx-comment'># value of instance variable "a" -</span>f1 a 100 - -<span class='nx-comment'># Use the accessor method to unset the -</span><span class='nx-comment'># value of instance variable "a" n.a. via -</span><span class='nx-comment'># accessor</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define property "a" and "b". The -</span><span class='nx-comment'># property "a" has no default, "b" has -</span><span class='nx-comment'># default value "1" -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { - <span class='nx-keyword'>:variable</span> -accessor <span class='nx-keyword'>public</span> a - <span class='nx-keyword'>:property</span> -accessor <span class='nx-keyword'>public</span> {b 1} -} - -<span class='nx-comment'># Use the accessor method to query -</span><span class='nx-comment'># the value of a configuration parameter -</span><span class='nx-keyword'>puts</span> [f1 b get] - -<span class='nx-comment'># Use the accessor method to set the -</span><span class='nx-comment'># value of instance variable "a" -</span>f1 a <span class='nx-keyword'>set</span> 100 - -<span class='nx-comment'># Use the accessor method to unset the -</span><span class='nx-comment'># value of instance variable "a" -</span>f1 a <span class='nx-keyword'>unset</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>Similar to <code>variable</code>, properties can be defined in NX on the class -and on the object level.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># XOTcl provides no means to define -</span><span class='nx-comment'># configurable variables at the object -</span><span class='nx-comment'># level</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define class with a property for the class object -</span><span class='nx-comment'># named "cp". This is similar to "static variables" -</span><span class='nx-comment'># in some other object-oriented programming -</span><span class='nx-comment'># languages. -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { - ... - <span class='nx-keyword'>:object</span> <span class='nx-keyword'>property</span> cp 101 -} - -<span class='nx-comment'># Define object property "op" -</span> -<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { - <span class='nx-keyword'>:object</span> <span class='nx-keyword'>property</span> op 102 -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>NX supports <em>value constraints</em> (value-checkers) for object and method -parameters in an orthogonal manner. NX provides a predefined set of -value checkers, which can be extended by the application developer. -In NX, the <em>value checking is optional</em>. This means that it is possible to -develop e.g. which a large amount of value-checking and deploy the -script with value checking turned off, if the script is highly -performance sensitive.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># No value constraints for -</span><span class='nx-comment'># parameter available</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Predefined value constraints: -</span><span class='nx-comment'># object, class, alnum, alpha, ascii, boolean, -</span><span class='nx-comment'># control, digit, double, false, graph, integer, -</span><span class='nx-comment'># lower, parameter, print, punct, space, true, -</span><span class='nx-comment'># upper, wordchar, xdigit -</span><span class='nx-comment'># -</span><span class='nx-comment'># User defined value constraints are possible. -</span><span class='nx-comment'># All parameter value checkers can be turned on -</span><span class='nx-comment'># and off at runtime. -</span><span class='nx-comment'># -</span><span class='nx-comment'># Define a required boolean property "a" -</span><span class='nx-comment'># and an integer property "b" with a default. -</span><span class='nx-comment'># The first definition uses "properties", -</span><span class='nx-comment'># the second definition uses multiple -</span><span class='nx-comment'># "property" statements. -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo -properties { - a:boolean - {b:integer 1} -}</pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { - <span class='nx-keyword'>:property</span> a:boolean - <span class='nx-keyword'>:property</span> {b:integer 1} -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>In XOTcl all configure parameters were <em>optional</em>. Required parameters have -to be passed to the constructor of the object.</p></div> -<div class="paragraph"><p>NX allows to define <em>optional</em> and <em>required</em> configure parameters (as -well as method parameters). Therefore, configure parameters can be used -as the single mechanism to parametrize objects. It is in NX not -necessary (and per default not possible) to pass arguments to the -constructor.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Required parameter not available</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Required parameter: -</span><span class='nx-comment'># Define a required property "a" and a -</span><span class='nx-comment'># required boolean property "b" -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo -properties { - a:required - b:boolean,required -}</pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { - <span class='nx-keyword'>:property</span> a:required - <span class='nx-keyword'>:property</span> b:boolean,required -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>NX supports in contrary to XOTcl to define the <em>multiplicity</em> of values -per parameter. In NX, one can specify that a parameter can accept the -value "" (empty) in addition to e.g. an integer, or one can specify that the -value is an empty or non-empty ist of values via the multiplicity. For -every specified value, the value checkers are applied.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Multiplicity for parameter -</span><span class='nx-comment'># not available</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Parameter with multiplicity -</span><span class='nx-comment'># ints is a list of integers, with default -</span><span class='nx-comment'># objs is a non-empty list of objects -</span><span class='nx-comment'># obj is a single object, maybe empty -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo -properties { - {ints:integer,0..n <span class='nx-string'>""</span>} - objs<span class='nx-keyword'>:object</span>,1..n - obj<span class='nx-keyword'>:object</span>,0..1 -}</pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { - <span class='nx-keyword'>:property</span> {ints:integer,0..n <span class='nx-string'>""</span>} - <span class='nx-keyword'>:property</span> objs<span class='nx-keyword'>:object</span>,1..n - <span class='nx-keyword'>:property</span> obj<span class='nx-keyword'>:object</span>,0..1 -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>For the implementation of variables and properties, NX uses slot -objects, which are an extension to the <code>-slots</code> already available in -XOTcl. While very for every <code>property</code> in NX, a slot object is created, -for performance reasons, not every <code>variable</code> has a slot associated.</p></div> -<div class="paragraph"><p>When an property is created, NX does actually three things:</p></div> -<div class="olist arabic"><ol class="arabic"> -<li> -<p> -Create a slot object, which can be specified in more detail - using the init-block of the slot object -</p> -</li> -<li> -<p> -Create a parameter definition for the initialization of the - object (usable via a non-positional parameter during object - creation), and -</p> -</li> -<li> -<p> -register optionally an accessor function (setter), for which the usual - protection levels (<code>public</code>, <code>protected</code> or <code>private</code>) can be used. -</p> -</li> -</ol></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define parameters via slots -</span> -<span class='nx-keyword'>Class</span> Foo -slots { - <span class='nx-keyword'>Attribute</span> a - <span class='nx-keyword'>Attribute</span> b -default 1 -} - -<span class='nx-comment'># Create instance of the class Foo -</span><span class='nx-comment'># and provide a value for instance -</span><span class='nx-comment'># variable "a" -</span>Foo f1 -a 0 - -<span class='nx-comment'># Object f1 has a == 0 and b == 1</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Configurable parameters specified via the -</span><span class='nx-comment'># method "property" (supports method -</span><span class='nx-comment'># modifiers and scripted configuration; -</span><span class='nx-comment'># see below) -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { - <span class='nx-keyword'>:property</span> a - <span class='nx-keyword'>:property</span> {b 1} -} - -<span class='nx-comment'># Create instance of the class Foo and -</span><span class='nx-comment'># provide a value for instance variable "a" -</span>Foo <span class='nx-keyword'>create</span> f1 -a 0 - -<span class='nx-comment'># Object f1 has a == 0 and b == 1</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>Since the slots are objects, the slot objects can be configured and -parametrized like every other object in NX. Slot objects can be -provided with a scripted initialization as well. We show first the -definition of properties similar to the functionality provided as well -by XOTcl and show afterwards how to use value constraints, optional -parameters, etc. in NX.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define parameter with an an -</span><span class='nx-comment'># attribute-specific type checker -</span> -<span class='nx-keyword'>Class</span> Person -slots { - <span class='nx-keyword'>Attribute</span> <span class='nx-keyword'>create</span> sex -type <span class='nx-string'>"sex"</span> { - <span class='nx-keyword'>my</span> <span class='nx-keyword'>proc</span> type=sex {name value} { - <span class='nx-keyword'>switch</span> -glob <span class='nx-variable'>$value</span> { - m* {<span class='nx-keyword'>return</span> m} - f* {<span class='nx-keyword'>return</span> f} - default { - <span class='nx-keyword'>error</span> <span class='nx-string'>"expected sex but got $value"</span> - } - } - } - } -}</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Configure parameter with scripted -</span><span class='nx-comment'># definition (init-block), defining a -</span><span class='nx-comment'># property specific type checker -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Person { - <span class='nx-keyword'>:property</span> -accessor <span class='nx-keyword'>public</span> sex:sex,convert { - - <span class='nx-comment'># define a converter to standardize representation -</span> <span class='nx-keyword'>:object</span> <span class='nx-keyword'>method</span> type=sex {name value} { - <span class='nx-keyword'>switch</span> -glob <span class='nx-variable'>$value</span> { - m* {<span class='nx-keyword'>return</span> m} - f* {<span class='nx-keyword'>return</span> f} - default {<span class='nx-keyword'>error</span> <span class='nx-string'>"expected sex but got $value"</span>} - } - } - - } -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>The parameters provided by a class for the initialization of -instances can be introspected via querying the parameters -of the method create: <code>/cls/ info lookup parameters create</code> -(see <a href="#info_configure_parameter">[info_configure_parameter]</a>).</p></div> -</div> -<div class="sect3"> -<h4 id="_delete_variable_handlers">2.4.2. Delete Variable Handlers</h4> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># No syntactic support for deleting -</span><span class='nx-comment'># variable handlers</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Like deletion of Methods: -</span><span class='nx-comment'># Delete on the object, where the -</span><span class='nx-comment'># variable handler is defined. -</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>property</span> <span class='nx-placeholder'>/name/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>property</span> <span class='nx-placeholder'>/name/</span> - -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>variable</span> <span class='nx-placeholder'>/name/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>variable</span> <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_method_parameters">2.4.3. Method Parameters</h4> -<div class="paragraph"><p>Method parameters are used to specify the interface of a single method -(what kind of values may be passed to a method, what default values -are provided etc.). The method parameters specifications in XOTcl 1 -were limited and allowed only value constraints for non positional -arguments.</p></div> -<div class="paragraph"><p>NX and XOTcl 2 provide value constraints for all kind of method parameters. -While XOTcl 1 required non-positional arguments to be listed in front of -positional arguments, this limitation is lifted in XOTcl 2.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define method foo with non-positional -</span><span class='nx-comment'># parameters (x, y and y) and positional -</span><span class='nx-comment'># parameter (a and b) -</span> -<span class='nx-keyword'>Class</span> C -C instproc foo { - -x:integer - -y:required - -z - a - b -} { - <span class='nx-comment'># ... -</span>} -C <span class='nx-keyword'>create</span> c1 - -<span class='nx-comment'># invoke method foo -</span>c1 foo -x 1 -y a 2 3</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define method foo with -</span><span class='nx-comment'># non-positional parameters -</span><span class='nx-comment'># (x, y and y) and positional -</span><span class='nx-comment'># parameter (a and b) -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { - <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> foo { - -x:integer - -y:required - -z - a - b - } { - <span class='nx-comment'># ... -</span> } - <span class='nx-keyword'>:create</span> c1 -} -<span class='nx-comment'># invoke method foo -</span>c1 foo -x 1 -y a 2 3</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Only leading non-positional -</span><span class='nx-comment'># parameters are available; no -</span><span class='nx-comment'># optional positional parameters, -</span><span class='nx-comment'># no value constraints on -</span><span class='nx-comment'># positional parameters, -</span><span class='nx-comment'># no multiplicity, ...</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define various forms of parameters -</span><span class='nx-comment'># not available in XOTcl 1 -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { - <span class='nx-comment'># trailing (or interleaved) non-positional -</span> <span class='nx-comment'># parameters -</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> m1 {a b -x:integer -y} { - <span class='nx-comment'># ... -</span> } - - <span class='nx-comment'># positional parameters with value constraints -</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> m2 {a:integer b:boolean} { - <span class='nx-comment'>#... -</span> } - - <span class='nx-comment'># optional positional parameter (trailing) -</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> <span class='nx-keyword'>set</span> {varName value:optional} { - <span class='nx-comment'># .... -</span> } - - <span class='nx-comment'># parameter with multiplicity -</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> m3 {-objs<span class='nx-keyword'>:object</span>,1..n c<span class='nx-keyword'>:class</span>,0..1} { - <span class='nx-comment'># ... -</span> } - - <span class='nx-comment'># In general, the same list of value -</span> <span class='nx-comment'># constraints as for configure parameter is -</span> <span class='nx-comment'># available (see above). -</span> <span class='nx-comment'># -</span> <span class='nx-comment'># User defined value constraints are -</span> <span class='nx-comment'># possible. All parameter value checkers -</span> <span class='nx-comment'># can be turned on and off. -</span>}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_return_value_checking">2.4.4. Return Value Checking</h4> -<div class="paragraph"><p><em>Return value checking</em> is a functionality available in the Next -Scripting Framework, that was not yet available in XOTcl 1. A return -value checker assures that a method returns always a value satisfying -some value constraints. Return value checkers can be defined on all -forms of methods (scripted or C-implemented). Like for other value -checkers, return value checkers can be turned on and off.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># No return value checking -</span><span class='nx-comment'># available</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Define method foo with non-positional -</span><span class='nx-comment'># parameters (x, y and y) and positional -</span><span class='nx-comment'># parameter (a and b) -</span> -<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { - - <span class='nx-comment'># Define method foo which returns an -</span> <span class='nx-comment'># integer value -</span> <span class='nx-keyword'>:method</span> foo -returns integer {-x:integer} { - <span class='nx-comment'># ... -</span> } - - <span class='nx-comment'># Define an alias for the Tcl command ::incr -</span> <span class='nx-comment'># and assure, it always returns an integer -</span> <span class='nx-comment'># value -</span> <span class='nx-keyword'>:alias</span> <span class='nx-keyword'>incr</span> -returns integer ::incr - - <span class='nx-comment'># Define a forwarder that has to return an -</span> <span class='nx-comment'># integer value -</span> <span class='nx-keyword'>:forward</span> ++ -returns integer ::expr 1 + - - <span class='nx-comment'># Define a method that has to return a -</span> <span class='nx-comment'># non-empty list of objects -</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> instances {} \ - -returns <span class='nx-keyword'>object</span>,1..n { - <span class='nx-keyword'>return</span> [<span class='nx-keyword'>:info</span> instances] - } -}</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -</div> -<div class="sect2"> -<h3 id="_interceptors">2.5. Interceptors</h3> -<div class="paragraph"><p>XOTcl and NX allow the definition of the same set of interceptors, -namely class- and object-level mixins and class- and object-level -filters. The primary difference in NX is the naming, since NX abandons -the prefix "inst" from the names of instance specific method, but uses -the modifier <code>object</code>" for object specific methods.</p></div> -<div class="paragraph"><p>Therefore, in NX, if a <code>mixin</code> is registered on a class-level, it is -applicable for the instances (a per-class mixin), and if and <code>object -mixin</code> is registered, it is a per-object mixin. In both cases, the -term <code>mixin</code> is used, in the second case with the modifier -<code>object</code>. As in all other cases, one can register the same way a -per-object mixin on a plain object or on a class object.</p></div> -<div class="sect3"> -<h4 id="_register_mixin_classes_and_mixin_guards">2.5.1. Register Mixin Classes and Mixin Guards</h4> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> instmixin ... -<span class='nx-placeholder'>/cls/</span> instmixinguard /<span class='nx-keyword'>mixin</span>/ <span class='nx-placeholder'>?condition?</span> - -<span class='nx-comment'># Query per-class mixin -</span><span class='nx-placeholder'>/cls/</span> instmixin</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Register/clear per-class mixin and guard for -</span><span class='nx-comment'># a class -</span> -<span class='nx-placeholder'>/cls/</span> mixins add|<span class='nx-keyword'>set</span>|clear ... -<span class='nx-placeholder'>/cls/</span> mixins <span class='nx-keyword'>guard</span> /<span class='nx-keyword'>mixin</span>/ <span class='nx-placeholder'>?condition?</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>configure</span> -mixin ... - -<span class='nx-comment'># Query per-class mixins -</span><span class='nx-placeholder'>/cls/</span> mixins get -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>cget</span> -mixins - -<span class='nx-comment'># Query per-class mixins (without guards) -</span><span class='nx-placeholder'>/cls/</span> mixins classes</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>mixin</span> ... -<span class='nx-placeholder'>/obj/</span> mixinguard /<span class='nx-keyword'>mixin</span>/ <span class='nx-placeholder'>?condition?</span> - -<span class='nx-comment'># Query per-object mixins -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>mixin</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Register/clear per-object mixin and guard for -</span><span class='nx-comment'># an object -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> mixins add|<span class='nx-keyword'>set</span>|clear ... -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> mixins <span class='nx-keyword'>guard</span> /<span class='nx-keyword'>mixin</span>/ <span class='nx-placeholder'>?condition?</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>configure</span> -object-mixins ... - -<span class='nx-comment'># Query per-object mixin -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> mixins get -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>cget</span> -object-mixin - -<span class='nx-comment'># Query per-object mixins (without guards) -</span><span class='nx-placeholder'>/cls/</span> mixins classes</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_register_filters_and_filter_guards">2.5.2. Register Filters and Filter Guards</h4> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Register per-class filter and guard for -</span><span class='nx-comment'># a class -</span><span class='nx-placeholder'>/cls/</span> instfilter ... -<span class='nx-placeholder'>/cls/</span> instfilterguard /<span class='nx-keyword'>filter</span>/ <span class='nx-placeholder'>?condition?</span> - -<span class='nx-comment'># Query per-class filter -</span><span class='nx-placeholder'>/cls/</span> instfilter</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Register/clear per-class filter and guard for -</span><span class='nx-comment'># a class -</span> -<span class='nx-placeholder'>/cls/</span> filters add|<span class='nx-keyword'>set</span>|clear ... -<span class='nx-placeholder'>/cls/</span> filters <span class='nx-keyword'>guard</span> /<span class='nx-keyword'>filter</span>/ <span class='nx-placeholder'>?condition?</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>configure</span> -filters ... - -<span class='nx-comment'># Query per-class filters -</span><span class='nx-placeholder'>/cls/</span> filters get -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>cget</span> -filters - -<span class='nx-comment'># Query per-class filters (without guards) -</span><span class='nx-placeholder'>/cls/</span> filters <span class='nx-keyword'>methods</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>filter</span> ... -<span class='nx-placeholder'>/obj/</span> filterguard /<span class='nx-keyword'>filter</span>/ <span class='nx-placeholder'>?condition?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Register(clear per-object filter and guard for -</span><span class='nx-comment'># an object -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> filters add|<span class='nx-keyword'>set</span>|clear ... -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> filters <span class='nx-keyword'>guard</span> /<span class='nx-keyword'>filter</span>/ <span class='nx-placeholder'>?condition?</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>configure</span> -object-filters ... - -<span class='nx-comment'># Query per-object filters -</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>object</span> filters get -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>cget</span> -object-filters - -<span class='nx-comment'># Query per-object filters (without guards) -</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>object</span> filters <span class='nx-keyword'>methods</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -</div> -<div class="sect2"> -<h3 id="_introspection">2.6. Introspection</h3> -<div class="paragraph"><p>In general, introspection in NX became more orthogonal and less -dependent on the type of the method. In XOTcl it was e.g. necessary -that a developer had to know, whether a method is e.g. scripted or not -and has to use accordingly different sub-methods of <code>info</code>.</p></div> -<div class="paragraph"><p>In NX, one can use e.g. always <code>info method</code> with a subcommand and the -framework tries to hide the differences as far as possible. So, one -can for example obtain with <code>info method parameter</code> the parameters of -scripted and C-implemented methods the same way, one can get the -definition of all methods via <code>info method definition</code> and one can get -an manual-like interface description via <code>info method -syntax</code>. In addition, NX provides means to query the type of -a method, and NX allows to filter by the type of the method.</p></div> -<div class="sect3"> -<h4 id="_list_sub_and_superclass_relations">2.6.1. List sub- and superclass relations</h4> -<div class="paragraph"><p>While XOTcl used singular words for introspecting sub- and superclass -relations, NX uses plural word to indicate that potentially a list of -values is returned.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>superclass</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> superclasses <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> subclass <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> subclasses -type setter <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_methods_defined_by_classes">2.6.2. List methods defined by classes</h4> -<div class="paragraph"><p>While XOTcl uses different names for obtaining different kinds of -methods defined by a class, NX uses <code>info methods</code> in an orthogonal -manner. NX allows as well to use the call protection to filter the -returned methods.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instcommands <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instparametercmd <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type setter <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instprocs <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type scripted <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type <span class='nx-keyword'>alias</span> <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type forwarder <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type <span class='nx-keyword'>object</span> <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -callprotection <span class='nx-keyword'>public</span>|<span class='nx-keyword'>protected</span> ...</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_methods_defined_by_objects">2.6.3. List methods defined by objects</h4> -<div class="paragraph"><p>While XOTcl uses different names for obtaining different kinds of -methods defined by an object, NX uses <code>info methods</code> in an orthogonal -manner. NX allows as well to use the call protection to filter the -returned methods.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> commands <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> parametercmd <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type setter <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> procs <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type scripted <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type <span class='nx-keyword'>alias</span> <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type forwarder <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type <span class='nx-keyword'>object</span> <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -callprotection <span class='nx-keyword'>public</span>|<span class='nx-keyword'>protected</span> ...</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_check_existence_of_a_method">2.6.4. Check existence of a method</h4> -<div class="paragraph"><p>NX provides multiple ways of checking, whether a method exists; one -can use <code>info method exists</code> to check, if a given method exists -(return boolean), or one can use <code>info methods ?pattern?</code>, where -<code>pattern</code> might be a single method name without wild-card -characters. The method <code>info methods ?pattern?</code> returns a list of -matching names, which might be empty. These different methods appear -appropriate depending on the context.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>/obj|cls/ <span class='nx-keyword'>info</span> \ - [inst](commands|procs|parametercmd) \ - <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> exists <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> exists <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_callable_methods">2.6.5. List callable methods</h4> -<div class="paragraph"><p>In order to obtain for an object the set of artefacts defined in the - class hierarchy, NX uses <code>info lookup</code>. One can either lookup methods - (via <code>info lookup methods</code>) or slots (via <code>info lookup slots</code>). The - plural term refers to a potential set of return values.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> <span class='nx-keyword'>methods</span> ... <span class='nx-placeholder'>?pattern?</span> -<span class='nx-comment'># Returns list of method names</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># List only application specific methods -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> <span class='nx-keyword'>methods</span> -source application ... <span class='nx-placeholder'>?pattern?</span> -<span class='nx-comment'># Returns list of method names</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Options for 'info methods' -</span><span class='nx-comment'># -</span><span class='nx-comment'># -incontext -</span><span class='nx-comment'># -nomixins</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Options for 'info lookup methods' -</span><span class='nx-comment'># -</span><span class='nx-comment'># -source ... -</span><span class='nx-comment'># -callprotection ... -</span><span class='nx-comment'># -incontext -</span><span class='nx-comment'># -type ... -</span><span class='nx-comment'># -nomixins</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># List slot objects defined for obj -</span><span class='nx-comment'># -source might be all|application|baseclasses -</span><span class='nx-comment'># -type is the class of the slot object -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> slots <span class='nx-placeholder'>?-type ...?</span> <span class='nx-placeholder'>?-source ...?</span> <span class='nx-placeholder'>?pattern?</span> - -<span class='nx-comment'># Returns list of slot objects</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># List registered filters -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> filters -order <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span> - -<span class='nx-comment'># List registered mixins -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> mixins -heritage <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># List registered filters -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> filters <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span> - -<span class='nx-comment'># List registered mixins -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> mixins <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_object_class_where_a_specified_method_is_defined">2.6.6. List object/class where a specified method is defined</h4> -<div class="paragraph"><p><code>info lookup</code> can be used as well to determine, where exactly an - artefact is located. One can obtain this way a method handle, where -a method or filter is defined.</p></div> -<div class="paragraph"><p>The concept of a <em>method-handle</em> is new in NX. The method-handle -can be used to obtain more information about the method, such as -e.g. the definition of the method.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> procsearch <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> <span class='nx-keyword'>method</span> <span class='nx-placeholder'>/methodName/</span> -<span class='nx-comment'># Returns method-handle</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> filtersearch <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> <span class='nx-keyword'>filter</span> <span class='nx-placeholder'>/methodName/</span> -<span class='nx-comment'># Returns method-handle</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_definition_of_scripted_methods">2.6.7. List definition of scripted methods</h4> -<div class="paragraph"><p>XOTcl contains a long list of <code>info</code> subcommands for different kinds of -methods and for obtaining more detailed information about these -methods.</p></div> -<div class="paragraph"><p>In NX, this list of <code>info</code> subcommands is much shorter and more -orthogonal. For example <code>info method definition</code> can be used to obtain -with a single command the full definition of a <em>scripted method</em>, and -furthermore, it works as well the same way to obtain e.g. the -definition of a <em>forwarder</em> or an <em>alias</em>.</p></div> -<div class="paragraph"><p>While XOTcl uses different names for info options for objects and -classes (using the prefix "inst" for instance specific method), NX -uses for object specific method the modifier <code>object</code>. For definition -of class object specific methods, use the modifier <code>object</code> as usual.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> definition <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> definition <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instbody <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> body <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> body <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> body <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instargs <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> args <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> args <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> args <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instnonposargs <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> args <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> parameter <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> parameter <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instdefault <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> default <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># not needed, part of -</span><span class='nx-comment'># "info ?object? method parameter"</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instpre <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> pre <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> precondition <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> precondition <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instpost <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> post <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> postcondition <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> postcondition <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -<div class="paragraph"><p>Another powerful introspection option in NX is <code>info ?object? method -syntax</code> which obtains a representation of the parameters of a -method in the style of Tcl man pages (regardless of the kind of -method).</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> syntax <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> syntax <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="info_configure_parameter">2.6.8. List Configure Parameters</h4> -<div class="paragraph"><p>The way, how newly created objects can be configured is determined in NX -via properties. The configuration happens during creation via the -methods <code>create</code> or <code>new</code> or during runtime via <code>configure</code>. These -methods have therefore virtual argument lists, depending on the object -or class on which they are applied.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Return the parameters applicable to -</span><span class='nx-comment'># the create method of a certain class. -</span><span class='nx-comment'># class can be configured. A pattern can -</span><span class='nx-comment'># be used to filter the results. -</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> parameters <span class='nx-keyword'>create</span> ?<span class='nx-placeholder'>/pattern/</span>? - -<span class='nx-comment'># Return in the result in documentation syntax -</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> syntax <span class='nx-keyword'>create</span> ?<span class='nx-placeholder'>/pattern/</span>? - -<span class='nx-comment'># "info lookup parameters configure" returns -</span><span class='nx-comment'># parameters available for configuring the -</span><span class='nx-comment'># current object (might contain object -</span><span class='nx-comment'># specific information) -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> parameters <span class='nx-keyword'>configure</span> <span class='nx-placeholder'>?pattern?</span> - -<span class='nx-comment'># "info lookup configure syntax" returns syntax of -</span><span class='nx-comment'># a call to configure in the Tcl parameter syntax -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> syntax <span class='nx-keyword'>configure</span> - -<span class='nx-comment'># Obtain information from a parameter -</span><span class='nx-comment'># (as e.g. returned from "info lookup -</span><span class='nx-comment'># parameters configure"). -</span> -nsf::parameter::info name <span class='nx-placeholder'>/parameter/</span> -nsf::parameter::info syntax <span class='nx-placeholder'>/parameter/</span> -nsf::parameter::info type <span class='nx-placeholder'>/parameter/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_variable_declarations_property_and_variable">2.6.9. List Variable Declarations (property and variable)</h4> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># obtain parameter definitions defined -</span><span class='nx-comment'># for a class -</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> parameter</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># "info variables" returns handles of -</span><span class='nx-comment'># properties and variables defined by this -</span><span class='nx-comment'># class or object -</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> variables <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> variables <span class='nx-placeholder'>?pattern?</span> - -<span class='nx-comment'># "info lookup variables" returns handles -</span><span class='nx-comment'># of variables and properties applicable -</span><span class='nx-comment'># for the current object (might contain -</span><span class='nx-comment'># object specific information) -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> variables <span class='nx-placeholder'>/pattern/</span> - -<span class='nx-comment'># "info variable" lists details about a -</span><span class='nx-comment'># single property or variable. -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>variable</span> definition <span class='nx-placeholder'>/handle/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>variable</span> name <span class='nx-placeholder'>/handle/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>variable</span> parameter <span class='nx-placeholder'>/handle/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_slots">2.6.10. List Slots</h4> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Return list of slots objects defined on the -</span><span class='nx-comment'># object or class -</span><span class='nx-comment'># -</span><span class='nx-comment'># -source might be all|application|baseclasses -</span><span class='nx-comment'># -type is the class of the slot object -</span><span class='nx-comment'># -closure includes slots of superclasses -</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> slots \ - <span class='nx-placeholder'>?-type value?</span> <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?-source value?</span> <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> slots <span class='nx-placeholder'>?-type ...?</span> <span class='nx-placeholder'>?pattern?</span> - -<span class='nx-comment'># List reachable slot objects defined for obj -</span><span class='nx-comment'># -source might be all|application|baseclasses -</span><span class='nx-comment'># -type is the class of the slot object -</span><span class='nx-comment'># Returns list of slot objects. -</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> slots \ - <span class='nx-placeholder'>?-type ...?</span> <span class='nx-placeholder'>?-source ... ?</span>pattern? - -<span class='nx-comment'># Obtain definition, name or parameter from -</span><span class='nx-comment'># slot object -</span> -<span class='nx-placeholder'>/slotobj/</span> definition -<span class='nx-placeholder'>/slotobj/</span> name -<span class='nx-placeholder'>/slotobj/</span> parameter</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_filter_or_mixins">2.6.11. List Filter or Mixins</h4> -<div class="paragraph"><p>In NX all introspection options for filters are provided via -<code>info filters</code> and all introspection options for mixins are -provided via <code>info mixins</code>.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>filter</span> <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-order?</span> <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> filterguard <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> filters \ - <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instfilter \ - <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-order?</span> <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instfilterguard <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> filters \ - <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>mixin</span> <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-order ?</span>pattern? -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> mixinguard <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> mixins \ - <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instmixin \ - <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-order?</span> <span class='nx-placeholder'>?pattern?</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instmixinguard <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixins \ - <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-heritage?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_definition_of_methods_defined_by_aliases_setters_or_forwarders">2.6.12. List definition of methods defined by aliases, setters or forwarders</h4> -<div class="paragraph"><p>As mentioned earlier, <code>info method definition</code> can be used on every -kind of method. The same call can be used to obtain the definition of -a scripted method, a method-alias, a forwarder or a setter method.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> definition <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> definition <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_method_handles">2.6.13. List Method-Handles</h4> -<div class="paragraph"><p>NX supports <em>method-handles</em> to provide means to obtain further -information about a method or to change maybe some properties of a -method. When a method is created, the method creating method returns -the method handle to the created method.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># -</span><span class='nx-comment'># List the method handle of the specified method, -</span><span class='nx-comment'># can be used e.g. for aliases. "handle" is the short -</span><span class='nx-comment'># form of "definitionhandle". -</span><span class='nx-comment'># -</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> handle <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> handle <span class='nx-placeholder'>/methodName/</span> -<span class='nx-comment'># -</span><span class='nx-comment'># For ensemble methods (method name contains -</span><span class='nx-comment'># spaces) one can query as well the registration -</span><span class='nx-comment'># handle, which is the handle to the root of the -</span><span class='nx-comment'># ensemble; the definition handle points to the -</span><span class='nx-comment'># leaf of the ensemble. -</span><span class='nx-comment'># -</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> registrationhandle <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> registrationhandle <span class='nx-placeholder'>/methodName/</span> -<span class='nx-comment'># -</span><span class='nx-comment'># For aliases, one can query the original -</span><span class='nx-comment'># definition via "info method origin" -</span><span class='nx-comment'># -</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> origin <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> origin <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_type_of_a_method">2.6.14. List type of a method</h4> -<div class="paragraph"><p>The method <code>info ?object? method type</code> is new in NX to obtain the type of the -specified method.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> type <span class='nx-placeholder'>/methodName/</span> -<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> type <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_list_the_scope_of_mixin_classes">2.6.15. List the scope of mixin classes</h4> -<div class="paragraph"><p>NX provides a richer set of introspection options to obtain -information, where mixins classes are mixed into.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># List objects, where /cls/ is a -</span><span class='nx-comment'># per-object mixin -</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof -scope <span class='nx-keyword'>object</span> <span class='nx-placeholder'>?-closure?</span> \ - <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instmixinof <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># List classes, where /cls/ is a per-class mixin -</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof -scope <span class='nx-keyword'>class</span> <span class='nx-placeholder'>?-closure?</span> \ - <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># List objects and classes, where /cls/ is -</span><span class='nx-comment'># either a per-object or a per-class mixin -</span> -<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof -scope all <span class='nx-placeholder'>?-closure?</span> \ - <span class='nx-placeholder'>?pattern?</span></pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_check_properties_of_object_and_classes">2.6.16. Check properties of object and classes</h4> -<div class="paragraph"><p>Similar as noted before, NX uses rather a hierarchical approach of -naming using multiple layers of subcommands).</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> istype <span class='nx-placeholder'>/sometype/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Check if object is a subtype of some class -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> has type <span class='nx-placeholder'>/sometype/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> ismixin <span class='nx-placeholder'>/cls/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Check if object has the specified mixin registered -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> has <span class='nx-keyword'>mixin</span> <span class='nx-placeholder'>/cls/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> isclass ?<span class='nx-placeholder'>/cls/</span>?</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Check if object is an NX class -</span><span class='nx-placeholder'>/obj/</span> has type ::nx::Class - -<span class='nx-comment'># Check if object is a class in one of the -</span><span class='nx-comment'># NSF object systems -</span>::nsf::is <span class='nx-keyword'>class</span> <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> ismetaclass <span class='nx-placeholder'>/cls/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Check if class is an NX metaclass -</span><span class='nx-keyword'>expr</span> {[<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> heritage ::nx::Class] ne <span class='nx-string'>""</span>} - -<span class='nx-comment'># Check if object is a metaclass in one of the -</span><span class='nx-comment'># NSF object systems -</span>::nsf::is <span class='nx-keyword'>metaclass</span> <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Check if object is a baseclass of an object system -</span>::nsf::is baseclass <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Return name of object (without namespace prefix) -</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> name</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span>::exists <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Check for existence of object (nsf primitive) -</span>::nsf::object::exists <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect3"> -<h4 id="_call_stack_introspection">2.6.17. Call-stack Introspection</h4> -<div class="paragraph"><p>Call-stack introspection is very similar in NX and XOTcl. NX uses for -subcommand the term <code>current</code> instead of <code>self</code>, since <code>self</code> has a -strong connotation to the current object. The term <code>proc</code> is renamed -by <code>method</code>.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span></pre></div></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> <span class='nx-keyword'>object</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> <span class='nx-keyword'>class</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> <span class='nx-keyword'>class</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> args</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> args</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> <span class='nx-keyword'>proc</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> <span class='nx-keyword'>method</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> callingclass</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> calledclass</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> callingobject</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> callingobject</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> callingproc</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> callingmethod</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> calledclass</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> calledclass</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> calledproc</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> calledmethod</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> isnextcall</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> isnextcall</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> <span class='nx-keyword'>next</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Returns method-handle of the -</span><span class='nx-comment'># method to be called via "next" -</span><span class='nx-keyword'>current</span> <span class='nx-keyword'>next</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> filterreg</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># Returns method-handle of the -</span><span class='nx-comment'># filter method -</span><span class='nx-keyword'>current</span> filterreg</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> callinglevel</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> callinglevel</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>self</span> activelevel</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-keyword'>current</span> activelevel</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -</div> -<div class="sect2"> -<h3 id="_other_predefined_methods">2.7. Other Predefined Methods</h3> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> requireNamespace</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>require</span> <span class='nx-keyword'>namespace</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>require</span> <span class='nx-keyword'>method</span></pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect2"> -<h3 id="_dispatch_aliases_etc">2.8. Dispatch, Aliases, etc.</h3> -<div class="paragraph"><p>todo: to be done or omitted</p></div> -</div> -<div class="sect2"> -<h3 id="_assertions">2.9. Assertions</h3> -<div class="paragraph"><p>In contrary to XOTcl, NX provides no pre-registered methods for -assertion handling. All assertion handling can e performed via the -Next Scripting primitive <code>nsf::method::assertion</code>.</p></div> -<div class="tableblock"> -<table rules="all" -width="100%" -frame="void" -cellspacing="0" cellpadding="4"> -<col width="50%" /> -<col width="50%" /> -<thead> -<tr> -<th align="left" valign="middle">XOTcl </th> -<th align="left" valign="middle">Next Scripting Language</th> -</tr> -</thead> -<tbody> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> check <span class='nx-placeholder'>/checkoptions/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/obj/</span> check <span class='nx-placeholder'>/checkoptions/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> check</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/obj/</span> check</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span>-invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> invar</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span>-invar</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> instinvar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>class</span>-invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instinvar</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>class</span>-invar</pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>object</span>-invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> -</tr> -<tr> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> invar</pre></div></div></div></td> -<td align="left" valign="middle"><div><div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>object</span>-invar</pre></div></div></div></td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="sect2"> -<h3 id="_method_protection">2.10. Method Protection</h3> -<div class="paragraph"><p>As described <a href="#method-protect-example">above</a>, NX supports method -protection via the method modifiers <code>protected</code> and <code>public</code>. A -protected method can be only called from an object of that class, -while public methods can be called from every object. The method -protection can be used to every kind of method, such as e.g. scripted -methods, aliases, forwarders, or accessors. For invocations, -the most specific definition (might be a mixin) is used for -determining the protection.</p></div> -</div> -</div> -</div> -<div class="sect1"> -<h2 id="_incompatibilities_between_xotcl_1_and_xotcl_2">3. Incompatibilities between XOTcl 1 and XOTcl 2</h2> -<div class="sectionbody"> -<div class="sect2"> -<h3 id="_resolvers_2">3.1. Resolvers</h3> -<div class="paragraph"><p>The resolvers (variable resolvers, function resolvers) of the Next -Scripting Framework are used as well within XOTcl 2. When variable -names or method names starting with a single colon are used in XOTcl 1 -scripts, conflicts will arise with the resolver. These names must be -replaced.</p></div> -</div> -<div class="sect2"> -<h3 id="_parameters_2">3.2. Parameters</h3> -<div class="paragraph"><p>The following changes for parameters could be regarded as bug-fixes.</p></div> -<div class="sect3"> -<h4 id="_parameter_usage_without_a_value">3.2.1. Parameter usage without a value</h4> -<div class="paragraph"><p>In XOTcl 1, it was possible to call a parameter method during object -creation via the dash-interface without a value (in the example below <code>-x</code>).</p></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># XOTcl example -</span> -<span class='nx-keyword'>Class</span> Foo -parameter {x y} -Foo f1 -x -y 1</pre></div></div> -<div class="paragraph"><p>Such cases are most likely mistakes. All parameter configurations in XOTcl 2 require an argument.</p></div> -</div> -<div class="sect3"> -<h4 id="_ignored_parameter_definitions">3.2.2. Ignored Parameter definitions</h4> -<div class="paragraph"><p>In XOTcl 1, a more specific parameter definition without a default was ignored -when a more general parameter definition with a default was -present. In the example below, the object <code>b1</code> contained in XOTcl 1 -incorrectly the parameter <code>x</code> (set via default from <code>Foo</code>), while in -XOTcl 2, the variable won’t be set.</p></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># XOTcl example -</span> -<span class='nx-keyword'>Class</span> Foo -parameter {{x 1}} -<span class='nx-keyword'>Class</span> Bar -superclass Foo -parameter x -Bar b1</pre></div></div> -</div> -<div class="sect3"> -<h4 id="_changing_classes_and_superclasses">3.2.3. Changing classes and superclasses</h4> -<div class="paragraph"><p>NX does not define the methods <code>class</code> and <code>superclass</code> (like XOTcl), but allows to -alter all object/class relations (including -class/superclass/object-mixin/…) -<code>nsf::relation::set</code>. The class and superclass can be certainly queried -in all variants with <code>info class</code> or <code>info superclasses</code>.</p></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># NX example -</span> -<span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> Foo -Foo <span class='nx-keyword'>create</span> f1 - -<span class='nx-comment'># now alter the class of object f1 -</span>nsf::relation::set f1 <span class='nx-keyword'>class</span> ::nx::Object</pre></div></div> -</div> -<div class="sect3"> -<h4 id="_overwriting_procs_methods_with_objects_and_vice_versa">3.2.4. Overwriting procs/methods with objects and vice versa</h4> -<div class="paragraph"><p>NSF is now more conservative on object/method creation. In contrary to -XOTcl 1 NSF does not allow to redefined a pre-existing command -(e.g. "set") with an object and vice versa. Like in XOTcl 1, -preexisting objects and classes con be redefined (necessary for -reloading objects/classes in an running interpreter).</p></div> -</div> -<div class="sect3"> -<h4 id="_info_heritage">3.2.5. Info heritage</h4> -<div class="paragraph"><p><code>info heritage</code> returns in XOTcl 1 the transitive superclass -hierarchy, which is equivalent with <code>info superclasses -closure</code> and -therefore not necessary. In XOTcl 2 (and NX), <code>info heritage</code> includes -as well the transitive per-class mixins.</p></div> -</div> -</div> -<div class="sect2"> -<h3 id="_slots">3.3. Slots</h3> -<div class="paragraph"><p>All slot objects (also XOTcl slot objects) are now next-scripting -objects of baseclass <code>::nx::Slot</code>. The name of the experimental -default-setter <code>initcmd</code> was changed to <code>defaultcmd</code>. Code directly -working on the slots objects has to be adapted.</p></div> -</div> -<div class="sect2"> -<h3 id="_obsolete_commands">3.4. Obsolete Commands</h3> -<div class="paragraph"><p>Parameter-classes were rarely used and have been replaced by the more -general object parametrization. Therefore, <code>cl info parameterclass</code> has -been removed.</p></div> -</div> -<div class="sect2"> -<h3 id="_stronger_checking">3.5. Stronger Checking</h3> -<div class="paragraph"><p>The Next Scripting Framework performs stronger checking than XOTcl 1 -For example, the requiredness of slots in XOTcl 1 was just a -comment, while XOTcl 2 enforces it.</p></div> -</div> -<div class="sect2"> -<h3 id="_exit_handlers">3.6. Exit Handlers</h3> -<div class="paragraph"><p>The exit hander interface changed from a method of <code>::xotcl::Object</code> -into the Tcl command <code>::nsf::exithandler</code>:</p></div> -<div class="listingblock"> -<div class="content"><style type='text/css'> -.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} -table.nx {border-collapse: collapse; border-spacing: 3px;} -.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} -.nx-string {color: #779977; font-weight: normal; font-style: italic;} -.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} -.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} -.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} -.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -</style> -<pre class='nx'><span class='nx-comment'># NX example -</span>::nsf::exithandler <span class='nx-keyword'>set</span>|get|<span class='nx-keyword'>unset</span> <span class='nx-placeholder'>?arg?</span></pre></div></div> -</div> -</div> -</div> -</div> -<div id="footnotes"><hr /></div> -<div id="footer"> -<div id="footer-text"> -Version 2.1.0<br /> -Last updated 2017-02-14 11:19:40 CET -</div> -</div> -</body> -</html> +</div> +</div> +<div id="content"> +<div id="preamble"> +<div class="sectionbody"> +<div class="sidebarblock"> +<div class="content"> +<div class="title">Abstract</div> +<div class="paragraph"><p>This document describes the differences between the Next Scripting +Language Framework and XOTcl 1. In particular, it presents a +migration guide from XOTcl 1 to NX, and presents potential +incompatibilities between XOTcl 1 and XOTcl 2.</p></div> +</div></div> +<div class="paragraph"><p>The Next Scripting Language (NX) is a successor of XOTcl 1 and is +based on 10 years of experience with XOTcl in projects containing +several hundert thousand lines of code. While XOTcl was the first +language designed to provide language support for design patterns, the +focus of the Next Scripting Framework and NX are on combining this +with Language Oriented Programming. In many respects, NX was designed +to ease the learning of the language by novices (by using a more +mainstream terminology, higher orthogonality of the methods, less +predefined methods), to improve maintainability (remove sources of +common errors) and to encourage developer to write better structured +programs (to provide interfaces) especially for large projects, where +many developers are involved.</p></div> +<div class="paragraph"><p>The Next Scripting Language is based on the Next Scripting Framework +which was developed based on the notion of language oriented +programming. The Next Scripting Frameworks provides C-level support +for defining and hosting multiple object systems in a single Tcl +interpreter. The whole definition of NX is fully scripted +(e.g. defined in <code>nx.tcl</code>). The Next Scripting Framework is shipped +with three language definitions, containing NX and XOTcl 2. Most of +the existing XOTcl 1 programs can be used without modification in the +Next Scripting Framework by using XOTcl 2. The Next Scripting +Framework requires Tcl 8.5 or newer.</p></div> +<div class="paragraph"><p>Although NX is fully scripted (as well as XOTcl 2), our benchmarks +show that scripts based on NX are often 2 or 4 times faster than the +counterparts in XOTcl 1. But speed was not the primary focus on the +Next Scripting Environment: The goal was primarily to find ways to +repackage the power of XOTcl in an easy to learn environment, highly +orthogonal environment, which is better suited for large projects, +trying to reduce maintenance costs.</p></div> +<div class="paragraph"><p>We expect that many user will find it attractive to upgrade +from XOTcl 1 to XOTcl 2, and some other users will upgrade to NX. +This document focuses mainly on the differences between XOTcl 1 and +NX, but addresses as well potential incompatibilities between XOTcl 1 +and XOTcl 2. For an introduction to NX, please consult the NX tutorial.</p></div> +</div> +</div> +<div class="sect1"> +<h2 id="_differences_between_xotcl_and_nx">1. Differences Between XOTcl and NX</h2> +<div class="sectionbody"> +<div class="paragraph"><p>The Next Scripting Framework supports <em>Language Oriented Programming</em> +by providing means to define potentially multiple object systems with +different naming and functionality in a single interpreter. This +makes the Next Scripting Framework a powerful instrument for defining +multiple languages such as e.g. domain specific languages. This focus +differs from XOTcl 1.</p></div> +<div class="paragraph"><p>Technically, the language framework approach means that the languages +implemented by the Next Scripting Framework (most prominently XOTcl 2 +and NX) are typically fully scripted and can be loaded via the usual +Tcl <code>package require</code> mechanism.</p></div> +<div class="paragraph"><p>Some of the new features below are provided by the Next Scripting +Framework, some are implemented via the script files for XOTcl 2 and +NX.</p></div> +<div class="sect2"> +<h3 id="_features_of_nx">1.1. Features of NX</h3> +<div class="paragraph"><p>In general, the Next Scripting Language (NX) differs from XOTcl +in the following respects:</p></div> +<div class="olist arabic"><ol class="arabic"> +<li> +<p> +<strong>Stronger Encapsulation:</strong> The Next Scripting Language favors + a <em>stronger form of encapsulation</em> than XOTcl. Calling the own + methods or accessing the own instance variables is typographically + easier and computationally faster than these operations on other + objects. This behavior is achieved via <em>resolvers</em>, which make some + methods necessary in XOTcl 1 obsolete in NX (especially for importing + instance variables). The encapsulation of NX is stronger than in + XOTcl but still weak compared to languages like C++; a developer can + still access other objects' variables via some idioms, but NX <em>makes + accesses to other objects' variables explicit</em>. The requiredness to + make these accesses explicit should encourage developer to implement + well defined interfaces to provide access to instance variables. +</p> +</li> +<li> +<p> +<strong>Additional Forms of Method Definition and Reuse:</strong> + The Next Scripting Language + provides much more orthogonal means to <em>define, reuse and + introspect</em> scripted and C-implemented methods. +</p> +<div class="olist loweralpha"><ol class="loweralpha"> +<li> +<p> +It is possible to use NX <code>alias</code> to register methods + under arbitrary names for arbitrary objects or classes. +</p> +</li> +<li> +<p> +NX provides means for <em>method protection</em> (method modifiers + <code>public</code>, <code>protected</code>, and <code>private</code>). Therefore developers have + to define explicitly public interfaces in order to use methods + from other objects. +</p> +</li> +<li> +<p> +One can invoke in NX fully qualified methods to invoke + methods outside the precedence path. +</p> +</li> +<li> +<p> +One can define in NX <em>hierarchical method names</em> (similar to + commands and subcommands, called method ensembles) in a + convenient way to provide extensible, hierarchical naming of + methods. +</p> +</li> +<li> +<p> +One can use in NX the same interface to query (introspect) + C-implemented and scripted methods/commands. +</p> +</li> +</ol></div> +</li> +<li> +<p> +<strong>Orthogonal Parameterization:</strong> + The Next Scripting Language provides an <em>orthogonal framework for + parametrization</em> of methods and objects. +</p> +<div class="olist loweralpha"><ol class="loweralpha"> +<li> +<p> +In NX, the same argument parser is used for +</p> +<div class="ulist"><ul> +<li> +<p> +Scripted Methods +</p> +</li> +<li> +<p> +C-implemented methods and Tcl commands +</p> +</li> +<li> +<p> +Object Parametrization +</p> +</li> +</ul></div> +</li> +<li> +<p> +While XOTcl 1 provided only value-checkers for non-positional + arguments for methods, the Next Scripting Framework provides + the same value checkers for positional and non-positional + arguments of methods, as well as for positional and + non-positional configure parameters (<code>-parameter</code> in + XOTcl 1). +</p> +</li> +<li> +<p> +While XOTcl 1 supported only non-positional arguments at the + begin of the argument list, these can be used now at arbitrary + positions. +</p> +</li> +</ol></div> +</li> +<li> +<p> +<strong>Value Checking:</strong> +</p> +<div class="olist loweralpha"><ol class="loweralpha"> +<li> +<p> +The Next Scripting Language supports checking of the <em>input + parmeters</em> and the <em>return values</em> of scripted and C-implemented + methods and commands. +</p> +</li> +<li> +<p> +NX provides a set of predefined checkers (like e.g. <code>integer</code>, + <code>boolean</code>, <code>object</code>, …) which can be extended by the + applications. +</p> +</li> +<li> +<p> +Value Checking can be used for <em>single</em> and <em>multi-valued</em> + parameters. One can e.g. define a list of integers + with at least one entry by the parameter specification + <code>integer,1..n</code>. +</p> +</li> +<li> +<p> +Value Checking can be turned on/off globally or on the + method/command level. +</p> +</li> +</ol></div> +</li> +<li> +<p> +<strong>Scripted Init Blocks:</strong> The Next Scripting Language provides + <em>scripted init blocks</em> for objects and classes (replacement for the + dangerous dash "-" mechanism in XOTcl that allows to set variables + and invoke methods upon object creation). +</p> +</li> +<li> +<p> +<strong>More Conventional Naming for Predefined Methods:</strong> The naming of + the methods in the Next Scripting Language is much more in line with + the mainstream naming conventions in OO languages. While for example + XOTcl uses <code>proc</code> and <code>instproc</code> for object specific and inheritable + methods, NX uses simply <code>method</code>. +</p> +</li> +<li> +<p> +<strong>Profiling Support:</strong> The Next Scripting Language provides now two + forms of profiling +</p> +<div class="ulist"><ul> +<li> +<p> +Profiling via a DTrace provider (examples are e.g. in the dtrace + subdirectory of the source tree) +</p> +</li> +<li> +<p> +Significantly improved built-in profiling (results can be + processed in Tcl). +</p> +</li> +</ul></div> +</li> +<li> +<p> +<strong>Significantly Improved Test Suite:</strong> The regression test suite of + Next Scripting Scripting framework contain now more than + 5.000 tests, and order of magnitude more than in XOTcl 1.6 +</p> +</li> +<li> +<p> +<strong>Much Smaller Interface:</strong> The Next Scripting Language has a much + <em>smaller interface</em> (i.e. provides less predefined methods) than + XOTcl (see Table 1), although the expressiveness was increased in + NX. +</p> +</li> +</ol></div> +<div class="tableblock"> +<table rules="all" +width="50%" +frame="hsides" +cellspacing="0" cellpadding="4"> +<caption class="title">Table 1. Comparison of the Number of Predefined Methods in NX and XOTcl</caption> +<col width="60%" /> +<col width="20%" /> +<col width="20%" /> +<thead> +<tr> +<th align="left" valign="top"></th> +<th align="right" valign="top">NX</th> +<th align="right" valign="top">XOTcl</th> +</tr> +</thead> +<tfoot> +<tr> +<td align="left" valign="top"><p class="table">Total</p></td> +<td align="right" valign="top"><p class="table">45</p></td> +<td align="right" valign="top"><p class="table">124</p></td> +</tr> +</tfoot> +<tbody> +<tr> +<td align="left" valign="top"><p class="table">Methods for Objects</p></td> +<td align="right" valign="top"><p class="table">14</p></td> +<td align="right" valign="top"><p class="table">51</p></td> +</tr> +<tr> +<td align="left" valign="top"><p class="table">Methods for Classes</p></td> +<td align="right" valign="top"><p class="table">9</p></td> +<td align="right" valign="top"><p class="table">24</p></td> +</tr> +<tr> +<td align="left" valign="top"><p class="table">Info-methods for Objects</p></td> +<td align="right" valign="top"><p class="table">11</p></td> +<td align="right" valign="top"><p class="table">25</p></td> +</tr> +<tr> +<td align="left" valign="top"><p class="table">Info-methods for Classes</p></td> +<td align="right" valign="top"><p class="table">11</p></td> +<td align="right" valign="top"><p class="table">24</p></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>This comparison list compares mostly XOTcl 1 with NX, some features +are also available in XOTcl 2 (2a, 2c 2d, 3, 4).</p></div> +</div> +<div class="sect2"> +<h3 id="_nx_and_xotcl_scripts">1.2. NX and XOTcl Scripts</h3> +<div class="paragraph"><p>Below is a small, introductory example showing an implementation of a +class <code>Stack</code> in NX and XOTcl. The purpose of this first example is +just a quick overview. We will go into much more detailed comparison +in the next sections.</p></div> +<div class="paragraph"><p>NX supports a block syntax, where the methods are defined during the +creation of the class. The XOTcl syntax is slightly more redundant, +since every definition of a method is a single toplevel command +starting with the class name (also NX supports the style used in +XOTcl). In NX, all methods are per default protected (XOTcl does not +support protection). In NX methods are defined in the definition of +the class via <code>:method</code> or <code>:public method</code>. In XOTcl methods are +defined via the <code>instproc</code> method.</p></div> +<div class="paragraph"><p>Another difference is the notation to refer to instance variables. In +NX, instance variable are named with a single colon in the front. In +XOTcl, instance variables are imported using <code>instvar</code>.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="top">Stack example in NX </th> +<th align="left" valign="top">Stack example in XOTcl</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="top"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Stack { + + <span class='nx-comment'># +</span> <span class='nx-comment'># Stack of Things +</span> <span class='nx-comment'># +</span> + <span class='nx-keyword'>:variable</span> things <span class='nx-string'>""</span> + + <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> push {thing} { + <span class='nx-keyword'>set</span> :things [<span class='nx-keyword'>linsert</span> <span class='nx-variable'>${</span><span class='nx-variable'>:things}</span> 0 <span class='nx-variable'>$thing</span>] + <span class='nx-keyword'>return</span> <span class='nx-variable'>$thing</span> + } + + <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> pop {} { + <span class='nx-keyword'>set</span> top [<span class='nx-keyword'>lindex</span> <span class='nx-variable'>${</span><span class='nx-variable'>:things}</span> 0] + <span class='nx-keyword'>set</span> :things [<span class='nx-keyword'>lrange</span> <span class='nx-variable'>${</span><span class='nx-variable'>:things}</span> 1 end] + <span class='nx-keyword'>return</span> <span class='nx-variable'>$top</span> + } +}</pre></div></div></div></td> +<td align="left" valign="top"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># +</span><span class='nx-comment'># Stack of Things +</span><span class='nx-comment'># +</span> +<span class='nx-keyword'>Class</span> Stack + +Stack instproc <span class='nx-keyword'>init</span> {} { + <span class='nx-keyword'>my</span> instvar things + <span class='nx-keyword'>set</span> things <span class='nx-string'>""</span> +} + +Stack instproc push {thing} { + <span class='nx-keyword'>my</span> instvar things + <span class='nx-keyword'>set</span> things [<span class='nx-keyword'>linsert</span> <span class='nx-variable'>$things</span> 0 <span class='nx-variable'>$thing</span>] + <span class='nx-keyword'>return</span> <span class='nx-variable'>$thing</span> +} + +Stack instproc pop {} { + <span class='nx-keyword'>my</span> instvar things + <span class='nx-keyword'>set</span> top [<span class='nx-keyword'>lindex</span> <span class='nx-variable'>$things</span> 0] + <span class='nx-keyword'>set</span> things [<span class='nx-keyword'>lrange</span> <span class='nx-variable'>$things</span> 1 end] +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect2"> +<h3 id="_using_xotcl_2_0_and_the_next_scripting_language_in_a_single_interpreter">1.3. Using XOTcl 2.0 and the Next Scripting Language in a Single Interpreter</h3> +<div class="paragraph"><p>In general, the Next Scripting Framework supports multiple object +systems concurrently. Effectively, every object system has different +base classes for creating objects and classes. Therefore, these object +systems can have different interfaces and names of built-in +methods. Currently, the Next Scripting Framework is packaged with +three object systems:</p></div> +<div class="ulist"><ul> +<li> +<p> +NX +</p> +</li> +<li> +<p> +XOTcl 2.0 +</p> +</li> +<li> +<p> +TclCool +</p> +</li> +</ul></div> +<div class="paragraph"><p>XOTcl 2 is highly compatible with XOTcl 1, the language NX is +described below in more details, the language TclCool was introduced +in Tip#279 and serves primarily an example of a small OO language.</p></div> +<div class="paragraph"><p>A single Tcl interpreter can host multiple Next Scripting Object +Systems at the same time. This fact makes migration from XOTcl to NX +easier. The following example script shows to use XOTcl and NX in a +single script:</p></div> +<div class="listingblock"> +<div class="title">Using Multiple Object Systems in a single Script</div> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>namespace</span> <span class='nx-keyword'>eval</span> mypackage { + + <span class='nx-keyword'>package</span> <span class='nx-keyword'>require</span> XOTcl 2.0 + + <span class='nx-comment'># Define a class with a public method foo using XOTcl +</span> <span class='nx-keyword'>xotcl::Class</span> C1 + C1 instproc foo {} {<span class='nx-keyword'>puts</span> <span class='nx-string'>"hello world"</span>} + + <span class='nx-keyword'>package</span> <span class='nx-keyword'>require</span> nx + + <span class='nx-comment'># Define a class with a public method foo using NX +</span> <span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> C2 { + <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> foo {} {<span class='nx-keyword'>puts</span> <span class='nx-string'>"hello world"</span>} + } +}</pre></div></div> +<div class="paragraph"><p>One could certainly create object or classes from the different object +systems via fully qualified names (e.g. using e.g. <code>::xotcl::Class</code> or +<code>::nx::Class</code>), but for migration for systems without explicit +namespaces switching between the object systems eases migration. +"Switching" between XOTcl and NX effectively means the load some +packages (if needed) and to import either the base classes (Object and +Class) of XOTcl or NX into the current namespace.</p></div> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_xotcl_idioms_in_the_next_scripting_language">2. XOTcl Idioms in the Next Scripting Language</h2> +<div class="sectionbody"> +<div class="paragraph"><p>The following sections are intended for reader familiar with XOTcl and +show, how certain language Idioms of XOTcl can be expressed in NX. In +some cases, multiple possible realizations are listed</p></div> +<div class="sect2"> +<h3 id="_defining_objects_and_classes">2.1. Defining Objects and Classes</h3> +<div class="paragraph"><p>When creating objects or classes, one should use the method <code>create</code> +explicitly. In XOTcl, a default <code>unknown</code> method handler was provided for +classes, which create for every unknown method invocation an +object/class with the name of the invoked method. This technique was +convenient, but as well dangerous, since typos in method names lead +easily to unexpected behavior. This default unknown method handler is not +provided in NX (but can certainly be provided as a one-liner in NX by +the application).</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> ClassName</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> ClassName</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Object</span> ObjectName</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> ObjectName</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect2"> +<h3 id="_defining_methods">2.2. Defining Methods</h3> +<div class="paragraph"><p>In general, both XOTcl and NX support methods on the object level +(per-object methods, i.e. methods only applicable to a single object) +and on the class level (methods inherited to instances of the +classes). While the naming in XOTcl tried to follow closely the Tcl +tradition (using the term <code>proc</code> for functions/methods), NX uses the +term <code>method</code> for defining scripted methods.</p></div> +<div class="paragraph"><p>XOTcl uses the prefix <code>inst</code> to denote that methods are provided for +instances, calling therefore scripted methods for instances +<code>instproc</code>. This is certainly an unusual term. The approach with the +name prefix has the disadvantage, that for every different kind of +method, two names have to be provided (eg. <code>proc</code> and <code>instproc</code>, +<code>forward</code> and <code>instforward</code>).</p></div> +<div class="paragraph"><p>NX on the contrary uses the same term for defining instance method or +object-specific methods. When the term (e.g. <code>method</code>) is used on a +class, the method will be an instance method (i.e. applicable to the +instances of the class). When the term is used on an object with the +modifier <code>object</code>, an object-specific method is defined. This way one +can define the same way object specific methods on an object as well +as on a class.</p></div> +<div class="paragraph"><p>Furthermore, both XOTcl and NX distinguish between scripted methods +(section 3.2.1) and C-defined methods (section 3.2.2). Section 3.2.3 +introduces method protection, which is only supported by NX.</p></div> +<div class="sect3"> +<h4 id="_scripted_methods_defined_in_the_init_block_of_a_class_object_or_with_separate_calls">2.2.1. Scripted Methods Defined in the Init-block of a Class/Object or with Separate Calls</h4> +<div class="paragraph"><p>The following examples show the definition of a class and its methods +in the init-block of a class (NX only), and the definition of methods +via separate top level calls (XOTcl and NX).</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define instance method 'foo' and object +</span><span class='nx-comment'># method 'bar' for a Class 'C' with separate +</span><span class='nx-comment'># toplevel commands +</span> +<span class='nx-keyword'>Class</span> C +C instproc foo args {...} +C <span class='nx-keyword'>proc</span> bar args {...}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define instance method and object method +</span><span class='nx-comment'># in the init-block of a class +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { + <span class='nx-keyword'>:method</span> foo args {...} + <span class='nx-keyword'>:object</span> <span class='nx-keyword'>method</span> bar args {...} +}</pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define instance method and object method +</span><span class='nx-comment'># with separate commands +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C +C <span class='nx-keyword'>method</span> foo args {...} +C <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> bar args {...}</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define object-specific method foo +</span><span class='nx-comment'># for an object 'o' with separate commands +</span> +<span class='nx-keyword'>Object</span> o +o <span class='nx-keyword'>set</span> x 1 +o <span class='nx-keyword'>proc</span> foo args {...}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define object method and set +</span><span class='nx-comment'># instance variable in the init-block of +</span><span class='nx-comment'># an object +</span> +<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { + <span class='nx-keyword'>set</span> :x 1 + <span class='nx-keyword'>:object</span> <span class='nx-keyword'>method</span> foo args {...} +}</pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define object method and set +</span><span class='nx-comment'># instance variable with separate +</span><span class='nx-comment'># commands +</span> +<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o +o <span class='nx-keyword'>eval</span> {<span class='nx-keyword'>set</span> :x 1} +o <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> foo args {...}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_different_kinds_of_methods">2.2.2. Different Kinds of Methods</h4> +<div class="paragraph"><p>This section describes various kinds of methods. The different kinds +of methods are defined via different method-defining methods, which +are summarized in the following table for XOTcl and NX.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Methods for defining methods: +</span><span class='nx-comment'># +</span><span class='nx-comment'># proc +</span><span class='nx-comment'># instproc +</span><span class='nx-comment'># forward +</span><span class='nx-comment'># instforward +</span><span class='nx-comment'># parametercmd +</span><span class='nx-comment'># instparametercmd +</span><span class='nx-comment'># +</span><span class='nx-comment'># All these methods return empty.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Methods for defining methods: +</span><span class='nx-comment'># +</span><span class='nx-comment'># alias +</span><span class='nx-comment'># forward +</span><span class='nx-comment'># method +</span><span class='nx-comment'># +</span><span class='nx-comment'># All these methods return method-handles.</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>In addition to scripted methods (previous section) XOTcl supports +forwarder (called <code>forward</code> and <code>instforward</code>) and accessor functions +to variables (called <code>parametercmd</code> and <code>instparametercmd</code>). The +accessor functions are used normally internally when object-specific +parameters are defined (see Section 3.4).</p></div> +<div class="paragraph"><p>In NX forwarders are called <code>forward</code>. NX does not provide an public +available method to define variable accessors like <code>parametercmd</code> in +XOTcl, but use internally the Next Scripting Framework primitive +<code>nsf::method::setter</code> when appropriate.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> C +C instforward f1 ... +C <span class='nx-keyword'>forward</span> f2 ... + +<span class='nx-keyword'>Object</span> o +o <span class='nx-keyword'>forward</span> f3 ...</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define forwarder +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { + <span class='nx-keyword'>:forward</span> f1 ... + <span class='nx-keyword'>:object</span> <span class='nx-keyword'>forward</span> f2 ... +} + +<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { + <span class='nx-keyword'>:object</span> <span class='nx-keyword'>forward</span> f3 ... +}</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define setter and getter methods in XOTcl. +</span><span class='nx-comment'># +</span><span class='nx-comment'># XOTcl provides methods for these. +</span> +<span class='nx-keyword'>Class</span> C +C instparametercmd p1 +C parametercmd p2 + +<span class='nx-keyword'>Object</span> o +o parametercmd p3</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define setter and getter methods in NX. +</span><span class='nx-comment'># +</span><span class='nx-comment'># NX does not provide own methods, but uses +</span><span class='nx-comment'># the low level framework commands, since +</span><span class='nx-comment'># application developer will only +</span><span class='nx-comment'># need it in rare cases. +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C +::nsf::method::setter C p1 +::nsf::method::setter C -per-object p2 + +<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o +::nsf::method::setter o p3</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>NX supports in contrary to XOTcl the method <code>alias</code> which can be used +to register arbitrary Tcl commands or methods for an object or class +under a provided method name. Aliases can be used to reuse a certain implementation in +e.g. different object systems under potentially different names. In +some respects aliases are similar to forwarders, but they do not +involve forwarding overhead.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Method "alias" not available</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define method aliases +</span><span class='nx-comment'># (to scripted or non-scripted methods) +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { + <span class='nx-keyword'>:alias</span> a1 ... + <span class='nx-keyword'>:object</span> <span class='nx-keyword'>alias</span> a2 ... +} + +<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { + <span class='nx-keyword'>:object</span> <span class='nx-keyword'>alias</span> a3 ... +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="method-protect-example">2.2.3. Method Modifiers and Method Protection</h4> +<div class="paragraph"><p>NX supports four method modifiers <code>object</code>, <code>public</code>, <code>protected</code> and +<code>private</code>. All method modifiers can be written in front of every +method defining command. The method modifier <code>object</code> is used to denote +object-specific methods (see above). The concept of method protection +is new in NX.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Method modifiers +</span><span class='nx-comment'># +</span><span class='nx-comment'># "object", +</span><span class='nx-comment'># "public", +</span><span class='nx-comment'># "protected", and +</span><span class='nx-comment'># "private" +</span><span class='nx-comment'># +</span><span class='nx-comment'># are not available</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Method modifiers +</span><span class='nx-comment'># +</span><span class='nx-comment'># "object", +</span><span class='nx-comment'># "public", +</span><span class='nx-comment'># "protected" +</span><span class='nx-comment'># +</span><span class='nx-comment'># are applicable for all kinds of +</span><span class='nx-comment'># method defining methods: +</span><span class='nx-comment'># +</span><span class='nx-comment'># method, forward, alias +</span><span class='nx-comment'># +</span><span class='nx-comment'># The modifier "private" is available for +</span><span class='nx-comment'># +</span><span class='nx-comment'># method, forward, alias +</span><span class='nx-comment'># +</span><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { + :/<span class='nx-keyword'>method</span>-definition-method/ ... + <span class='nx-keyword'>:public</span> /<span class='nx-keyword'>method</span>-definition-method/ ... + <span class='nx-keyword'>:protected</span> /<span class='nx-keyword'>method</span>-definition-method/ ... + <span class='nx-keyword'>:private</span> /<span class='nx-keyword'>method</span>-definition-method/ ... + <span class='nx-keyword'>:object</span> /<span class='nx-keyword'>method</span>-definition-method/ ... + <span class='nx-keyword'>:public</span> <span class='nx-keyword'>object</span> /<span class='nx-keyword'>method</span>-definition-method/ ... + <span class='nx-keyword'>:protected</span> <span class='nx-keyword'>object</span> /<span class='nx-keyword'>method</span>-definition-method/ ... + <span class='nx-keyword'>:private</span> <span class='nx-keyword'>object</span> /<span class='nx-keyword'>method</span>-definition-method/ ... +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>XOTcl does not provide method protection. In NX, all methods are +defined per default as protected. This default can be changed by the +application developer in various ways. The command <code>::nx::configure +defaultMethodCallProtection true|false</code> can be used to set the default +call protection for scripted methods, forwarder and aliases. +The defaults can be overwritten also on a class level.</p></div> +<div class="paragraph"><p>NX provides means for method hiding via the method modifier +<code>private</code>. Hidden methods can be invoked only via the <code>-local</code> flag, +which means: "call the specified method defined in the same +class/object as the currently executing method".</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># XOTcl provides no means for +</span><span class='nx-comment'># method hiding</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Hiding of methods via "private" +</span><span class='nx-comment'># +</span><span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> Base { + <span class='nx-keyword'>:private</span> <span class='nx-keyword'>method</span> baz {a b} {<span class='nx-keyword'>expr</span> {<span class='nx-variable'>$a</span> + <span class='nx-variable'>$b</span>}} + <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> foo {a b} {: -local baz <span class='nx-variable'>$a</span> <span class='nx-variable'>$b</span>} +} + +<span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> Sub -superclass Base { + <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> bar {a b} {: -local baz <span class='nx-variable'>$a</span> <span class='nx-variable'>$b</span>} + <span class='nx-keyword'>:private</span> <span class='nx-keyword'>method</span> baz {a b} {<span class='nx-keyword'>expr</span> {<span class='nx-variable'>$a</span> * <span class='nx-variable'>$b</span>}} + + <span class='nx-keyword'>:create</span> s1 +} + +s1 foo 3 4 ;<span class='nx-comment'># returns 7 +</span>s1 bar 3 4 ;<span class='nx-comment'># returns 12 +</span>s1 baz 3 4 ;<span class='nx-comment'># unable to dispatch method 'baz'</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="method-deletion">2.2.4. Method Deletion</h4> +<div class="paragraph"><p>NX provides an explicit <code>delete</code> method for the deletion of methods.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># XOTcl provides only method deletion with +</span><span class='nx-comment'># the equivalent of Tcl's "proc foo {} {}" +</span><span class='nx-placeholder'>/cls/</span> instproc foo {} {} +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>proc</span> foo {} {}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Deletion of Methods +</span><span class='nx-comment'># +</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>method</span> <span class='nx-placeholder'>/name/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_resolvers">2.3. Resolvers</h3> +<div class="paragraph"><p>The Next Scripting Framework defines Tcl resolvers for method and +variable names to implement object specific behavior. Within the +bodies of scripted methods these resolver treat variable and function +names starting with a colon <code>:</code> specially. In short, a colon-prefixed +variable name refers to an instance variable, and a colon-prefixed +function name refers to a method. The sub-sections below provide +detailed examples.</p></div> +<div class="paragraph"><p>Note that the resolvers of the Next Scripting Framework can be used in +the XOTcl 2.* environment as well.</p></div> +<div class="sect3"> +<h4 id="_invoking_methods">2.3.1. Invoking Methods</h4> +<div class="paragraph"><p>In XOTcl, a method of the same object can be invoked via <code>my</code>, or in +general via using the name of the object in front of the method name.</p></div> +<div class="paragraph"><p>In NX, the own methods are called via the method name prefixed with a +single colon. The invocation of the methods of other objects is the +same in NX and XOTcl.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> C +C instproc foo args {...} +C instproc bar args { + <span class='nx-keyword'>my</span> foo 1 2 3 ;<span class='nx-comment'># invoke own method +</span> o baz ;<span class='nx-comment'># invoke other object's method +</span>} +<span class='nx-keyword'>Object</span> o +o <span class='nx-keyword'>proc</span> baz {} {...}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { + <span class='nx-keyword'>:method</span> foo args {...} + <span class='nx-keyword'>:method</span> bar args { + :foo 1 2 3 ;<span class='nx-comment'># invoke own method +</span> o baz ;<span class='nx-comment'># invoke other object's method +</span> } +} +<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { + <span class='nx-keyword'>:public</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> baz {} {...} +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_accessing_own_instance_variables_from_method_bodies">2.3.2. Accessing Own Instance Variables from Method Bodies</h4> +<div class="paragraph"><p>In general, the Next Scripting Language favors the access to an +objects’s own instance variables over variable accesses of other +objects. This means that in NX it is syntactically easier to access +the own instance variables. On the contrary, in XOTcl, the variable +access to own and other variables are fully symmetric.</p></div> +<div class="paragraph"><p>In XOTcl, the following approaches are used to access instance +variables:</p></div> +<div class="ulist"><ul> +<li> +<p> +Import instance variables via <code>instvar</code> and access variables via <code>$varName</code> +</p> +</li> +<li> +<p> +Set or get instance variables via <code>my set varName ?value?</code> or other + variable accessing methods registered on <code>xotcl::Object</code> such as + <code>append</code>, <code>lappend</code>, <code>incr</code>, etc. +</p> +</li> +<li> +<p> +Register same-named accessor functions and set/get values + of instance variables via <code>my varName ?value?</code> +</p> +</li> +</ul></div> +<div class="paragraph"><p>In NX, the favored approach to access instance variables is to use +the name resolvers, although it is as well possible to import +variables via <code>nx::var import</code> or to check for the existence of +instance variables via <code>nx::var exists</code>.</p></div> +<div class="paragraph"><p>The following examples summary the use cases for accessing the own and +other instance variables.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> C +C instproc foo args { + <span class='nx-comment'># Method scoped variable a +</span> <span class='nx-keyword'>set</span> a 1 + <span class='nx-comment'># Instance variable b +</span> <span class='nx-keyword'>my</span> instvar b + <span class='nx-keyword'>set</span> b 2 + <span class='nx-comment'># Global variable/namespaced variable c +</span> <span class='nx-keyword'>set</span> ::c 3 +}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { + <span class='nx-keyword'>:method</span> foo args {...} + <span class='nx-comment'># Method scoped variable a +</span> <span class='nx-keyword'>set</span> a 1 + <span class='nx-comment'># Instance variable b +</span> <span class='nx-keyword'>set</span> :b 2 + <span class='nx-comment'># Global variable/namespaced variable c +</span> <span class='nx-keyword'>set</span> ::c 3 + } +}</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>... instproc ... { + <span class='nx-keyword'>my</span> <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> +}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Set own instance variable to a value via +</span><span class='nx-comment'># resolver (preferred and fastest way) +</span> +... <span class='nx-keyword'>method</span> ... { + <span class='nx-keyword'>set</span> :<span class='nx-placeholder'>/newVar/</span> <span class='nx-placeholder'>?value?</span> +}</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>... instproc ... { + <span class='nx-keyword'>my</span> instvar <span class='nx-placeholder'>/varName/</span> + <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> +}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Set own instance variable via +</span><span class='nx-comment'># variable import +</span> +... <span class='nx-keyword'>method</span> ... { + ::nx::var import [<span class='nx-keyword'>self</span>] <span class='nx-placeholder'>/varName/</span> + <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> +}</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>... instproc ... { + <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> [<span class='nx-keyword'>my</span> <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/otherVar/</span>] +}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Read own instance variable +</span> +... <span class='nx-keyword'>method</span> ... { + <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> [<span class='nx-keyword'>set</span> :<span class='nx-placeholder'>/otherVar/</span>] +}</pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>... <span class='nx-keyword'>method</span> ... { + <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/newVar/</span> <span class='nx-variable'>${</span><span class='nx-variable'>:/otherVar/}</span> +}</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>... instproc ... { + <span class='nx-keyword'>my</span> exists <span class='nx-placeholder'>/varName/</span> +}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Test existence of own instance variable +</span> +... <span class='nx-keyword'>method</span> ... { + <span class='nx-keyword'>info</span> :<span class='nx-placeholder'>/varName/</span> +}</pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'> ... <span class='nx-keyword'>method</span> ... { + ::nx::var exists [<span class='nx-keyword'>self</span>] <span class='nx-placeholder'>/varName/</span> +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_accessing_instance_variables_of_other_objects">2.3.3. Accessing Instance Variables of other Objects</h4> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Set instance variable of object obj to a +</span><span class='nx-comment'># value via resolver +</span><span class='nx-comment'># (preferred way: define property on obj) +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>eval</span> [<span class='nx-keyword'>list</span> <span class='nx-keyword'>set</span> :<span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span>]</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> [<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/otherVar/</span>]</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Read instance variable of object obj +</span><span class='nx-comment'># via resolver +</span> +<span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> [<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>eval</span> {<span class='nx-keyword'>set</span> :<span class='nx-placeholder'>/otherVar/</span>}]</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>... instproc ... { + <span class='nx-placeholder'>/obj/</span> instvar <span class='nx-placeholder'>/varName/</span> + <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> +}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Read instance variable of object /obj/ +</span><span class='nx-comment'># via import +</span> +... <span class='nx-keyword'>method</span> ... { + ::nx::var import <span class='nx-placeholder'>/obj/</span> <span class='nx-placeholder'>/varName/</span> + <span class='nx-keyword'>set</span> <span class='nx-placeholder'>/varName/</span> <span class='nx-placeholder'>?value?</span> +}</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> exists varName</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Test existence of instance variable of +</span><span class='nx-comment'># object obj +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>eval</span> {<span class='nx-keyword'>info</span> exists :<span class='nx-placeholder'>/varName/</span>}</pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>::nx::var exists <span class='nx-placeholder'>/obj/</span> <span class='nx-placeholder'>/varName/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_parameters">2.4. Parameters</h3> +<div class="paragraph"><p>While XOTcl 1 had very limited forms of parameters, XOTcl 2 and NX +provide a generalized and highly orthogonal parameter machinery +handling various kinds of value constraints (also called value +checkers). Parameters are used to specify,</p></div> +<div class="ulist"><ul> +<li> +<p> +how objects and classes are initialized (we call these parameter types + <em>Configure Parameters</em>), and +</p> +</li> +<li> +<p> +what values can be passed to methods (we call these <em>Method + Parameters</em>). +</p> +</li> +</ul></div> +<div class="paragraph"><p>Furthermore, parameters might be positional or non-positional, they +might be optional or required, they might have a defined multiplicity, +and value-types, they might be introspected, etc. The Next Scripting +Framework provide a unified, C-implemented infrastructure to handle +both, object and method parameters in the same way with a high degree +of orthogonality.</p></div> +<div class="paragraph"><p>Configuration parameters were specified in XOTcl 1 primarily via the +method <code>parameter</code> in a rather limited way, XOTcl 1 only supported +non-positional parameters in front of positional ones, supported no +value constraints for positional parameters, provided no distinction +between optional and required, and did not support multiplicity.</p></div> +<div class="paragraph"><p>Furthermore, the Next Scripting Framework provides optionally <em>Return +Value Checking</em> based on the same mechanism to check whether some +methods return always the values as specified.</p></div> +<div class="sect3"> +<h4 id="_parameters_for_configuring_objects_variables_and_properties">2.4.1. Parameters for Configuring Objects: Variables and Properties</h4> +<div class="paragraph"><p>Configure parameters are used for specifying values for configuring +objects when they are created (i.e. how instance variables are +initialized, what parameters can be passed in for initialization, what +default values are used, etc.). Such configuration parameters are +supported in XOTcl primarily via the method <code>parameter</code>, which is used +in XOTcl to define multiple parameters via a list of parameter +specifications.</p></div> +<div class="paragraph"><p>Since the term "parameter" is underspecified, NX uses a more +differentiated terminology. NX distinguishes between configurable +instance variables (also called <em>properties</em>) and non configurable +instance variables (called <em>variables</em>), which might have as well +e.g. default values. The values of configurable properties can be +queried at runtime via <code>cget</code>, and their values can be altered via +<code>configure</code>. When the value of a configure parameter is provided or +changed, the value checkers from the variable definition are used to +ensure, the value is permissible (i.e. it is for example an integer +value). The sum of all configurable object parameters are called +<em>configure parameters</em>. To define a define a configurable variable, NX +uses the method <code>property</code>, for non-configurable variables, the method +<code>variable</code> is used.</p></div> +<div class="paragraph"><p>Optionally, one can define in NX, that a <code>property</code> or a +<code>variable</code> should have a public, protected or private accessor. Such +an accessor is a method with the same name as the variable. In XOTcl, +every <code>parameter</code> defined as well automatically a same-named accessor +method, leading to potential name conflicts with other method names.</p></div> +<div class="paragraph"><p>In the examples below we show the definition of configurable an +non-configurable instance variables using <code>variable</code> and <code>property</code> +respectively.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define class "Foo" with instance +</span><span class='nx-comment'># variables "x" and "y" initialized +</span><span class='nx-comment'># on instance creation. The initialization +</span><span class='nx-comment'># has to be performed in the constructor. +</span> +<span class='nx-keyword'>Class</span> Foo +Foo instproc <span class='nx-keyword'>init</span> args { + instvar x y + <span class='nx-keyword'>set</span> x 1 + <span class='nx-keyword'>set</span> y 2 +} + +<span class='nx-comment'># Create instance of the class Foo +</span>Foo f1 + +<span class='nx-comment'># Object f1 has instance variables +</span><span class='nx-comment'># x == 1 and y == 2</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define class "Foo" with instance variables +</span><span class='nx-comment'># "x" and "y" initialized on instance creation. +</span><span class='nx-comment'># The method "variable" is similar in syntax +</span><span class='nx-comment'># to Tcl's "variable" command. During +</span><span class='nx-comment'># instance creation, the variable +</span><span class='nx-comment'># definitions are used for the +</span><span class='nx-comment'># initialization of the variables of the object. +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { + <span class='nx-keyword'>:variable</span> x 1 + <span class='nx-keyword'>:variable</span> y 2 +} + +<span class='nx-comment'># Create instance of the class Foo +</span>Foo <span class='nx-keyword'>create</span> f1 + +<span class='nx-comment'># Object f1 has instance variables +</span><span class='nx-comment'># x == 1 and y == 2</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>While XOTcl follows a procedural way to initialize variables via the +constructor <code>init</code>, NX follows a more declarative approach. Often, +classes have superclasses, which often want to provide their own +instance variables and default values. The declarative approach from +NX solves this via inheritance, while an procedural approach via +assign statements in the constructor requires explicit constructor +calls, which are often error-prone. Certainly, when a user prefers to +assign initial values to instance variables via explicit assign +operations in constructors, this is as well possible in NX.</p></div> +<div class="paragraph"><p>NX uses the same mechanism to define class variables or object +variables.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># No syntactic support for creating +</span><span class='nx-comment'># class variables</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'> +<span class='nx-comment'># Define a object variable "V" with value 100 and +</span><span class='nx-comment'># an instance variable "x". "V" is defined for the +</span><span class='nx-comment'># class object Foo, "x" is defined in the +</span><span class='nx-comment'># instances of the class. "object variable" works +</span><span class='nx-comment'># similar to "object method". +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { + <span class='nx-keyword'>:object</span> <span class='nx-keyword'>variable</span> V 100 + <span class='nx-keyword'>:variable</span> x 1 +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>In the next step, we define configurable instance variables which we +call <em>properties</em> in NX.</p></div> +<div class="paragraph"><p>XOTcl uses the method <code>parameter</code> is a shortcut for creating multiple +configurable variables with automatically created accessors (methods for +reading and writing of the variables). In NX, the preferred way to +create configurable variables is to use the method <code>property</code>. The +method <code>property</code> in NX is similar to <code>variable</code>, but makes the +variables configurable, which means that</p></div> +<div class="olist arabic"><ol class="arabic"> +<li> +<p> +one can specify the property as a non-positional parameter upon + creation of the object, +</p> +</li> +<li> +<p> +one can query the value via the method <code>cget</code>, and +</p> +</li> +<li> +<p> +one can modify the value of the underlying variable via the method + <code>configure</code>. +</p> +</li> +</ol></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Parameters specified as a list +</span><span class='nx-comment'># (short form); parameter +</span><span class='nx-comment'># "a" has no default, "b" has default "1" +</span> +<span class='nx-keyword'>Class</span> Foo -parameter {a {b 1}} + +<span class='nx-comment'># Create instance of the class Foo +</span>Foo f1 -a 0 + +<span class='nx-comment'># Object f1 has instance variables +</span><span class='nx-comment'># a == 0 and b == 1 +</span> +<span class='nx-comment'># XOTcl registers automatically accessors +</span><span class='nx-comment'># for the parameters. Use the accessor +</span><span class='nx-comment'># "b" to output the value of variable "b" +</span><span class='nx-keyword'>puts</span> [f1 b] + +<span class='nx-comment'># Use the setter to alter value of +</span><span class='nx-comment'># instance variable "b" +</span>f1 b 100</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define property "a" and "b". The +</span><span class='nx-comment'># property "a" has no default, "b" has +</span><span class='nx-comment'># default value "1" +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { + <span class='nx-keyword'>:property</span> a + <span class='nx-keyword'>:property</span> {b 1} +} + +<span class='nx-comment'># Create instance of the class Foo +</span>Foo <span class='nx-keyword'>create</span> f1 -a 0 + +<span class='nx-comment'># Object f1 has instance variables +</span><span class='nx-comment'># a == 0 and b == 1 +</span> +<span class='nx-comment'># Use the method "cget" to query the value +</span><span class='nx-comment'># of a configuration parameter +</span><span class='nx-keyword'>puts</span> [f1 <span class='nx-keyword'>cget</span> -b] + +<span class='nx-comment'># Use the method "configure" to alter the +</span><span class='nx-comment'># value of instance variable "b" +</span>f1 <span class='nx-keyword'>configure</span> -b 100</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>In general, NX allows to create variables and properties with and +without accessor methods. The created accessor methods might be +<code>public</code>, <code>protected</code> or <code>public</code>. When the value <code>none</code> is provided +to <code>-accessor</code>, no accessor will be created. This is actually the +default in NX. In order to change the default behavior in NX, one can use +<code>::nx::configure defaultAccessor none|public|protected|private</code>.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># "parameter" creates always accessor +</span><span class='nx-comment'># methods, accessor methods are +</span><span class='nx-comment'># always public, no "cget" is available. +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo -parameter {a {b1}} + +<span class='nx-comment'># Use the accessor method to query +</span><span class='nx-comment'># the value of a configuration parameter +</span><span class='nx-keyword'>puts</span> [f1 b] + +<span class='nx-comment'># Use the accessor method to set the +</span><span class='nx-comment'># value of instance variable "a" +</span>f1 a 100 + +<span class='nx-comment'># Use the accessor method to unset the +</span><span class='nx-comment'># value of instance variable "a" n.a. via +</span><span class='nx-comment'># accessor</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define property "a" and "b". The +</span><span class='nx-comment'># property "a" has no default, "b" has +</span><span class='nx-comment'># default value "1" +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { + <span class='nx-keyword'>:variable</span> -accessor <span class='nx-keyword'>public</span> a + <span class='nx-keyword'>:property</span> -accessor <span class='nx-keyword'>public</span> {b 1} +} + +<span class='nx-comment'># Use the accessor method to query +</span><span class='nx-comment'># the value of a configuration parameter +</span><span class='nx-keyword'>puts</span> [f1 b get] + +<span class='nx-comment'># Use the accessor method to set the +</span><span class='nx-comment'># value of instance variable "a" +</span>f1 a <span class='nx-keyword'>set</span> 100 + +<span class='nx-comment'># Use the accessor method to unset the +</span><span class='nx-comment'># value of instance variable "a" +</span>f1 a <span class='nx-keyword'>unset</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>Similar to <code>variable</code>, properties can be defined in NX on the class +and on the object level.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># XOTcl provides no means to define +</span><span class='nx-comment'># configurable variables at the object +</span><span class='nx-comment'># level</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define class with a property for the class object +</span><span class='nx-comment'># named "cp". This is similar to "static variables" +</span><span class='nx-comment'># in some other object-oriented programming +</span><span class='nx-comment'># languages. +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { + ... + <span class='nx-keyword'>:object</span> <span class='nx-keyword'>property</span> cp 101 +} + +<span class='nx-comment'># Define object property "op" +</span> +<span class='nx-keyword'>Object</span> <span class='nx-keyword'>create</span> o { + <span class='nx-keyword'>:object</span> <span class='nx-keyword'>property</span> op 102 +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>NX supports <em>value constraints</em> (value-checkers) for object and method +parameters in an orthogonal manner. NX provides a predefined set of +value checkers, which can be extended by the application developer. +In NX, the <em>value checking is optional</em>. This means that it is possible to +develop e.g. which a large amount of value-checking and deploy the +script with value checking turned off, if the script is highly +performance sensitive.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># No value constraints for +</span><span class='nx-comment'># parameter available</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Predefined value constraints: +</span><span class='nx-comment'># object, class, alnum, alpha, ascii, boolean, +</span><span class='nx-comment'># control, digit, double, false, graph, integer, +</span><span class='nx-comment'># lower, parameter, print, punct, space, true, +</span><span class='nx-comment'># upper, wordchar, xdigit +</span><span class='nx-comment'># +</span><span class='nx-comment'># User defined value constraints are possible. +</span><span class='nx-comment'># All parameter value checkers can be turned on +</span><span class='nx-comment'># and off at runtime. +</span><span class='nx-comment'># +</span><span class='nx-comment'># Define a required boolean property "a" +</span><span class='nx-comment'># and an integer property "b" with a default. +</span><span class='nx-comment'># The first definition uses "properties", +</span><span class='nx-comment'># the second definition uses multiple +</span><span class='nx-comment'># "property" statements. +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo -properties { + a:boolean + {b:integer 1} +}</pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { + <span class='nx-keyword'>:property</span> a:boolean + <span class='nx-keyword'>:property</span> {b:integer 1} +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>In XOTcl all configure parameters were <em>optional</em>. Required parameters have +to be passed to the constructor of the object.</p></div> +<div class="paragraph"><p>NX allows to define <em>optional</em> and <em>required</em> configure parameters (as +well as method parameters). Therefore, configure parameters can be used +as the single mechanism to parametrize objects. It is in NX not +necessary (and per default not possible) to pass arguments to the +constructor.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Required parameter not available</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Required parameter: +</span><span class='nx-comment'># Define a required property "a" and a +</span><span class='nx-comment'># required boolean property "b" +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo -properties { + a:required + b:boolean,required +}</pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { + <span class='nx-keyword'>:property</span> a:required + <span class='nx-keyword'>:property</span> b:boolean,required +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>NX supports in contrary to XOTcl to define the <em>multiplicity</em> of values +per parameter. In NX, one can specify that a parameter can accept the +value "" (empty) in addition to e.g. an integer, or one can specify that the +value is an empty or non-empty ist of values via the multiplicity. For +every specified value, the value checkers are applied.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Multiplicity for parameter +</span><span class='nx-comment'># not available</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Parameter with multiplicity +</span><span class='nx-comment'># ints is a list of integers, with default +</span><span class='nx-comment'># objs is a non-empty list of objects +</span><span class='nx-comment'># obj is a single object, maybe empty +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo -properties { + {ints:integer,0..n <span class='nx-string'>""</span>} + objs<span class='nx-keyword'>:object</span>,1..n + obj<span class='nx-keyword'>:object</span>,0..1 +}</pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { + <span class='nx-keyword'>:property</span> {ints:integer,0..n <span class='nx-string'>""</span>} + <span class='nx-keyword'>:property</span> objs<span class='nx-keyword'>:object</span>,1..n + <span class='nx-keyword'>:property</span> obj<span class='nx-keyword'>:object</span>,0..1 +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>For the implementation of variables and properties, NX uses slot +objects, which are an extension to the <code>-slots</code> already available in +XOTcl. While very for every <code>property</code> in NX, a slot object is created, +for performance reasons, not every <code>variable</code> has a slot associated.</p></div> +<div class="paragraph"><p>When an property is created, NX does actually three things:</p></div> +<div class="olist arabic"><ol class="arabic"> +<li> +<p> +Create a slot object, which can be specified in more detail + using the init-block of the slot object +</p> +</li> +<li> +<p> +Create a parameter definition for the initialization of the + object (usable via a non-positional parameter during object + creation), and +</p> +</li> +<li> +<p> +register optionally an accessor function (setter), for which the usual + protection levels (<code>public</code>, <code>protected</code> or <code>private</code>) can be used. +</p> +</li> +</ol></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define parameters via slots +</span> +<span class='nx-keyword'>Class</span> Foo -slots { + <span class='nx-keyword'>Attribute</span> a + <span class='nx-keyword'>Attribute</span> b -default 1 +} + +<span class='nx-comment'># Create instance of the class Foo +</span><span class='nx-comment'># and provide a value for instance +</span><span class='nx-comment'># variable "a" +</span>Foo f1 -a 0 + +<span class='nx-comment'># Object f1 has a == 0 and b == 1</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Configurable parameters specified via the +</span><span class='nx-comment'># method "property" (supports method +</span><span class='nx-comment'># modifiers and scripted configuration; +</span><span class='nx-comment'># see below) +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Foo { + <span class='nx-keyword'>:property</span> a + <span class='nx-keyword'>:property</span> {b 1} +} + +<span class='nx-comment'># Create instance of the class Foo and +</span><span class='nx-comment'># provide a value for instance variable "a" +</span>Foo <span class='nx-keyword'>create</span> f1 -a 0 + +<span class='nx-comment'># Object f1 has a == 0 and b == 1</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>Since the slots are objects, the slot objects can be configured and +parametrized like every other object in NX. Slot objects can be +provided with a scripted initialization as well. We show first the +definition of properties similar to the functionality provided as well +by XOTcl and show afterwards how to use value constraints, optional +parameters, etc. in NX.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define parameter with an an +</span><span class='nx-comment'># attribute-specific type checker +</span> +<span class='nx-keyword'>Class</span> Person -slots { + <span class='nx-keyword'>Attribute</span> <span class='nx-keyword'>create</span> sex -type <span class='nx-string'>"sex"</span> { + <span class='nx-keyword'>my</span> <span class='nx-keyword'>proc</span> type=sex {name value} { + <span class='nx-keyword'>switch</span> -glob <span class='nx-variable'>$value</span> { + m* {<span class='nx-keyword'>return</span> m} + f* {<span class='nx-keyword'>return</span> f} + default { + <span class='nx-keyword'>error</span> <span class='nx-string'>"expected sex but got $value"</span> + } + } + } + } +}</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Configure parameter with scripted +</span><span class='nx-comment'># definition (init-block), defining a +</span><span class='nx-comment'># property specific type checker +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> Person { + <span class='nx-keyword'>:property</span> -accessor <span class='nx-keyword'>public</span> sex:sex,convert { + + <span class='nx-comment'># define a converter to standardize representation +</span> <span class='nx-keyword'>:object</span> <span class='nx-keyword'>method</span> type=sex {name value} { + <span class='nx-keyword'>switch</span> -glob <span class='nx-variable'>$value</span> { + m* {<span class='nx-keyword'>return</span> m} + f* {<span class='nx-keyword'>return</span> f} + default {<span class='nx-keyword'>error</span> <span class='nx-string'>"expected sex but got $value"</span>} + } + } + + } +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>The parameters provided by a class for the initialization of +instances can be introspected via querying the parameters +of the method create: <code>/cls/ info lookup parameters create</code> +(see <a href="#info_configure_parameter">[info_configure_parameter]</a>).</p></div> +</div> +<div class="sect3"> +<h4 id="_delete_variable_handlers">2.4.2. Delete Variable Handlers</h4> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># No syntactic support for deleting +</span><span class='nx-comment'># variable handlers</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Like deletion of Methods: +</span><span class='nx-comment'># Delete on the object, where the +</span><span class='nx-comment'># variable handler is defined. +</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>property</span> <span class='nx-placeholder'>/name/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>property</span> <span class='nx-placeholder'>/name/</span> + +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>variable</span> <span class='nx-placeholder'>/name/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>delete</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>variable</span> <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_method_parameters">2.4.3. Method Parameters</h4> +<div class="paragraph"><p>Method parameters are used to specify the interface of a single method +(what kind of values may be passed to a method, what default values +are provided etc.). The method parameters specifications in XOTcl 1 +were limited and allowed only value constraints for non positional +arguments.</p></div> +<div class="paragraph"><p>NX and XOTcl 2 provide value constraints for all kind of method parameters. +While XOTcl 1 required non-positional arguments to be listed in front of +positional arguments, this limitation is lifted in XOTcl 2.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define method foo with non-positional +</span><span class='nx-comment'># parameters (x, y and y) and positional +</span><span class='nx-comment'># parameter (a and b) +</span> +<span class='nx-keyword'>Class</span> C +C instproc foo { + -x:integer + -y:required + -z + a + b +} { + <span class='nx-comment'># ... +</span>} +C <span class='nx-keyword'>create</span> c1 + +<span class='nx-comment'># invoke method foo +</span>c1 foo -x 1 -y a 2 3</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define method foo with +</span><span class='nx-comment'># non-positional parameters +</span><span class='nx-comment'># (x, y and y) and positional +</span><span class='nx-comment'># parameter (a and b) +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { + <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> foo { + -x:integer + -y:required + -z + a + b + } { + <span class='nx-comment'># ... +</span> } + <span class='nx-keyword'>:create</span> c1 +} +<span class='nx-comment'># invoke method foo +</span>c1 foo -x 1 -y a 2 3</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Only leading non-positional +</span><span class='nx-comment'># parameters are available; no +</span><span class='nx-comment'># optional positional parameters, +</span><span class='nx-comment'># no value constraints on +</span><span class='nx-comment'># positional parameters, +</span><span class='nx-comment'># no multiplicity, ...</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define various forms of parameters +</span><span class='nx-comment'># not available in XOTcl 1 +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { + <span class='nx-comment'># trailing (or interleaved) non-positional +</span> <span class='nx-comment'># parameters +</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> m1 {a b -x:integer -y} { + <span class='nx-comment'># ... +</span> } + + <span class='nx-comment'># positional parameters with value constraints +</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> m2 {a:integer b:boolean} { + <span class='nx-comment'>#... +</span> } + + <span class='nx-comment'># optional positional parameter (trailing) +</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> <span class='nx-keyword'>set</span> {varName value:optional} { + <span class='nx-comment'># .... +</span> } + + <span class='nx-comment'># parameter with multiplicity +</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>method</span> m3 {-objs<span class='nx-keyword'>:object</span>,1..n c<span class='nx-keyword'>:class</span>,0..1} { + <span class='nx-comment'># ... +</span> } + + <span class='nx-comment'># In general, the same list of value +</span> <span class='nx-comment'># constraints as for configure parameter is +</span> <span class='nx-comment'># available (see above). +</span> <span class='nx-comment'># +</span> <span class='nx-comment'># User defined value constraints are +</span> <span class='nx-comment'># possible. All parameter value checkers +</span> <span class='nx-comment'># can be turned on and off. +</span>}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_return_value_checking">2.4.4. Return Value Checking</h4> +<div class="paragraph"><p><em>Return value checking</em> is a functionality available in the Next +Scripting Framework, that was not yet available in XOTcl 1. A return +value checker assures that a method returns always a value satisfying +some value constraints. Return value checkers can be defined on all +forms of methods (scripted or C-implemented). Like for other value +checkers, return value checkers can be turned on and off.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># No return value checking +</span><span class='nx-comment'># available</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Define method foo with non-positional +</span><span class='nx-comment'># parameters (x, y and y) and positional +</span><span class='nx-comment'># parameter (a and b) +</span> +<span class='nx-keyword'>Class</span> <span class='nx-keyword'>create</span> C { + + <span class='nx-comment'># Define method foo which returns an +</span> <span class='nx-comment'># integer value +</span> <span class='nx-keyword'>:method</span> foo -returns integer {-x:integer} { + <span class='nx-comment'># ... +</span> } + + <span class='nx-comment'># Define an alias for the Tcl command ::incr +</span> <span class='nx-comment'># and assure, it always returns an integer +</span> <span class='nx-comment'># value +</span> <span class='nx-keyword'>:alias</span> <span class='nx-keyword'>incr</span> -returns integer ::incr + + <span class='nx-comment'># Define a forwarder that has to return an +</span> <span class='nx-comment'># integer value +</span> <span class='nx-keyword'>:forward</span> ++ -returns integer ::expr 1 + + + <span class='nx-comment'># Define a method that has to return a +</span> <span class='nx-comment'># non-empty list of objects +</span> <span class='nx-keyword'>:public</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> instances {} \ + -returns <span class='nx-keyword'>object</span>,1..n { + <span class='nx-keyword'>return</span> [<span class='nx-keyword'>:info</span> instances] + } +}</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_interceptors">2.5. Interceptors</h3> +<div class="paragraph"><p>XOTcl and NX allow the definition of the same set of interceptors, +namely class- and object-level mixins and class- and object-level +filters. The primary difference in NX is the naming, since NX abandons +the prefix "inst" from the names of instance specific method, but uses +the modifier <code>object</code>" for object specific methods.</p></div> +<div class="paragraph"><p>Therefore, in NX, if a <code>mixin</code> is registered on a class-level, it is +applicable for the instances (a per-class mixin), and if and <code>object +mixin</code> is registered, it is a per-object mixin. In both cases, the +term <code>mixin</code> is used, in the second case with the modifier +<code>object</code>. As in all other cases, one can register the same way a +per-object mixin on a plain object or on a class object.</p></div> +<div class="sect3"> +<h4 id="_register_mixin_classes_and_mixin_guards">2.5.1. Register Mixin Classes and Mixin Guards</h4> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> instmixin ... +<span class='nx-placeholder'>/cls/</span> instmixinguard /<span class='nx-keyword'>mixin</span>/ <span class='nx-placeholder'>?condition?</span> + +<span class='nx-comment'># Query per-class mixin +</span><span class='nx-placeholder'>/cls/</span> instmixin</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Register/clear per-class mixin and guard for +</span><span class='nx-comment'># a class +</span> +<span class='nx-placeholder'>/cls/</span> mixins add|<span class='nx-keyword'>set</span>|clear ... +<span class='nx-placeholder'>/cls/</span> mixins <span class='nx-keyword'>guard</span> /<span class='nx-keyword'>mixin</span>/ <span class='nx-placeholder'>?condition?</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>configure</span> -mixin ... + +<span class='nx-comment'># Query per-class mixins +</span><span class='nx-placeholder'>/cls/</span> mixins get +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>cget</span> -mixins + +<span class='nx-comment'># Query per-class mixins (without guards) +</span><span class='nx-placeholder'>/cls/</span> mixins classes</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>mixin</span> ... +<span class='nx-placeholder'>/obj/</span> mixinguard /<span class='nx-keyword'>mixin</span>/ <span class='nx-placeholder'>?condition?</span> + +<span class='nx-comment'># Query per-object mixins +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>mixin</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Register/clear per-object mixin and guard for +</span><span class='nx-comment'># an object +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> mixins add|<span class='nx-keyword'>set</span>|clear ... +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> mixins <span class='nx-keyword'>guard</span> /<span class='nx-keyword'>mixin</span>/ <span class='nx-placeholder'>?condition?</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>configure</span> -object-mixins ... + +<span class='nx-comment'># Query per-object mixin +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> mixins get +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>cget</span> -object-mixin + +<span class='nx-comment'># Query per-object mixins (without guards) +</span><span class='nx-placeholder'>/cls/</span> mixins classes</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_register_filters_and_filter_guards">2.5.2. Register Filters and Filter Guards</h4> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Register per-class filter and guard for +</span><span class='nx-comment'># a class +</span><span class='nx-placeholder'>/cls/</span> instfilter ... +<span class='nx-placeholder'>/cls/</span> instfilterguard /<span class='nx-keyword'>filter</span>/ <span class='nx-placeholder'>?condition?</span> + +<span class='nx-comment'># Query per-class filter +</span><span class='nx-placeholder'>/cls/</span> instfilter</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Register/clear per-class filter and guard for +</span><span class='nx-comment'># a class +</span> +<span class='nx-placeholder'>/cls/</span> filters add|<span class='nx-keyword'>set</span>|clear ... +<span class='nx-placeholder'>/cls/</span> filters <span class='nx-keyword'>guard</span> /<span class='nx-keyword'>filter</span>/ <span class='nx-placeholder'>?condition?</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>configure</span> -filters ... + +<span class='nx-comment'># Query per-class filters +</span><span class='nx-placeholder'>/cls/</span> filters get +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>cget</span> -filters + +<span class='nx-comment'># Query per-class filters (without guards) +</span><span class='nx-placeholder'>/cls/</span> filters <span class='nx-keyword'>methods</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>filter</span> ... +<span class='nx-placeholder'>/obj/</span> filterguard /<span class='nx-keyword'>filter</span>/ <span class='nx-placeholder'>?condition?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Register(clear per-object filter and guard for +</span><span class='nx-comment'># an object +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> filters add|<span class='nx-keyword'>set</span>|clear ... +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span> filters <span class='nx-keyword'>guard</span> /<span class='nx-keyword'>filter</span>/ <span class='nx-placeholder'>?condition?</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>configure</span> -object-filters ... + +<span class='nx-comment'># Query per-object filters +</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>object</span> filters get +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>cget</span> -object-filters + +<span class='nx-comment'># Query per-object filters (without guards) +</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>object</span> filters <span class='nx-keyword'>methods</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_introspection">2.6. Introspection</h3> +<div class="paragraph"><p>In general, introspection in NX became more orthogonal and less +dependent on the type of the method. In XOTcl it was e.g. necessary +that a developer had to know, whether a method is e.g. scripted or not +and has to use accordingly different sub-methods of <code>info</code>.</p></div> +<div class="paragraph"><p>In NX, one can use e.g. always <code>info method</code> with a subcommand and the +framework tries to hide the differences as far as possible. So, one +can for example obtain with <code>info method parameter</code> the parameters of +scripted and C-implemented methods the same way, one can get the +definition of all methods via <code>info method definition</code> and one can get +an manual-like interface description via <code>info method +syntax</code>. In addition, NX provides means to query the type of +a method, and NX allows to filter by the type of the method.</p></div> +<div class="sect3"> +<h4 id="_list_sub_and_superclass_relations">2.6.1. List sub- and superclass relations</h4> +<div class="paragraph"><p>While XOTcl used singular words for introspecting sub- and superclass +relations, NX uses plural word to indicate that potentially a list of +values is returned.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>superclass</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> superclasses <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> subclass <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> subclasses -type setter <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_methods_defined_by_classes">2.6.2. List methods defined by classes</h4> +<div class="paragraph"><p>While XOTcl uses different names for obtaining different kinds of +methods defined by a class, NX uses <code>info methods</code> in an orthogonal +manner. NX allows as well to use the call protection to filter the +returned methods.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instcommands <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instparametercmd <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type setter <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instprocs <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type scripted <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type <span class='nx-keyword'>alias</span> <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type forwarder <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -type <span class='nx-keyword'>object</span> <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> -callprotection <span class='nx-keyword'>public</span>|<span class='nx-keyword'>protected</span> ...</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_methods_defined_by_objects">2.6.3. List methods defined by objects</h4> +<div class="paragraph"><p>While XOTcl uses different names for obtaining different kinds of +methods defined by an object, NX uses <code>info methods</code> in an orthogonal +manner. NX allows as well to use the call protection to filter the +returned methods.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> commands <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> parametercmd <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type setter <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> procs <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type scripted <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type <span class='nx-keyword'>alias</span> <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type forwarder <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -type <span class='nx-keyword'>object</span> <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> -callprotection <span class='nx-keyword'>public</span>|<span class='nx-keyword'>protected</span> ...</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_check_existence_of_a_method">2.6.4. Check existence of a method</h4> +<div class="paragraph"><p>NX provides multiple ways of checking, whether a method exists; one +can use <code>info method exists</code> to check, if a given method exists +(return boolean), or one can use <code>info methods ?pattern?</code>, where +<code>pattern</code> might be a single method name without wild-card +characters. The method <code>info methods ?pattern?</code> returns a list of +matching names, which might be empty. These different methods appear +appropriate depending on the context.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>/obj|cls/ <span class='nx-keyword'>info</span> \ + [inst](commands|procs|parametercmd) \ + <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> exists <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> exists <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_callable_methods">2.6.5. List callable methods</h4> +<div class="paragraph"><p>In order to obtain for an object the set of artefacts defined in the + class hierarchy, NX uses <code>info lookup</code>. One can either lookup methods + (via <code>info lookup methods</code>) or slots (via <code>info lookup slots</code>). The + plural term refers to a potential set of return values.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>methods</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> <span class='nx-keyword'>methods</span> ... <span class='nx-placeholder'>?pattern?</span> +<span class='nx-comment'># Returns list of method names</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># List only application specific methods +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> <span class='nx-keyword'>methods</span> -source application ... <span class='nx-placeholder'>?pattern?</span> +<span class='nx-comment'># Returns list of method names</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Options for 'info methods' +</span><span class='nx-comment'># +</span><span class='nx-comment'># -incontext +</span><span class='nx-comment'># -nomixins</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Options for 'info lookup methods' +</span><span class='nx-comment'># +</span><span class='nx-comment'># -source ... +</span><span class='nx-comment'># -callprotection ... +</span><span class='nx-comment'># -incontext +</span><span class='nx-comment'># -type ... +</span><span class='nx-comment'># -nomixins</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># List slot objects defined for obj +</span><span class='nx-comment'># -source might be all|application|baseclasses +</span><span class='nx-comment'># -type is the class of the slot object +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> slots <span class='nx-placeholder'>?-type ...?</span> <span class='nx-placeholder'>?-source ...?</span> <span class='nx-placeholder'>?pattern?</span> + +<span class='nx-comment'># Returns list of slot objects</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># List registered filters +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> filters -order <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span> + +<span class='nx-comment'># List registered mixins +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> mixins -heritage <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># List registered filters +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> filters <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span> + +<span class='nx-comment'># List registered mixins +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> mixins <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_object_class_where_a_specified_method_is_defined">2.6.6. List object/class where a specified method is defined</h4> +<div class="paragraph"><p><code>info lookup</code> can be used as well to determine, where exactly an + artefact is located. One can obtain this way a method handle, where +a method or filter is defined.</p></div> +<div class="paragraph"><p>The concept of a <em>method-handle</em> is new in NX. The method-handle +can be used to obtain more information about the method, such as +e.g. the definition of the method.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> procsearch <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> <span class='nx-keyword'>method</span> <span class='nx-placeholder'>/methodName/</span> +<span class='nx-comment'># Returns method-handle</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> filtersearch <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> <span class='nx-keyword'>filter</span> <span class='nx-placeholder'>/methodName/</span> +<span class='nx-comment'># Returns method-handle</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_definition_of_scripted_methods">2.6.7. List definition of scripted methods</h4> +<div class="paragraph"><p>XOTcl contains a long list of <code>info</code> subcommands for different kinds of +methods and for obtaining more detailed information about these +methods.</p></div> +<div class="paragraph"><p>In NX, this list of <code>info</code> subcommands is much shorter and more +orthogonal. For example <code>info method definition</code> can be used to obtain +with a single command the full definition of a <em>scripted method</em>, and +furthermore, it works as well the same way to obtain e.g. the +definition of a <em>forwarder</em> or an <em>alias</em>.</p></div> +<div class="paragraph"><p>While XOTcl uses different names for info options for objects and +classes (using the prefix "inst" for instance specific method), NX +uses for object specific method the modifier <code>object</code>. For definition +of class object specific methods, use the modifier <code>object</code> as usual.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> definition <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> definition <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instbody <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> body <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> body <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> body <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instargs <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> args <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> args <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> args <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instnonposargs <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> args <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> parameter <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> parameter <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instdefault <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> default <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># not needed, part of +</span><span class='nx-comment'># "info ?object? method parameter"</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instpre <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> pre <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> precondition <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> precondition <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instpost <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> post <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> postcondition <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> postcondition <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +<div class="paragraph"><p>Another powerful introspection option in NX is <code>info ?object? method +syntax</code> which obtains a representation of the parameters of a +method in the style of Tcl man pages (regardless of the kind of +method).</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> syntax <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> syntax <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="info_configure_parameter">2.6.8. List Configure Parameters</h4> +<div class="paragraph"><p>The way, how newly created objects can be configured is determined in NX +via properties. The configuration happens during creation via the +methods <code>create</code> or <code>new</code> or during runtime via <code>configure</code>. These +methods have therefore virtual argument lists, depending on the object +or class on which they are applied.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Return the parameters applicable to +</span><span class='nx-comment'># the create method of a certain class. +</span><span class='nx-comment'># class can be configured. A pattern can +</span><span class='nx-comment'># be used to filter the results. +</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> parameters <span class='nx-keyword'>create</span> ?<span class='nx-placeholder'>/pattern/</span>? + +<span class='nx-comment'># Return in the result in documentation syntax +</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> syntax <span class='nx-keyword'>create</span> ?<span class='nx-placeholder'>/pattern/</span>? + +<span class='nx-comment'># "info lookup parameters configure" returns +</span><span class='nx-comment'># parameters available for configuring the +</span><span class='nx-comment'># current object (might contain object +</span><span class='nx-comment'># specific information) +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> parameters <span class='nx-keyword'>configure</span> <span class='nx-placeholder'>?pattern?</span> + +<span class='nx-comment'># "info lookup configure syntax" returns syntax of +</span><span class='nx-comment'># a call to configure in the Tcl parameter syntax +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> syntax <span class='nx-keyword'>configure</span> + +<span class='nx-comment'># Obtain information from a parameter +</span><span class='nx-comment'># (as e.g. returned from "info lookup +</span><span class='nx-comment'># parameters configure"). +</span> +nsf::parameter::info name <span class='nx-placeholder'>/parameter/</span> +nsf::parameter::info syntax <span class='nx-placeholder'>/parameter/</span> +nsf::parameter::info type <span class='nx-placeholder'>/parameter/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_variable_declarations_property_and_variable">2.6.9. List Variable Declarations (property and variable)</h4> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># obtain parameter definitions defined +</span><span class='nx-comment'># for a class +</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> parameter</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># "info variables" returns handles of +</span><span class='nx-comment'># properties and variables defined by this +</span><span class='nx-comment'># class or object +</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> variables <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> variables <span class='nx-placeholder'>?pattern?</span> + +<span class='nx-comment'># "info lookup variables" returns handles +</span><span class='nx-comment'># of variables and properties applicable +</span><span class='nx-comment'># for the current object (might contain +</span><span class='nx-comment'># object specific information) +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> variables <span class='nx-placeholder'>/pattern/</span> + +<span class='nx-comment'># "info variable" lists details about a +</span><span class='nx-comment'># single property or variable. +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>variable</span> definition <span class='nx-placeholder'>/handle/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>variable</span> name <span class='nx-placeholder'>/handle/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>variable</span> parameter <span class='nx-placeholder'>/handle/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_slots">2.6.10. List Slots</h4> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Return list of slots objects defined on the +</span><span class='nx-comment'># object or class +</span><span class='nx-comment'># +</span><span class='nx-comment'># -source might be all|application|baseclasses +</span><span class='nx-comment'># -type is the class of the slot object +</span><span class='nx-comment'># -closure includes slots of superclasses +</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> slots \ + <span class='nx-placeholder'>?-type value?</span> <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?-source value?</span> <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> slots <span class='nx-placeholder'>?-type ...?</span> <span class='nx-placeholder'>?pattern?</span> + +<span class='nx-comment'># List reachable slot objects defined for obj +</span><span class='nx-comment'># -source might be all|application|baseclasses +</span><span class='nx-comment'># -type is the class of the slot object +</span><span class='nx-comment'># Returns list of slot objects. +</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>lookup</span> slots \ + <span class='nx-placeholder'>?-type ...?</span> <span class='nx-placeholder'>?-source ... ?</span>pattern? + +<span class='nx-comment'># Obtain definition, name or parameter from +</span><span class='nx-comment'># slot object +</span> +<span class='nx-placeholder'>/slotobj/</span> definition +<span class='nx-placeholder'>/slotobj/</span> name +<span class='nx-placeholder'>/slotobj/</span> parameter</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_filter_or_mixins">2.6.11. List Filter or Mixins</h4> +<div class="paragraph"><p>In NX all introspection options for filters are provided via +<code>info filters</code> and all introspection options for mixins are +provided via <code>info mixins</code>.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>filter</span> <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-order?</span> <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> filterguard <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> filters \ + <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instfilter \ + <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-order?</span> <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instfilterguard <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> filters \ + <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>mixin</span> <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-order ?</span>pattern? +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> mixinguard <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> mixins \ + <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instmixin \ + <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-order?</span> <span class='nx-placeholder'>?pattern?</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instmixinguard <span class='nx-placeholder'>/name/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixins \ + <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?-guards?</span> <span class='nx-placeholder'>?-heritage?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_definition_of_methods_defined_by_aliases_setters_or_forwarders">2.6.12. List definition of methods defined by aliases, setters or forwarders</h4> +<div class="paragraph"><p>As mentioned earlier, <code>info method definition</code> can be used on every +kind of method. The same call can be used to obtain the definition of +a scripted method, a method-alias, a forwarder or a setter method.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> definition <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> definition <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_method_handles">2.6.13. List Method-Handles</h4> +<div class="paragraph"><p>NX supports <em>method-handles</em> to provide means to obtain further +information about a method or to change maybe some properties of a +method. When a method is created, the method creating method returns +the method handle to the created method.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># +</span><span class='nx-comment'># List the method handle of the specified method, +</span><span class='nx-comment'># can be used e.g. for aliases. "handle" is the short +</span><span class='nx-comment'># form of "definitionhandle". +</span><span class='nx-comment'># +</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> handle <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> handle <span class='nx-placeholder'>/methodName/</span> +<span class='nx-comment'># +</span><span class='nx-comment'># For ensemble methods (method name contains +</span><span class='nx-comment'># spaces) one can query as well the registration +</span><span class='nx-comment'># handle, which is the handle to the root of the +</span><span class='nx-comment'># ensemble; the definition handle points to the +</span><span class='nx-comment'># leaf of the ensemble. +</span><span class='nx-comment'># +</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> registrationhandle <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> registrationhandle <span class='nx-placeholder'>/methodName/</span> +<span class='nx-comment'># +</span><span class='nx-comment'># For aliases, one can query the original +</span><span class='nx-comment'># definition via "info method origin" +</span><span class='nx-comment'># +</span><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> origin <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> origin <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_type_of_a_method">2.6.14. List type of a method</h4> +<div class="paragraph"><p>The method <code>info ?object? method type</code> is new in NX to obtain the type of the +specified method.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>method</span> type <span class='nx-placeholder'>/methodName/</span> +<span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> <span class='nx-keyword'>object</span> <span class='nx-keyword'>method</span> type <span class='nx-placeholder'>/methodName/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_list_the_scope_of_mixin_classes">2.6.15. List the scope of mixin classes</h4> +<div class="paragraph"><p>NX provides a richer set of introspection options to obtain +information, where mixins classes are mixed into.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># List objects, where /cls/ is a +</span><span class='nx-comment'># per-object mixin +</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof -scope <span class='nx-keyword'>object</span> <span class='nx-placeholder'>?-closure?</span> \ + <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instmixinof <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># List classes, where /cls/ is a per-class mixin +</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof -scope <span class='nx-keyword'>class</span> <span class='nx-placeholder'>?-closure?</span> \ + <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># List objects and classes, where /cls/ is +</span><span class='nx-comment'># either a per-object or a per-class mixin +</span> +<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof -scope all <span class='nx-placeholder'>?-closure?</span> \ + <span class='nx-placeholder'>?pattern?</span></pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> mixinof <span class='nx-placeholder'>?-closure?</span> <span class='nx-placeholder'>?pattern?</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_check_properties_of_object_and_classes">2.6.16. Check properties of object and classes</h4> +<div class="paragraph"><p>Similar as noted before, NX uses rather a hierarchical approach of +naming using multiple layers of subcommands).</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> istype <span class='nx-placeholder'>/sometype/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Check if object is a subtype of some class +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> has type <span class='nx-placeholder'>/sometype/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> ismixin <span class='nx-placeholder'>/cls/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Check if object has the specified mixin registered +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> has <span class='nx-keyword'>mixin</span> <span class='nx-placeholder'>/cls/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> isclass ?<span class='nx-placeholder'>/cls/</span>?</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Check if object is an NX class +</span><span class='nx-placeholder'>/obj/</span> has type ::nx::Class + +<span class='nx-comment'># Check if object is a class in one of the +</span><span class='nx-comment'># NSF object systems +</span>::nsf::is <span class='nx-keyword'>class</span> <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> ismetaclass <span class='nx-placeholder'>/cls/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Check if class is an NX metaclass +</span><span class='nx-keyword'>expr</span> {[<span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> heritage ::nx::Class] ne <span class='nx-string'>""</span>} + +<span class='nx-comment'># Check if object is a metaclass in one of the +</span><span class='nx-comment'># NSF object systems +</span>::nsf::is <span class='nx-keyword'>metaclass</span> <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Check if object is a baseclass of an object system +</span>::nsf::is baseclass <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Return name of object (without namespace prefix) +</span><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> name</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span>::exists <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Check for existence of object (nsf primitive) +</span>::nsf::object::exists <span class='nx-placeholder'>/obj/</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect3"> +<h4 id="_call_stack_introspection">2.6.17. Call-stack Introspection</h4> +<div class="paragraph"><p>Call-stack introspection is very similar in NX and XOTcl. NX uses for +subcommand the term <code>current</code> instead of <code>self</code>, since <code>self</code> has a +strong connotation to the current object. The term <code>proc</code> is renamed +by <code>method</code>.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span></pre></div></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> <span class='nx-keyword'>object</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> <span class='nx-keyword'>class</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> <span class='nx-keyword'>class</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> args</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> args</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> <span class='nx-keyword'>proc</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> <span class='nx-keyword'>method</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> callingclass</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> calledclass</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> callingobject</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> callingobject</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> callingproc</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> callingmethod</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> calledclass</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> calledclass</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> calledproc</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> calledmethod</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> isnextcall</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> isnextcall</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> <span class='nx-keyword'>next</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Returns method-handle of the +</span><span class='nx-comment'># method to be called via "next" +</span><span class='nx-keyword'>current</span> <span class='nx-keyword'>next</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> filterreg</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># Returns method-handle of the +</span><span class='nx-comment'># filter method +</span><span class='nx-keyword'>current</span> filterreg</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> callinglevel</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> callinglevel</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>self</span> activelevel</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-keyword'>current</span> activelevel</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_other_predefined_methods">2.7. Other Predefined Methods</h3> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> requireNamespace</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>require</span> <span class='nx-keyword'>namespace</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># n.a.</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>require</span> <span class='nx-keyword'>method</span></pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect2"> +<h3 id="_dispatch_aliases_etc">2.8. Dispatch, Aliases, etc.</h3> +<div class="paragraph"><p>todo: to be done or omitted</p></div> +</div> +<div class="sect2"> +<h3 id="_assertions">2.9. Assertions</h3> +<div class="paragraph"><p>In contrary to XOTcl, NX provides no pre-registered methods for +assertion handling. All assertion handling can e performed via the +Next Scripting primitive <code>nsf::method::assertion</code>.</p></div> +<div class="tableblock"> +<table rules="all" +width="100%" +frame="void" +cellspacing="0" cellpadding="4"> +<col width="50%" /> +<col width="50%" /> +<thead> +<tr> +<th align="left" valign="middle">XOTcl </th> +<th align="left" valign="middle">Next Scripting Language</th> +</tr> +</thead> +<tbody> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> check <span class='nx-placeholder'>/checkoptions/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/obj/</span> check <span class='nx-placeholder'>/checkoptions/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> check</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/obj/</span> check</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span>-invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>info</span> invar</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/obj/</span> <span class='nx-keyword'>object</span>-invar</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> instinvar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>class</span>-invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> instinvar</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>class</span>-invar</pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>object</span>-invar <span class='nx-placeholder'>/conditions/</span></pre></div></div></div></td> +</tr> +<tr> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>info</span> invar</pre></div></div></div></td> +<td align="left" valign="middle"><div><div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'>::nsf::method::assertion <span class='nx-placeholder'>/cls/</span> <span class='nx-keyword'>object</span>-invar</pre></div></div></div></td> +</tr> +</tbody> +</table> +</div> +</div> +<div class="sect2"> +<h3 id="_method_protection">2.10. Method Protection</h3> +<div class="paragraph"><p>As described <a href="#method-protect-example">above</a>, NX supports method +protection via the method modifiers <code>protected</code> and <code>public</code>. A +protected method can be only called from an object of that class, +while public methods can be called from every object. The method +protection can be used to every kind of method, such as e.g. scripted +methods, aliases, forwarders, or accessors. For invocations, +the most specific definition (might be a mixin) is used for +determining the protection.</p></div> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_incompatibilities_between_xotcl_1_and_xotcl_2">3. Incompatibilities between XOTcl 1 and XOTcl 2</h2> +<div class="sectionbody"> +<div class="sect2"> +<h3 id="_resolvers_2">3.1. Resolvers</h3> +<div class="paragraph"><p>The resolvers (variable resolvers, function resolvers) of the Next +Scripting Framework are used as well within XOTcl 2. When variable +names or method names starting with a single colon are used in XOTcl 1 +scripts, conflicts will arise with the resolver. These names must be +replaced.</p></div> +</div> +<div class="sect2"> +<h3 id="_parameters_2">3.2. Parameters</h3> +<div class="paragraph"><p>The following changes for parameters could be regarded as bug-fixes.</p></div> +<div class="sect3"> +<h4 id="_parameter_usage_without_a_value">3.2.1. Parameter usage without a value</h4> +<div class="paragraph"><p>In XOTcl 1, it was possible to call a parameter method during object +creation via the dash-interface without a value (in the example below <code>-x</code>).</p></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># XOTcl example +</span> +<span class='nx-keyword'>Class</span> Foo -parameter {x y} +Foo f1 -x -y 1</pre></div></div> +<div class="paragraph"><p>Such cases are most likely mistakes. All parameter configurations in XOTcl 2 require an argument.</p></div> +</div> +<div class="sect3"> +<h4 id="_ignored_parameter_definitions">3.2.2. Ignored Parameter definitions</h4> +<div class="paragraph"><p>In XOTcl 1, a more specific parameter definition without a default was ignored +when a more general parameter definition with a default was +present. In the example below, the object <code>b1</code> contained in XOTcl 1 +incorrectly the parameter <code>x</code> (set via default from <code>Foo</code>), while in +XOTcl 2, the variable won’t be set.</p></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># XOTcl example +</span> +<span class='nx-keyword'>Class</span> Foo -parameter {{x 1}} +<span class='nx-keyword'>Class</span> Bar -superclass Foo -parameter x +Bar b1</pre></div></div> +</div> +<div class="sect3"> +<h4 id="_changing_classes_and_superclasses">3.2.3. Changing classes and superclasses</h4> +<div class="paragraph"><p>NX does not define the methods <code>class</code> and <code>superclass</code> (like XOTcl), but allows to +alter all object/class relations (including +class/superclass/object-mixin/…) +<code>nsf::relation::set</code>. The class and superclass can be certainly queried +in all variants with <code>info class</code> or <code>info superclasses</code>.</p></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># NX example +</span> +<span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> Foo +Foo <span class='nx-keyword'>create</span> f1 + +<span class='nx-comment'># now alter the class of object f1 +</span>nsf::relation::set f1 <span class='nx-keyword'>class</span> ::nx::Object</pre></div></div> +</div> +<div class="sect3"> +<h4 id="_overwriting_procs_methods_with_objects_and_vice_versa">3.2.4. Overwriting procs/methods with objects and vice versa</h4> +<div class="paragraph"><p>NSF is now more conservative on object/method creation. In contrary to +XOTcl 1 NSF does not allow to redefined a pre-existing command +(e.g. "set") with an object and vice versa. Like in XOTcl 1, +preexisting objects and classes con be redefined (necessary for +reloading objects/classes in an running interpreter).</p></div> +</div> +<div class="sect3"> +<h4 id="_info_heritage">3.2.5. Info heritage</h4> +<div class="paragraph"><p><code>info heritage</code> returns in XOTcl 1 the transitive superclass +hierarchy, which is equivalent with <code>info superclasses -closure</code> and +therefore not necessary. In XOTcl 2 (and NX), <code>info heritage</code> includes +as well the transitive per-class mixins.</p></div> +</div> +</div> +<div class="sect2"> +<h3 id="_slots">3.3. Slots</h3> +<div class="paragraph"><p>All slot objects (also XOTcl slot objects) are now next-scripting +objects of baseclass <code>::nx::Slot</code>. The name of the experimental +default-setter <code>initcmd</code> was changed to <code>defaultcmd</code>. Code directly +working on the slots objects has to be adapted.</p></div> +</div> +<div class="sect2"> +<h3 id="_obsolete_commands">3.4. Obsolete Commands</h3> +<div class="paragraph"><p>Parameter-classes were rarely used and have been replaced by the more +general object parametrization. Therefore, <code>cl info parameterclass</code> has +been removed.</p></div> +</div> +<div class="sect2"> +<h3 id="_stronger_checking">3.5. Stronger Checking</h3> +<div class="paragraph"><p>The Next Scripting Framework performs stronger checking than XOTcl 1 +For example, the requiredness of slots in XOTcl 1 was just a +comment, while XOTcl 2 enforces it.</p></div> +</div> +<div class="sect2"> +<h3 id="_exit_handlers">3.6. Exit Handlers</h3> +<div class="paragraph"><p>The exit hander interface changed from a method of <code>::xotcl::Object</code> +into the Tcl command <code>::nsf::exithandler</code>:</p></div> +<div class="listingblock"> +<div class="content"><style type='text/css'> +.nx {color: #000000; font-weight: normal; font-style: normal; padding-left: 10px} +table.nx {border-collapse: collapse; border-spacing: 3px;} +.nx-linenr {border-right: 1px solid #DDDDDD;padding-right: 5px; color: #2B547D;font-style: italic;} +.nx-string {color: #779977; font-weight: normal; font-style: italic;} +.nx-comment {color: #717ab3; font-weight: normal; font-style: italic;} +.nx-keyword {color: #7f0055; font-weight: normal; font-style: normal;} +.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} +.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} +</style> +<pre class='nx'><span class='nx-comment'># NX example +</span>::nsf::exithandler <span class='nx-keyword'>set</span>|get|<span class='nx-keyword'>unset</span> <span class='nx-placeholder'>?arg?</span></pre></div></div> +</div> +</div> +</div> +</div> +<div id="footnotes"><hr /></div> +<div id="footer"> +<div id="footer-text"> +Version 2.1.0<br /> +Last updated 2017-12-22 15:05:45 CET +</div> +</div> +</body> +</html>