[Cuis] Strategy for porting packages (was Re: CSV Parser in Cuis?)

H. Hirzel hannes.hirzel at gmail.com
Sat May 9 11:49:07 CDT 2015


On 5/9/15, Juan Vuletich <juan at jvuletich.org> wrote:
> Well, this issue es pretty likely to happen when porting packages. There
> are (that I see) 3 alternatives:
>
> 1) Add missing methods/classes to Cuis
> 2) Add missing methods/classes to SqueakCompatibility.pck.st (also
> suitable for compatibility with Pharo)
> 3) Modify the package to use existing facilities
>
> There are no rules written in stone, and I think we need to decide in
> each case.
>
> For example, when the missing stuff is the kind of extra complexity we
> don't want in Cuis, or we don't want it for any reason, this precludes
> 1). But if the missing stuff fits nicely into Cuis, then the appropriate
> choice is 1)
>
> If who's doing the port is also adopting the code, because (s)he wants
> to do so, or is very interested in it, or is going to further develop
> it, then 3) is a reasonable choice. But if the original version of the
> package is under heavy development, and we are not really adopting it,
> then 3) is not a good option. For instance, these days I ported VMMaker
> to Cuis (will publish it this weekend). VMMaker is very complex, and is
> in active development by dedicated and knowledgeable people. So, 3) is
> out of the question. But it uses many things that don't fit Cuis, some
> for purely aesthetic reasons, others because full compatibility would
> turn Cuis again into Squeak. So I added quite several things to
> SqueakCompatibility.pck.st, option 2). This made it possible to run
> VMMaker in Cuis (without the GUI), without modifying a single line of
> code and without Undeclared. Rebasing on future releases of VMMaker will
> not be a problem at all.
>
> And this needs to be thought for each class or method missing. When
> porting a package, maybe we choose 1) for some methods and 2) for
> others. Or even yet 3) for others, if we are adopting the code.
>
> So, in this case, Hannes, please suggest, and lets discuss from there.

Thank you for outlining the porting strategy alternatives. To answer
your question about porting the Neo-CSV package from Pharo I'll have
to do more investigations for this particular case.

For example the testing code uses besides join: (for Strings) a Pharo
4.0 method

Object>assert: aBlock description: aStringOrBlock
	"Throw an assertion error if aBlock does not evaluates to true."

--Hannes

