Is everything really a string in TCL?
And what is it, if it isn't?
Everything I've read about TCL states that everything is just a string in it. There can be some other types and structures inside of an interpreter (for performance), but at TCL language level everything must behave just like a string. Or am I wrong?
I'm using an IDE for FPGA programming called Vivado. TCL automation is actively used there. (TCL version is still 8.5, if it helps)
Vivado's TCL scripts rely on some kind of "object oriented" system. Web search doesn't show any traces of this system elsewhere.
In this system objects are usually obtained from internal database with "get_*" commands. I can manipulate properties of these objects with commands like get_property, set_property, report_property, etc.
But these objects seem to be something more than just a string.
I'll try to illustrate:
> set vcu [get_bd_cells /vcu_0]
/vcu_0
> puts "|$vcu|"
|/vcu_0|
> report_property $vcu
Property Type Read-only Value
CLASS string true bd_cell
CONFIG.AXI_DEC_BASE0 string false 0
<...>
> report_property "$vcu"
Property Type Read-only Value
CLASS string true bd_cell
CONFIG.AXI_DEC_BASE0 string false 0
<...>
But:
> report_property "/vcu_0"
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> report_property {/vcu_0}
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> report_property /vcu_0
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> puts |$vcu|
|/vcu_0|
> report_property [string range $vcu 0 end]
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
So, my question is: what exactly is this "valid first class Tcl object"?
Clarification:
This question might seem like asking for help with Vivado scripting, but it is not. (I was even in doubt about adding [vivado] to tags.)
I can just live and script with these mystic objects.
But it would be quite useful (for me, and maybe for others) to better understand their inner workings.
Is this "object system" a dirty hack? Or is it a perfectly valid TCL usage?
If it's valid, where can I read about it?
If it is a hack, how is it (or can it be) implemented? Where exactly does string end and object starts?
Related:
A part of this answer can be considered as an opinion in favor of the "hack" version, but it is quite shallow in a sense of my question.
tcl xilinx vivado
add a comment |
And what is it, if it isn't?
Everything I've read about TCL states that everything is just a string in it. There can be some other types and structures inside of an interpreter (for performance), but at TCL language level everything must behave just like a string. Or am I wrong?
I'm using an IDE for FPGA programming called Vivado. TCL automation is actively used there. (TCL version is still 8.5, if it helps)
Vivado's TCL scripts rely on some kind of "object oriented" system. Web search doesn't show any traces of this system elsewhere.
In this system objects are usually obtained from internal database with "get_*" commands. I can manipulate properties of these objects with commands like get_property, set_property, report_property, etc.
But these objects seem to be something more than just a string.
I'll try to illustrate:
> set vcu [get_bd_cells /vcu_0]
/vcu_0
> puts "|$vcu|"
|/vcu_0|
> report_property $vcu
Property Type Read-only Value
CLASS string true bd_cell
CONFIG.AXI_DEC_BASE0 string false 0
<...>
> report_property "$vcu"
Property Type Read-only Value
CLASS string true bd_cell
CONFIG.AXI_DEC_BASE0 string false 0
<...>
But:
> report_property "/vcu_0"
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> report_property {/vcu_0}
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> report_property /vcu_0
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> puts |$vcu|
|/vcu_0|
> report_property [string range $vcu 0 end]
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
So, my question is: what exactly is this "valid first class Tcl object"?
Clarification:
This question might seem like asking for help with Vivado scripting, but it is not. (I was even in doubt about adding [vivado] to tags.)
I can just live and script with these mystic objects.
But it would be quite useful (for me, and maybe for others) to better understand their inner workings.
Is this "object system" a dirty hack? Or is it a perfectly valid TCL usage?
If it's valid, where can I read about it?
If it is a hack, how is it (or can it be) implemented? Where exactly does string end and object starts?
Related:
A part of this answer can be considered as an opinion in favor of the "hack" version, but it is quite shallow in a sense of my question.
tcl xilinx vivado
Everything in Tcl is an object which by default contains a string but the object can have an internal representation which is basically just a pointer to a specific memory allocation for a known "type". You can think of it as a string to keep things simple, internally there is a specific object representation (a pointer) and a string representation.
– MoDJ
Nov 28 '18 at 21:05
add a comment |
And what is it, if it isn't?
Everything I've read about TCL states that everything is just a string in it. There can be some other types and structures inside of an interpreter (for performance), but at TCL language level everything must behave just like a string. Or am I wrong?
I'm using an IDE for FPGA programming called Vivado. TCL automation is actively used there. (TCL version is still 8.5, if it helps)
Vivado's TCL scripts rely on some kind of "object oriented" system. Web search doesn't show any traces of this system elsewhere.
In this system objects are usually obtained from internal database with "get_*" commands. I can manipulate properties of these objects with commands like get_property, set_property, report_property, etc.
But these objects seem to be something more than just a string.
I'll try to illustrate:
> set vcu [get_bd_cells /vcu_0]
/vcu_0
> puts "|$vcu|"
|/vcu_0|
> report_property $vcu
Property Type Read-only Value
CLASS string true bd_cell
CONFIG.AXI_DEC_BASE0 string false 0
<...>
> report_property "$vcu"
Property Type Read-only Value
CLASS string true bd_cell
CONFIG.AXI_DEC_BASE0 string false 0
<...>
But:
> report_property "/vcu_0"
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> report_property {/vcu_0}
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> report_property /vcu_0
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> puts |$vcu|
|/vcu_0|
> report_property [string range $vcu 0 end]
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
So, my question is: what exactly is this "valid first class Tcl object"?
Clarification:
This question might seem like asking for help with Vivado scripting, but it is not. (I was even in doubt about adding [vivado] to tags.)
I can just live and script with these mystic objects.
But it would be quite useful (for me, and maybe for others) to better understand their inner workings.
Is this "object system" a dirty hack? Or is it a perfectly valid TCL usage?
If it's valid, where can I read about it?
If it is a hack, how is it (or can it be) implemented? Where exactly does string end and object starts?
Related:
A part of this answer can be considered as an opinion in favor of the "hack" version, but it is quite shallow in a sense of my question.
tcl xilinx vivado
And what is it, if it isn't?
Everything I've read about TCL states that everything is just a string in it. There can be some other types and structures inside of an interpreter (for performance), but at TCL language level everything must behave just like a string. Or am I wrong?
I'm using an IDE for FPGA programming called Vivado. TCL automation is actively used there. (TCL version is still 8.5, if it helps)
Vivado's TCL scripts rely on some kind of "object oriented" system. Web search doesn't show any traces of this system elsewhere.
In this system objects are usually obtained from internal database with "get_*" commands. I can manipulate properties of these objects with commands like get_property, set_property, report_property, etc.
But these objects seem to be something more than just a string.
I'll try to illustrate:
> set vcu [get_bd_cells /vcu_0]
/vcu_0
> puts "|$vcu|"
|/vcu_0|
> report_property $vcu
Property Type Read-only Value
CLASS string true bd_cell
CONFIG.AXI_DEC_BASE0 string false 0
<...>
> report_property "$vcu"
Property Type Read-only Value
CLASS string true bd_cell
CONFIG.AXI_DEC_BASE0 string false 0
<...>
But:
> report_property "/vcu_0"
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> report_property {/vcu_0}
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> report_property /vcu_0
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
> puts |$vcu|
|/vcu_0|
> report_property [string range $vcu 0 end]
ERROR: [Common 17-58] '/vcu_0' is not a valid first class Tcl object.
So, my question is: what exactly is this "valid first class Tcl object"?
Clarification:
This question might seem like asking for help with Vivado scripting, but it is not. (I was even in doubt about adding [vivado] to tags.)
I can just live and script with these mystic objects.
But it would be quite useful (for me, and maybe for others) to better understand their inner workings.
Is this "object system" a dirty hack? Or is it a perfectly valid TCL usage?
If it's valid, where can I read about it?
If it is a hack, how is it (or can it be) implemented? Where exactly does string end and object starts?
Related:
A part of this answer can be considered as an opinion in favor of the "hack" version, but it is quite shallow in a sense of my question.
tcl xilinx vivado
tcl xilinx vivado
edited Nov 28 '18 at 5:09
Anatol
asked Nov 28 '18 at 5:04
AnatolAnatol
134
134
Everything in Tcl is an object which by default contains a string but the object can have an internal representation which is basically just a pointer to a specific memory allocation for a known "type". You can think of it as a string to keep things simple, internally there is a specific object representation (a pointer) and a string representation.
– MoDJ
Nov 28 '18 at 21:05
add a comment |
Everything in Tcl is an object which by default contains a string but the object can have an internal representation which is basically just a pointer to a specific memory allocation for a known "type". You can think of it as a string to keep things simple, internally there is a specific object representation (a pointer) and a string representation.
– MoDJ
Nov 28 '18 at 21:05
Everything in Tcl is an object which by default contains a string but the object can have an internal representation which is basically just a pointer to a specific memory allocation for a known "type". You can think of it as a string to keep things simple, internally there is a specific object representation (a pointer) and a string representation.
– MoDJ
Nov 28 '18 at 21:05
Everything in Tcl is an object which by default contains a string but the object can have an internal representation which is basically just a pointer to a specific memory allocation for a known "type". You can think of it as a string to keep things simple, internally there is a specific object representation (a pointer) and a string representation.
– MoDJ
Nov 28 '18 at 21:05
add a comment |
1 Answer
1
active
oldest
votes
A first class Tcl value is a sequence of characters, where those characters are drawn from the Basic Multilingual Plane of the Unicode specification. (We're going to relax that BMP restriction in a future version, but that's not yet in a version we'd recommend for use.) All other values are logically considered to be subtypes of that. For example, binary strings have the characters come from the range [U+000000, U+0000FF], and integers are ASCII digit sequences possibly preceded by a small number of prefixes (e.g., - for a negative number).
In terms of implementation, there's more going on. For example, integers are usually implemented using 64-bit binary values in the endianness that your system uses (but can be expanded to bignums when required) inside a value boxing mechanism, and the string version of the value is generated on demand and cached while the integer value doesn't change. Floating point numbers are IEEE double-precision floats. Lists are internally implemented as an array of values (with smartness for handling allocation). Dictionaries are hash tables with linked lists hanging off each of the hash buckets. And so on. THESE ARE ALL IMPLEMENTATION DETAILS! As a programmer, you can and should typically ignore them totally. What you need to know is that if two values are the same, they will have the same string, and if they have the same string, they are the same in the other interpretation. (Values with different strings can also be equal for other reasons: for example, 0xFF is numerically equal to 255 — hex vs decimal — but they are not string equal. Tcl's true natural equality is string equality.)
True mutable entities are typically represented as named objects: only the name is a Tcl value. This is how Tcl's procedures, classes, I/O system, etc. all work. You can invoke operations on them, but you can only see inside to a limited extent.
1
To follow up on what Donal's answer started:get_bd_cellstakes as its argument a cell path and returns a cell handle as a named object. The name of this handle object is a Tcl value with a string representation that matches the cell path (/vcu_0). But this name (Tcl value) is not the cell object, this is stored internally. So without requesting the handle usingget_bd_cells, a Tcl value/vcu_0just represents this literal string, there is no name binding to a cell object.
– mrcalvin
Nov 28 '18 at 16:50
Side note: The pure-value equivalent of a procedure is a lambda term. See the docs forapplyfor how that works; they currently need thatapplycommand to use.
– Donal Fellows
Nov 29 '18 at 9:41
Thanks for the strict and detailed answer! To verify that I understood correctly: Ifstring equal $vcu {/vcu_0}gives1, but*_propertycommands behave differently on$vcuand{/vcu_0}, the implementation of these commands is not completely correct (for whatever reason: bug, performance chase or else)? As this contradicts to "if they have the same string, they are the same in the other interpretation", and hence this is an abstraction leak.
– Anatol
Nov 30 '18 at 4:41
As for your "Side note" - I can't really follow the thought. I understand lambdas in general and what doesapplydo, but can't figure out how it can help here, and who are those "they" who need to use it.
– Anatol
Nov 30 '18 at 4:47
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53512478%2fis-everything-really-a-string-in-tcl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A first class Tcl value is a sequence of characters, where those characters are drawn from the Basic Multilingual Plane of the Unicode specification. (We're going to relax that BMP restriction in a future version, but that's not yet in a version we'd recommend for use.) All other values are logically considered to be subtypes of that. For example, binary strings have the characters come from the range [U+000000, U+0000FF], and integers are ASCII digit sequences possibly preceded by a small number of prefixes (e.g., - for a negative number).
In terms of implementation, there's more going on. For example, integers are usually implemented using 64-bit binary values in the endianness that your system uses (but can be expanded to bignums when required) inside a value boxing mechanism, and the string version of the value is generated on demand and cached while the integer value doesn't change. Floating point numbers are IEEE double-precision floats. Lists are internally implemented as an array of values (with smartness for handling allocation). Dictionaries are hash tables with linked lists hanging off each of the hash buckets. And so on. THESE ARE ALL IMPLEMENTATION DETAILS! As a programmer, you can and should typically ignore them totally. What you need to know is that if two values are the same, they will have the same string, and if they have the same string, they are the same in the other interpretation. (Values with different strings can also be equal for other reasons: for example, 0xFF is numerically equal to 255 — hex vs decimal — but they are not string equal. Tcl's true natural equality is string equality.)
True mutable entities are typically represented as named objects: only the name is a Tcl value. This is how Tcl's procedures, classes, I/O system, etc. all work. You can invoke operations on them, but you can only see inside to a limited extent.
1
To follow up on what Donal's answer started:get_bd_cellstakes as its argument a cell path and returns a cell handle as a named object. The name of this handle object is a Tcl value with a string representation that matches the cell path (/vcu_0). But this name (Tcl value) is not the cell object, this is stored internally. So without requesting the handle usingget_bd_cells, a Tcl value/vcu_0just represents this literal string, there is no name binding to a cell object.
– mrcalvin
Nov 28 '18 at 16:50
Side note: The pure-value equivalent of a procedure is a lambda term. See the docs forapplyfor how that works; they currently need thatapplycommand to use.
– Donal Fellows
Nov 29 '18 at 9:41
Thanks for the strict and detailed answer! To verify that I understood correctly: Ifstring equal $vcu {/vcu_0}gives1, but*_propertycommands behave differently on$vcuand{/vcu_0}, the implementation of these commands is not completely correct (for whatever reason: bug, performance chase or else)? As this contradicts to "if they have the same string, they are the same in the other interpretation", and hence this is an abstraction leak.
– Anatol
Nov 30 '18 at 4:41
As for your "Side note" - I can't really follow the thought. I understand lambdas in general and what doesapplydo, but can't figure out how it can help here, and who are those "they" who need to use it.
– Anatol
Nov 30 '18 at 4:47
add a comment |
A first class Tcl value is a sequence of characters, where those characters are drawn from the Basic Multilingual Plane of the Unicode specification. (We're going to relax that BMP restriction in a future version, but that's not yet in a version we'd recommend for use.) All other values are logically considered to be subtypes of that. For example, binary strings have the characters come from the range [U+000000, U+0000FF], and integers are ASCII digit sequences possibly preceded by a small number of prefixes (e.g., - for a negative number).
In terms of implementation, there's more going on. For example, integers are usually implemented using 64-bit binary values in the endianness that your system uses (but can be expanded to bignums when required) inside a value boxing mechanism, and the string version of the value is generated on demand and cached while the integer value doesn't change. Floating point numbers are IEEE double-precision floats. Lists are internally implemented as an array of values (with smartness for handling allocation). Dictionaries are hash tables with linked lists hanging off each of the hash buckets. And so on. THESE ARE ALL IMPLEMENTATION DETAILS! As a programmer, you can and should typically ignore them totally. What you need to know is that if two values are the same, they will have the same string, and if they have the same string, they are the same in the other interpretation. (Values with different strings can also be equal for other reasons: for example, 0xFF is numerically equal to 255 — hex vs decimal — but they are not string equal. Tcl's true natural equality is string equality.)
True mutable entities are typically represented as named objects: only the name is a Tcl value. This is how Tcl's procedures, classes, I/O system, etc. all work. You can invoke operations on them, but you can only see inside to a limited extent.
1
To follow up on what Donal's answer started:get_bd_cellstakes as its argument a cell path and returns a cell handle as a named object. The name of this handle object is a Tcl value with a string representation that matches the cell path (/vcu_0). But this name (Tcl value) is not the cell object, this is stored internally. So without requesting the handle usingget_bd_cells, a Tcl value/vcu_0just represents this literal string, there is no name binding to a cell object.
– mrcalvin
Nov 28 '18 at 16:50
Side note: The pure-value equivalent of a procedure is a lambda term. See the docs forapplyfor how that works; they currently need thatapplycommand to use.
– Donal Fellows
Nov 29 '18 at 9:41
Thanks for the strict and detailed answer! To verify that I understood correctly: Ifstring equal $vcu {/vcu_0}gives1, but*_propertycommands behave differently on$vcuand{/vcu_0}, the implementation of these commands is not completely correct (for whatever reason: bug, performance chase or else)? As this contradicts to "if they have the same string, they are the same in the other interpretation", and hence this is an abstraction leak.
– Anatol
Nov 30 '18 at 4:41
As for your "Side note" - I can't really follow the thought. I understand lambdas in general and what doesapplydo, but can't figure out how it can help here, and who are those "they" who need to use it.
– Anatol
Nov 30 '18 at 4:47
add a comment |
A first class Tcl value is a sequence of characters, where those characters are drawn from the Basic Multilingual Plane of the Unicode specification. (We're going to relax that BMP restriction in a future version, but that's not yet in a version we'd recommend for use.) All other values are logically considered to be subtypes of that. For example, binary strings have the characters come from the range [U+000000, U+0000FF], and integers are ASCII digit sequences possibly preceded by a small number of prefixes (e.g., - for a negative number).
In terms of implementation, there's more going on. For example, integers are usually implemented using 64-bit binary values in the endianness that your system uses (but can be expanded to bignums when required) inside a value boxing mechanism, and the string version of the value is generated on demand and cached while the integer value doesn't change. Floating point numbers are IEEE double-precision floats. Lists are internally implemented as an array of values (with smartness for handling allocation). Dictionaries are hash tables with linked lists hanging off each of the hash buckets. And so on. THESE ARE ALL IMPLEMENTATION DETAILS! As a programmer, you can and should typically ignore them totally. What you need to know is that if two values are the same, they will have the same string, and if they have the same string, they are the same in the other interpretation. (Values with different strings can also be equal for other reasons: for example, 0xFF is numerically equal to 255 — hex vs decimal — but they are not string equal. Tcl's true natural equality is string equality.)
True mutable entities are typically represented as named objects: only the name is a Tcl value. This is how Tcl's procedures, classes, I/O system, etc. all work. You can invoke operations on them, but you can only see inside to a limited extent.
A first class Tcl value is a sequence of characters, where those characters are drawn from the Basic Multilingual Plane of the Unicode specification. (We're going to relax that BMP restriction in a future version, but that's not yet in a version we'd recommend for use.) All other values are logically considered to be subtypes of that. For example, binary strings have the characters come from the range [U+000000, U+0000FF], and integers are ASCII digit sequences possibly preceded by a small number of prefixes (e.g., - for a negative number).
In terms of implementation, there's more going on. For example, integers are usually implemented using 64-bit binary values in the endianness that your system uses (but can be expanded to bignums when required) inside a value boxing mechanism, and the string version of the value is generated on demand and cached while the integer value doesn't change. Floating point numbers are IEEE double-precision floats. Lists are internally implemented as an array of values (with smartness for handling allocation). Dictionaries are hash tables with linked lists hanging off each of the hash buckets. And so on. THESE ARE ALL IMPLEMENTATION DETAILS! As a programmer, you can and should typically ignore them totally. What you need to know is that if two values are the same, they will have the same string, and if they have the same string, they are the same in the other interpretation. (Values with different strings can also be equal for other reasons: for example, 0xFF is numerically equal to 255 — hex vs decimal — but they are not string equal. Tcl's true natural equality is string equality.)
True mutable entities are typically represented as named objects: only the name is a Tcl value. This is how Tcl's procedures, classes, I/O system, etc. all work. You can invoke operations on them, but you can only see inside to a limited extent.
answered Nov 28 '18 at 15:40
Donal FellowsDonal Fellows
103k15113176
103k15113176
1
To follow up on what Donal's answer started:get_bd_cellstakes as its argument a cell path and returns a cell handle as a named object. The name of this handle object is a Tcl value with a string representation that matches the cell path (/vcu_0). But this name (Tcl value) is not the cell object, this is stored internally. So without requesting the handle usingget_bd_cells, a Tcl value/vcu_0just represents this literal string, there is no name binding to a cell object.
– mrcalvin
Nov 28 '18 at 16:50
Side note: The pure-value equivalent of a procedure is a lambda term. See the docs forapplyfor how that works; they currently need thatapplycommand to use.
– Donal Fellows
Nov 29 '18 at 9:41
Thanks for the strict and detailed answer! To verify that I understood correctly: Ifstring equal $vcu {/vcu_0}gives1, but*_propertycommands behave differently on$vcuand{/vcu_0}, the implementation of these commands is not completely correct (for whatever reason: bug, performance chase or else)? As this contradicts to "if they have the same string, they are the same in the other interpretation", and hence this is an abstraction leak.
– Anatol
Nov 30 '18 at 4:41
As for your "Side note" - I can't really follow the thought. I understand lambdas in general and what doesapplydo, but can't figure out how it can help here, and who are those "they" who need to use it.
– Anatol
Nov 30 '18 at 4:47
add a comment |
1
To follow up on what Donal's answer started:get_bd_cellstakes as its argument a cell path and returns a cell handle as a named object. The name of this handle object is a Tcl value with a string representation that matches the cell path (/vcu_0). But this name (Tcl value) is not the cell object, this is stored internally. So without requesting the handle usingget_bd_cells, a Tcl value/vcu_0just represents this literal string, there is no name binding to a cell object.
– mrcalvin
Nov 28 '18 at 16:50
Side note: The pure-value equivalent of a procedure is a lambda term. See the docs forapplyfor how that works; they currently need thatapplycommand to use.
– Donal Fellows
Nov 29 '18 at 9:41
Thanks for the strict and detailed answer! To verify that I understood correctly: Ifstring equal $vcu {/vcu_0}gives1, but*_propertycommands behave differently on$vcuand{/vcu_0}, the implementation of these commands is not completely correct (for whatever reason: bug, performance chase or else)? As this contradicts to "if they have the same string, they are the same in the other interpretation", and hence this is an abstraction leak.
– Anatol
Nov 30 '18 at 4:41
As for your "Side note" - I can't really follow the thought. I understand lambdas in general and what doesapplydo, but can't figure out how it can help here, and who are those "they" who need to use it.
– Anatol
Nov 30 '18 at 4:47
1
1
To follow up on what Donal's answer started:
get_bd_cells takes as its argument a cell path and returns a cell handle as a named object. The name of this handle object is a Tcl value with a string representation that matches the cell path (/vcu_0). But this name (Tcl value) is not the cell object, this is stored internally. So without requesting the handle using get_bd_cells, a Tcl value /vcu_0 just represents this literal string, there is no name binding to a cell object.– mrcalvin
Nov 28 '18 at 16:50
To follow up on what Donal's answer started:
get_bd_cells takes as its argument a cell path and returns a cell handle as a named object. The name of this handle object is a Tcl value with a string representation that matches the cell path (/vcu_0). But this name (Tcl value) is not the cell object, this is stored internally. So without requesting the handle using get_bd_cells, a Tcl value /vcu_0 just represents this literal string, there is no name binding to a cell object.– mrcalvin
Nov 28 '18 at 16:50
Side note: The pure-value equivalent of a procedure is a lambda term. See the docs for
apply for how that works; they currently need that apply command to use.– Donal Fellows
Nov 29 '18 at 9:41
Side note: The pure-value equivalent of a procedure is a lambda term. See the docs for
apply for how that works; they currently need that apply command to use.– Donal Fellows
Nov 29 '18 at 9:41
Thanks for the strict and detailed answer! To verify that I understood correctly: If
string equal $vcu {/vcu_0} gives 1, but *_property commands behave differently on $vcu and {/vcu_0}, the implementation of these commands is not completely correct (for whatever reason: bug, performance chase or else)? As this contradicts to "if they have the same string, they are the same in the other interpretation", and hence this is an abstraction leak.– Anatol
Nov 30 '18 at 4:41
Thanks for the strict and detailed answer! To verify that I understood correctly: If
string equal $vcu {/vcu_0} gives 1, but *_property commands behave differently on $vcu and {/vcu_0}, the implementation of these commands is not completely correct (for whatever reason: bug, performance chase or else)? As this contradicts to "if they have the same string, they are the same in the other interpretation", and hence this is an abstraction leak.– Anatol
Nov 30 '18 at 4:41
As for your "Side note" - I can't really follow the thought. I understand lambdas in general and what does
apply do, but can't figure out how it can help here, and who are those "they" who need to use it.– Anatol
Nov 30 '18 at 4:47
As for your "Side note" - I can't really follow the thought. I understand lambdas in general and what does
apply do, but can't figure out how it can help here, and who are those "they" who need to use it.– Anatol
Nov 30 '18 at 4:47
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53512478%2fis-everything-really-a-string-in-tcl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Everything in Tcl is an object which by default contains a string but the object can have an internal representation which is basically just a pointer to a specific memory allocation for a known "type". You can think of it as a string to keep things simple, internally there is a specific object representation (a pointer) and a string representation.
– MoDJ
Nov 28 '18 at 21:05