On 21 October 2012 10:22, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Yes, something is wrong with the ObjectLiterals repository on SmalltalkHub, but I have no clue what.
I made a copy in another place
hmm.. how i can download it? when i press a link in browser it asks me for username/password?
@Dale
Of course ObjectLiteralsParser, is completely independent of any other code, that is the whole idea. And it is very small as well, it should be portable to any Smalltalk.
@Igor
The Symbol and Number syntax accepted by ObjectLiteralsParser is artificially limited right now, as it was copied from STON. As long as it is a proper subset of Smalltalk that does not strike me as a problem.
Anyway, the goal of the code is to allow for a more precise discussion.
i now modelling a system logger (to replace .changes file), and since i having no better idea, i'll try to use object literals for it. The idea is to preserve chunk format, but use object-literals for meta-information: logEntryExamples #(Method: ClassName instance "or class" 'category' 'author' (DateAndTime 'xxx') 'priorsourceId' ). #(TraitMethod: TraitName instance "or class" 'category' 'author' (DateAndTime 'xxx') 'priorsourceId' ). #(DoIt: 'author' (DateAndTime 'xxx') ). #(ClassComment: ClassName 'author' (DateAndTime 'xxx') 'priorsourceId' ). So, in log, it will look like: !#(Method: Object instance 'testing' 'Super Mario' (DateAndTime ' 2012-10-21T11:30:03.892+02:00') 'abra-ka-da-br-a' )! testSequenceIfNotEmptyDo self empty ifNotEmptyDo: [:s | self assert: false]. self assert: (self nonEmpty ifNotEmptyDo: [:s | self accessValuePutInOn: s]) = self valuePutIn ! ! Note the colon ':' in first literal. This is to prevent collision with any existing (and future) class name. As i suggested earlier, obj-literal can have name resolution logic in front of basic one - (Smalltalk at: name) and of course, there must be an extension mechanism, which can register own resolvers. I think it would be easy to extend chunk reading logic to detect that meta information stored as object-literal. Searching whole .sources file, i found only one occurrence of '!#' sequence and zero '!#(' If i do: '#( 1 2 3) yourself' in workspace, it writes: ! #(1 3 4 ) yourself! (an empty line between ! and #( ) -- Best regards, Igor Stasenko.