Post Reply 
self modifying code
04-04-2019, 06:40 PM
Post: #1
self modifying code
It occurred to me today that self modifying code is easily done in PPL. Save the following program as HiBye and run it a few times from Home.

Code:
EXPORT HiBye()
BEGIN
 LOCAL source;
 
 source:=Programs("HiBye");
 IF INSTRING(source,"He"+"llo") THEN
  source:=REPLACE(source,"He"+"llo","Good"+"bye");
 ELSE
  source:=REPLACE(source,"Good"+"bye","He"+"llo");
 END;
 Programs("HiBye"):=source;
 RETURN "Hello";
END;


hee hee.
Find all posts by this user
Quote this message in a reply
04-04-2019, 10:43 PM
Post: #2
RE: self modifying code
Editing programs with Programs("name") is wonderful until you hit the limit of 65,535 characters for the string type.

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
04-05-2019, 12:14 PM
Post: #3
RE: self modifying code
With Programs():=string, is the program compiled at save time or upon first run time?
Find all posts by this user
Quote this message in a reply
04-05-2019, 01:02 PM
Post: #4
RE: self modifying code
Programs():=string compiles during execution, that is why you can even abort the execution if you find a difference relevant to the previous code. This instruction it returns 1 if compiled correctly and 0 if there are syntax errors.

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)