[squeak-dev] DynamicObjects

Robert robert.withers at pm.me
Mon Apr 20 21:04:09 UTC 2020


Yalp! Sure, already have what I need, right?

So define:

ASN1Value subclass: #ASN1DomainObject
    instanceVariableNames: 'className'
    classVariableNames: ''
    poolDictionaries: ''
    category: 'CryptographyASN1-Objects'

Then whenever we have an unknown object to write or reading in the same, output in ASN1 a class structure, with className (let us say #SessionConfig and instance variables:  '

> - selectedCipherName
> - selectedEncoderName
> - cryptoCiphers
> - dataEncoders
> - protocolMap
> - preferredProtocol '

So using ASN1WrapperConstructedType or ASN1ExplicitContextValue,

ASN1WrapperType subclass: #ASN1WrapperConstructedType
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''
    category: 'CryptographyASN1-Types'

Dynamically create a subclass of ASN1DomainObject, with the right ivars (className in the superclass) and accessors:

ASN1DomainObject subclass: #ASN1DOSessionConfig
    instanceVariableNames: 'selectedCipherName selectedEncoderName cryptoCiphers dataEncoders protocolMap preferredProtocol'
    classVariableNames: ''
    poolDictionaries: ''
    category: 'CryptographyASN1-Types'

Thus we dynamically defined a domain object class for the unknown #SessionConfig structure. This meets the needs of A, B & C.

K, r

On 4/20/20 4:10 PM, tim Rowledge wrote:

>> On 2020-04-20, at 2:03 AM, Marcel Taeumel
>> [<marcel.taeumel at hpi.de>](mailto:marcel.taeumel at hpi.de)
>> wrote:
>>
>> Uhh! This feels like JavaScript ... :o) I would rather work on improving Squeak's meta-object protocol and with it class construction and refinement. Especially for tests. Let's not undermine the idea of having classes in Smalltalk.
>>
>> -1 for DynamicObject.
>>
>> Objects in Squeak/Smalltalk are quite dynamic already. That name is misleading. :-)
>
> I agree.
>
> tim
> --
> tim Rowledge;
> tim at rowledge.org
> ;
> http://www.rowledge.org/tim
> CChheecckk yyoouurr dduupplleexx sswwiittcchh..

--
Kindly,
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200420/6577ffc7/attachment.html>


More information about the Squeak-dev mailing list