While checking some packaging today, I noticed that the Kernel package is dirty because Mondrian seems to override ClassDescription>>numberOfLinesOfCode
Kernel implementation: numberOfLinesOfCode "Return the number of lines of code" | str | str := String new writeStream. Object fileOutOn: str. ^ str contents lineCount Mondrian impl: numberOfLinesOfCode ^ self methods inject: 5 into: [ :sum :compiledMethod | (compiledMethod propertyValueAt: #numberOfLinesOfCode) ifNil: [ compiledMethod propertyValueAt: #numberOfLinesOfCode put: compiledMethod getSource lineCount ]. sum + (compiledMethod propertyValueAt: #numberOfLinesOfCode) ] I am not sure I understand the purpose of the override. Caching? Why is there a 'self methods inject: 5' at the beginning? And, do we absolutely need this override? :) -- Simon _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi Simon,
> While checking some packaging today, I noticed that the Kernel package is dirty because Mondrian seems to override ClassDescription>>numberOfLinesOfCode I added ClassDescription>>numberOfLinesOfCode because there was not such support in Pharo. Apparently, there is one. The Mondrian implementation of numberOfLinesOfCode can be safely removed. > Mondrian impl: > numberOfLinesOfCode > ^ self methods inject: 5 into: [ :sum :compiledMethod | > (compiledMethod propertyValueAt: #numberOfLinesOfCode) > ifNil: [ compiledMethod > propertyValueAt: #numberOfLinesOfCode > put: compiledMethod getSource lineCount ]. > sum + (compiledMethod propertyValueAt: #numberOfLinesOfCode) ] > > > I am not sure I understand the purpose of the override. Caching? Why is there a 'self methods inject: 5' at the beginning? Because a class definition has 5 lines of code. > And, do we absolutely need this override? :) Before it was just a non-overriden extension. It has changed now. I committed Mondrian-AlexandreBergel.592 Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
>> I am not sure I understand the purpose of the override. Caching? Why is there a 'self methods inject: 5' at the beginning?
> > Because a class definition has 5 lines of code. My class definitions has 4 lines, or 5 lines this is a subclass of ProtoObject, or 6 lines if this is a subclass of ProtoObject with a trait definition, or 2 lines if this is a class-side definition, ... Why not use self definition lineCount ? This returns the actual line number and is also more intention revealing. Lukas > >> And, do we absolutely need this override? :) > > Before it was just a non-overriden extension. It has changed now. > > I committed Mondrian-AlexandreBergel.592 > > Alexandre > > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Sure...
Alexandre On 14 Oct 2010, at 14:41, Lukas Renggli wrote: >>> I am not sure I understand the purpose of the override. Caching? Why is there a 'self methods inject: 5' at the beginning? >> >> Because a class definition has 5 lines of code. > > My class definitions has 4 lines, or 5 lines this is a subclass of > ProtoObject, or 6 lines if this is a subclass of ProtoObject with a > trait definition, or 2 lines if this is a class-side definition, ... > > Why not use > > self definition lineCount > > ? > > This returns the actual line number and is also more intention revealing. > > Lukas > >> >>> And, do we absolutely need this override? :) >> >> Before it was just a non-overriden extension. It has changed now. >> >> I committed Mondrian-AlexandreBergel.592 >> >> Alexandre >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> >> >> _______________________________________________ >> Moose-dev mailing list >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev >> > > > > -- > Lukas Renggli > www.lukas-renggli.ch > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |