Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
ego_script [2026/08/07 03:51]
hermann
ego_script [2026/08/18 02:37] (current)
hermann
Line 104: Line 104:
 </​code>​ </​code>​
  
-For ''​String''​ ports that contain line breaks or double-quote characters, use the extended form ''​$"​DELIMITER(content)DELIMITER"''​. The content is everything between the opening ''​(''​ and the closing ''​)'',​ and the DELIMITER — any sequence of characters placed between the ''​%%"​%%''​ and the ''​('',​ including empty — makes the closing ''​)"''​ unambiguous. The delimiter must be identical on both sides. ​This extended form is **only accepted by ''​String''​ ports**:+[[code_type|Code]] ports also accept this basic ''"​text"''​ form, but interpret it differently from the types above: rather than validating the text itself, the content is decoded as base64 to produce the script — see the note below. 
 + 
 +For ''​String''​ ports that contain line breaks or double-quote characters, use the extended form ''​$"​DELIMITER(content)DELIMITER"''​. The content is everything between the opening ''​(''​ and the closing ''​)'',​ and the DELIMITER — any sequence of characters placed between the ''​%%"​%%''​ and the ''​('',​ including empty — makes the closing ''​)"''​ unambiguous. The delimiter must be identical on both sides. ​[[code_type|Code]] ports accept this same extended form directly too, using the content as the literal script text with no encoding involved — see [[code_type|Code Type]] for the full grammar. No other port type accepts it:
  
 <​code>​ <​code>​
Line 156: Line 158:
 Here ''​[ 2->1 0.05 ]''​ is a structured constant representing a transition matrix with a 5% rate from class 2 to class 1. Here ''​[ 2->1 0.05 ]''​ is a structured constant representing a transition matrix with a 5% rate from class 2 to class 1.
  
-> **Note:​** ​''​Code'' ​— the type used for expression inputs such as the Python code in [[Calculate Python Expression]] — is not a text constant. Code values are stored as base64 in the underlying scriptmaking them impractical to write directly. When port expects a ''​Code''​ valuesupply a ''​String'' ​carrier functor containing ​the expression ​text; the automatic ​''​String → Code'' ​conversion handles ​the rest.+> **Note:​** ​[[code_type|Code]] — the type used for expression inputs such as the Python code in [[calculate_python_expression|Calculate Python Expression]] — has its own literal syntaxparsed ​directly ​rather than through ​conversionand accepts two forms: the extended ​''​$"​DELIMITER(content)DELIMITER"​'' ​form described above, taken directly as the script'​s ​text with no encoding involvedand the basic double-quoted ​''​"​text"​'' ​form, whose content is instead decoded as base64 to produce the script. See [[code_type|Code Type]] for the full grammar and examples of both forms.
  
 ==== Positional syntax ==== ==== Positional syntax ====