>
> Cheers,
> Juan Vuletich
>
> On 09/05/2015 11:58 a.m., H. Hirzel wrote:
>> Or put the question another way: Would it be fine to have a #join
>> function is Cuis.
>> Alternatively I can construct a test helper function which constructs
>> the test data.
>>
>>
>>
>>
>>
>> On 5/9/15, H. Hirzel<hannes.hirzel at gmail.com>  wrote:
>>> Here is the result of a first step of porting
>>>
>>> https://github.com/hhzl/Cuis-NeoCSV
>>>
>>> 48 out of 50 tests have an error. This is mainly because of the way
>>> the test data is constructed.
>>>
>>> input := (String crlf join: #( '"x","y","z"' '100,200,300'
>>> '100,200,300' '100,200,300' '')).
>>>
>>>
>>> #crlf of Pharo 4.0 may be replaced with #crlfString of Cuis, see below
>>>
>>> But Cuis does not have #SequencableCollection>>join
>>>
>>>
>>> What are your suggestions how to proceed? It is about construction of
>>> test
>>> data.
>>>
>>>
>>> --Hannes
>>>
>>>
>>>
>>> Pharo
>>> crlf
>>> 	"Answer a string containing a carriage return and a linefeed."
>>>
>>> 	^ self with: Character cr with: Character lf
>>>
>>>
>>> Cuis
>>>
>>> crlfString
>>> 	"Answer a string containing a carriage return and a linefeed."
>>>
>>> 	^ self with: Character cr with: Character lf
>>>
>>>
>>>
>>> Pharo class #SequencableCollection
>>>
>>> join: aCollection
>>> 	"NB: this implementation only works for Array, since WriteStreams
>>> only work for Arrays and Strings. (!)
>>> 	Overridden in OrderedCollection and SortedCollection."
>>> 	^ self class
>>> 		streamContents: [:stream | aCollection
>>> 				do: [:each | each joinTo: stream]
>>> 				separatedBy: [stream nextPutAll: self]]
>>>
>>>
>>>
>>>
>>>
>>> On 5/9/15, H. Hirzel<hannes.hirzel at gmail.com>  wrote:
>>>> I understand that I need to click 'Install' in the file browser to get
>>>> a separate ChangeSet object.
>>>>
>>>> https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev/blob/master/Documentation/CodeManagementInCuis.md#loading-changeset-files-into-cuis
>>>>
>>>>
>>>> And it that works well and after some fixes. I do in the Package tool
>>>>      'Create Package'
>>>>
>>>> https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev/blob/master/Documentation/CodeManagementInCuis.md#packages
>>>>
>>>> --Hannes
>>>>
>>>> On 5/9/15, H. Hirzel<hannes.hirzel at gmail.com>  wrote:
>>>>> And it comes with documentation
>>>>>
>>>>> https://github.com/svenvc/docs/blob/master/neo/neo-csv-paper.md
>>>>>
>>>>> "CSV is a lightweight text-based de facto standard for human-readable
>>>>> tabular data interchange."
>>>>>
>>>>> On 5/9/15, H. Hirzel<hannes.hirzel at gmail.com>  wrote:
>>>>>> Yes, I assume so as well. Thank you for the note about line
>>>>>> terminators.
>>>>>>
>>>>>> There is also the Pharo Neo-CSV parser which comes with many tests.
>>>>>>
>>>>>> https://github.com/svenvc/NeoCVS
>>>>>>
>>>>>> It is probably easier to take a Pharo 4.0 image, load NeoCSV in one
>>>>>> click and file out the class categories
>>>>>>
>>>>>> Neo-CSV-Core
>>>>>> Neo-CSV-Tests
>>>>>>
>>>>>> --Hannes
>>>>>>
>>>>>> On 5/9/15, Juan Vuletich<juan at jvuletich.org>  wrote:
>>>>>>> Porting any of them shouldn't be hard. You need, as usual, to take
>>>>>>> into
>>>>>>> account that Squeak and Pharo uses #cr as line terminator, while
>>>>>>> Cuis
>>>>>>> uses #lf.
>>>>>>>
>>>>>>> In any case, check ExtendedClipboard.pck.st, and maybe extend it.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Juan Vuletich
>>>>>>>
>>>>>>> On 09/05/2015 06:32 a.m., H. Hirzel wrote:
>>>>>>>> P.S: I'd like the input to come from the clipboard. This is
>>>>>>>>
>>>>>>>> 1. Select a range of cells in a spreadsheet (MSExcel / Libreoffice
>>>>>>>> calc)
>>>>>>>> 2. Copy to clipboard
>>>>>>>> 3. Bring the Cuis window to the front
>>>>>>>> 4. Press a 'paste data from Excel' button
>>>>>>>>
>>>>>>>> In Cuis some processing will be done and the result will be put
>>>>>>>> back
>>>>>>>> into the clipboard
>>>>>>>>
>>>>>>>>
>>>>>>>> On 5/9/15, H. Hirzel<hannes.hirzel at gmail.com>   wrote:
>>>>>>>>> Dear all
>>>>>>>>>
>>>>>>>>> has anyone written or ported a CSV parser to Cuis?
>>>>>>>>>
>>>>>>>>> For example this one
>>>>>>>>>
>>>>>>>>> http://www.squeaksource.com/@BiTWvEAxOgxLE9wJ/T0wdhSm3
>>>>>>>>>
>>>>>>>>> Description: A simple parser for comma-separated-value files.
>>>>>>>>> Creator:	Avi Bryant
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>>
>>>>>>>>> Hannes Hirzel
>>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Cuis mailing list
>>>>>>>> Cuis at jvuletich.org
>>>>>>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>>>>>>>
>>>>>>>
>
>




More information about the Cuis mailing list