starting to rename to rubyx

This commit is contained in:
Torsten Ruger
2017-01-02 00:29:20 +02:00
parent 0397d4064d
commit 1647b746ea
11 changed files with 41 additions and 38 deletions

View File

@ -1,7 +1,7 @@
# Code Style and Conventions
Just few things that have become important enough to write down. Apart from what is written here
standard blah applies (ie RoboCop stuff).
standard blah applies (ie RoboCop/Reek stuff).
## Formatting
@ -9,6 +9,12 @@ standard blah applies (ie RoboCop stuff).
While the days of 80 are over, too big steps seems difficult. I've settled on 100 (ish)
### Brackets
While ruby allows the ommision of brackets even with arguments, i try to avoid that because
of readablity. There may be an exception for an assignment, a single call with a single arg.
Brackets without arguments look funny though.
### Hash
I still prefer 1.9 => style , it makes the association more obvious.
@ -25,13 +31,8 @@ the code reads much nicer when they are on the module.
### Code generators
Since code is represented by instances of Instructions (and subclasses) the most straightforward
way of generating code is by new of the Class. This is ok for some.
But often one finds a little massaging of the incoming data is better, while keeping that logic
out of the Instructions classes. In such cases Module functions are again quite nice. Example:
Instead of SlotToReg.new( register, index , register) we use Register.slot_to_reg( name , name , name).
All names are resolved to registers, or index via Type. More readable code less repetition.
As the example shows, in this case the module function name should be the instruction class name.
Singletons should hang off the module (not the class), eg Parfait.object_space