The Trunk: Tools-mt.815.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-mt.815.mcz

commits-2
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.815.mcz

==================== Summary ====================

Name: Tools-mt.815
Author: mt
Time: 24 May 2018, 10:49:38.933621 am
UUID: d4418382-5b3a-b74d-ac4c-a16f2306827d
Ancestors: Tools-tpr.814

Avoid unnecessary tabs or linebreaks when creating accessors.

=============== Diff against Tools-tpr.814 ===============

Item was changed:
  ----- Method: Behavior>>createGetterFor: (in category '*Tools-Browser-accessors') -----
  createGetterFor: aName
 
  | code |
+ code := '{1}\\ ^ {1}' withCRs format: {aName}.
- code := '{1}\ \ ^ {1}\' withCRs format: {aName.}.
  self compile: code classified: #accessing notifying: nil.!

Item was changed:
  ----- Method: Behavior>>createSetterFor: (in category '*Tools-Browser-accessors') -----
  createSetterFor: aName
 
  | code |
+ code := '{1}: anObject\\ {2}{1} := anObject.' withCRs
+ format: {aName. self settersReturnValue ifTrue: ['^ '] ifFalse: ['']}.
- code := '{1}: anObject\ \ {2}{1} := anObject.\' withCRs
- format: {aName. self settersReturnValue ifTrue: ['^ '] ifFalse: [''].}.
  self compile: code classified: #accessing notifying: nil.!

Item was changed:
  ----- Method: Behavior>>settersReturnValue (in category '*Tools-Browser-accessors') -----
  settersReturnValue
  "Determine whether the browser's createInstVarAccessors code will generate
  setters that answer self (the default here) or the value set.  Classes that want
  to answer the value set (e.g. VMStructType) override."
+
+ ^ false!
- ^false!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-mt.815.mcz

Chris Muller-3
May I recommend not having ANY blank lines in these or any methods
anywhere?  Especially methods where there is also a variable
declaration, since that puts the most-consumed part of the method text
not starting until the fourth line down.

Syntax highlighting provides the necessary visual delineations, we
don't need blank lines for that anymore.  I think blank lines make
methods harder to read, because it turns them from "single, concise,
chunks of code" into these lengthy scrolls of prose seemingly wanting
to be broken up into separate methods anyway.  If code needs a blank
line, it could probably just as well use a one-line comment there
instead, but even better than in a lot of cases would be to extract a
separate method instead with intention-revealing selector of a
comment.



On Thu, May 24, 2018 at 3:49 AM,  <[hidden email]> wrote:

> Marcel Taeumel uploaded a new version of Tools to project The Trunk:
> http://source.squeak.org/trunk/Tools-mt.815.mcz
>
> ==================== Summary ====================
>
> Name: Tools-mt.815
> Author: mt
> Time: 24 May 2018, 10:49:38.933621 am
> UUID: d4418382-5b3a-b74d-ac4c-a16f2306827d
> Ancestors: Tools-tpr.814
>
> Avoid unnecessary tabs or linebreaks when creating accessors.
>
> =============== Diff against Tools-tpr.814 ===============
>
> Item was changed:
>   ----- Method: Behavior>>createGetterFor: (in category '*Tools-Browser-accessors') -----
>   createGetterFor: aName
>
>         | code |
> +       code := '{1}\\  ^ {1}' withCRs format: {aName}.
> -       code := '{1}\   \       ^ {1}\' withCRs format: {aName.}.
>         self compile: code classified: #accessing notifying: nil.!
>
> Item was changed:
>   ----- Method: Behavior>>createSetterFor: (in category '*Tools-Browser-accessors') -----
>   createSetterFor: aName
>
>         | code |
> +       code := '{1}: anObject\\        {2}{1} := anObject.' withCRs
> +               format: {aName. self settersReturnValue ifTrue: ['^ '] ifFalse: ['']}.
> -       code := '{1}: anObject\ \       {2}{1} := anObject.\' withCRs
> -               format: {aName. self settersReturnValue ifTrue: ['^ '] ifFalse: [''].}.
>         self compile: code classified: #accessing notifying: nil.!
>
> Item was changed:
>   ----- Method: Behavior>>settersReturnValue (in category '*Tools-Browser-accessors') -----
>   settersReturnValue
>         "Determine whether the browser's createInstVarAccessors code will generate
>          setters that answer self (the default here) or the value set.  Classes that want
>          to answer the value set (e.g. VMStructType) override."
> +
> +       ^ false!
> -       ^false!
>
>