UnitedLexCorp / SimpleTalk

An implementation of HyperTalk in Ohm-js
Apache License 2.0
7 stars 1 forks source link

Setting properties of a Part results in HyperTalk compilation errors #9

Closed darth-cheney closed 3 years ago

darth-cheney commented 4 years ago

When setting a non-script property of a Part, errors about HyperTalk compilation/semantics are being thrown. This doesn't make sense, since any property that is not a script property shouldn't have anything to do with the compilation process.

This is on the daniel-messaging branch.

Here is an example, which you can enter into the console after serving and loading the message-example.html file (remember to npm run build-dev before serving):

var currentCard = document.querySelector('st-card.current-card').model;
var newBtnMsg = { type: 'newModel', modelType: 'button', owner: currentCard };
currentCard.sendMessage(newBtnMsg, System);
var buttonModel = document.querySelector('st-button').model;
buttonModel.partProperties.setPropertyNamed(buttonModel, 'name', 'click me');

You should see that an error pops up (make sure in your browser debugger sources tab that you are breaking on errors/exceptions). It appears to have something to do with compilation/semantics.

ApproximateIdentity commented 3 years ago

Is this still an issue @darth-cheney ? If I run the first three lines of your example I get the following error, but I'm not sure if this is the same error you were getting before (given the age of this issue...):

>> var currentCard = document.querySelector('st-card.current-card').model;
undefined
>> var newBtnMsg = { type: 'newModel', modelType: 'button', owner: currentCard };
undefined
>> currentCard.sendMessage(newBtnMsg, System);
failed to postMessage to devtool: System.js:216
Array(3) [ {…}, (2) […], (2) […] ]
System.js:217
Uncaught Error: System does not understand message newModel
    doesNotUnderstand System.js:255
    receiveMessage System.js:240
    sendMessage System.js:221
    sendMessage Part.js:221
    <anonymous> debugger eval code:1
darth-cheney commented 3 years ago

Yes this is super old and was addressed a long time ago.