SeasideSt / Seaside

The framework for developing sophisticated web applications in Smalltalk.
MIT License
519 stars 71 forks source link

Implementations of #asJson in Seaside and GToolkit conflict #1433

Closed Rinzwind closed 4 months ago

Rinzwind commented 4 months ago

There are conflicting implementations of #asJson in Seaside and Glamorous Toolkit. Using Glamorous Toolkit v1.0.975, the test in the following fails:

Metacello new
    baseline: 'Seaside3';
    repository: 'github://SeasideSt/Seaside:d90609cfd7005f52/repository';
    load: 'Tests'.
(Smalltalk at: #WAJsonStreamTest) debug: #testArray

This is because #asJson doesn’t answer a String but a GtJson:

#(1 2 3) asJson "=> a GtJson(root)"

marschall commented 4 months ago

Interesting. Does GT also define #jsonOn:?

Rinzwind commented 4 months ago

There are no implementors of #jsonOn: in Glamorous Toolkit v1.0.975.

To get a String with JSON from a GtJson, it can be sent #asJsonString. The classes implementing #asJsonString are GtJsonBasic, GtJsonModel and YAMLParseNode, so sending the message to an Array causes a MessageNotUnderstood to be signaled, leaving a rename of Seaside’s #asJson to #asJsonString as one option to avoid the conflict.

Rinzwind commented 4 months ago

GToolkit’s #asJson has been deprecated in GToolkit issue #3895.

Rinzwind commented 4 months ago

I’ll close this. As noted in GToolkit issue #3895, the conflict remains as long as the deprecated methods remain in GToolkit. The workaround is to just remove them, see commit c0e63ad95c84ae45.