Code formatting patterns (was: [squeak-dev] The Trunk: Compiler-cmm.275.mcz)

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

Re: Code formatting patterns (was: [squeak-dev] The Trunk: Compiler-cmm.275.mcz)

Eliot Miranda-2



On Sat, Oct 5, 2013 at 2:04 PM, Chris Muller <[hidden email]> wrote:
>> This precise proposal is argued against by "Inline Message Pattern"
>> (pg. 172 of the book).  Method body's would be starting in all
>> different vertical places, your eyes have to "find" it.  And by
>> consuming more vertical space it will result in more required
>> scrolling.  Methods are often very short, would we really want to see
>> the message pattern take up more space than the body?
>
> You're putting up a straw man here. Nobody is proposing to always put a keyword on a new line. That would make no sense at all.

Oh, I thought that's what you were proposing as an alternative to
Tim's pragma idea.  I guess I misunderstood.

Tim's pragma idea was a joke...
 

> However, if you have a pattern with many and long keywords, then putting in explicit line breaks may be preferable to the automatic line wrapping. You would do that to group the keywords semantically.

I think it's better to format the language syntax elements
consistently, perhaps with a couple of exceptions like to:do: for the
sake of vertical space.  I think this gives the reader a
more-immediate awareness of the messages being sent, rather than
"reading prose".  It's a program, not a poem.  :)




--
best,
Eliot


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns (was: [squeak-dev] The Trunk: Compiler-cmm.275.mcz)

timrowledge

On 06-10-2013, at 10:36 AM, Eliot Miranda <[hidden email]> wrote:

>
>
>
> On Sat, Oct 5, 2013 at 2:04 PM, Chris Muller <[hidden email]> wrote:
> >> This precise proposal is argued against by "Inline Message Pattern"
> >> (pg. 172 of the book).  Method body's would be starting in all
> >> different vertical places, your eyes have to "find" it.  And by
> >> consuming more vertical space it will result in more required
> >> scrolling.  Methods are often very short, would we really want to see
> >> the message pattern take up more space than the body?
> >
> > You're putting up a straw man here. Nobody is proposing to always put a keyword on a new line. That would make no sense at all.
>
> Oh, I thought that's what you were proposing as an alternative to
> Tim's pragma idea.  I guess I misunderstood.
>
> Tim's pragma idea was a joke…

Yes, sort of. I bet you could make something of that kind which would provide formatting help. An optional wotsit that the Shout & prettyprinter would take notice of. Not a lot different to ideas about optional type information provision.

The real joke is that even if someone spent the time to implement it, nobody would use it and in a few years time somebody would be stridently demanding that such a system must be developed or Smalltalk would be *destroyed* - *destroyed I tell you!!!!* by Visual javsharp++

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: BSO: Branch Sort Of



Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns (was: [squeak-dev] The Trunk: Compiler-cmm.275.mcz)

Eliot Miranda-2



On Sun, Oct 6, 2013 at 10:53 AM, tim Rowledge <[hidden email]> wrote:

On 06-10-2013, at 10:36 AM, Eliot Miranda <[hidden email]> wrote:

>
>
>
> On Sat, Oct 5, 2013 at 2:04 PM, Chris Muller <[hidden email]> wrote:
> >> This precise proposal is argued against by "Inline Message Pattern"
> >> (pg. 172 of the book).  Method body's would be starting in all
> >> different vertical places, your eyes have to "find" it.  And by
> >> consuming more vertical space it will result in more required
> >> scrolling.  Methods are often very short, would we really want to see
> >> the message pattern take up more space than the body?
> >
> > You're putting up a straw man here. Nobody is proposing to always put a keyword on a new line. That would make no sense at all.
>
> Oh, I thought that's what you were proposing as an alternative to
> Tim's pragma idea.  I guess I misunderstood.
>
> Tim's pragma idea was a joke…

Yes, sort of. I bet you could make something of that kind which would provide formatting help. An optional wotsit that the Shout & prettyprinter would take notice of. Not a lot different to ideas about optional type information provision.

Yes, and one can tailor shout to an extent.  But it would be global, not local.
 

The real joke is that even if someone spent the time to implement it, nobody would use it and in a few years time somebody would be stridently demanding that such a system must be developed or Smalltalk would be *destroyed* - *destroyed I tell you!!!!* by Visual javsharp++

+1 

hence we're left with the war between visual thinkers (rectangular blocks) and verbal thinkers (pascal formatting).  just throwing wood on the fire ;-)
--
e


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Bert Freudenberg
On 2013-10-06, at 20:25, Eliot Miranda <[hidden email]> wrote:

> hence we're left with the war between visual thinkers (rectangular blocks) and verbal thinkers (pascal formatting).  just throwing wood on the fire ;-)

I very much like rectangular blocks as the general formatting rule; this is how Smalltalk code looks "naturally" to me. However, you must *not* put a space inside the brackets because then they draw too much attention, standing there on their own:

        [this is
        rectangular]

vs

        [ this is not
        as rectangular ]

There is, however, one case where the rectangular block formatting falls short, IMHO. That is when the block is the receiver of a message. For those, I still try to make them rectangular, but if that fails to look pleasant I occasionally put the closing bracket below the opening one in a line of its own, followed by the message.

Conventional wisdom says in that case one should refactor the method because it got too complex, which I agree to if there is a part that makes sense as its own method. However, I personally don't like one-off private methods just for the sake of simplifying one method. These typically need many arguments, have perhaps multiple return values, so the resulting complexity is not worth doing it.  Or am I missing something?

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Eliot Miranda-2



On Mon, Oct 7, 2013 at 3:01 AM, Bert Freudenberg <[hidden email]> wrote:
On 2013-10-06, at 20:25, Eliot Miranda <[hidden email]> wrote:

> hence we're left with the war between visual thinkers (rectangular blocks) and verbal thinkers (pascal formatting).  just throwing wood on the fire ;-)

I very much like rectangular blocks as the general formatting rule; this is how Smalltalk code looks "naturally" to me. However, you must *not* put a space inside the brackets because then they draw too much attention, standing there on their own:

        [this is
        rectangular]

Ian Piumarta and I are anal enough to prefer
 
        [this is
         rectangular
         and nicely indented]

;-)


vs

        [ this is not
        as rectangular ]

yuck.  Ugly as sin.  Hate the extra whitespace.  I like asSortedCollection: [:a :b| a < b], *not* *horrible* [ :a :b |, or even *worse*, [ : a : b | (argh)... ;-)
 

There is, however, one case where the rectangular block formatting falls short, IMHO. That is when the block is the receiver of a message. For those, I still try to make them rectangular, but if that fails to look pleasant I occasionally put the closing bracket below the opening one in a line of its own, followed by the message.

Yes, this is a pain.  In simple cases I'll write

     [some
      code]
        ensure: [more code]

but this all falls in a heap when there;s an on:do: involved. I try then to do

        [[some
          code]
                        on: SomeException
                        do: [:ex| something]]
                ensure: [more code]

cuz the lining up of the on:do: and the ensure: obscures things horribly:

        [[some
          code]
                on: SomeException
                do: [:ex| something]]
                ensure: [more code]


Conventional wisdom says in that case one should refactor the method because it got too complex, which I agree to if there is a part that makes sense as its own method. However, I personally don't like one-off private methods just for the sake of simplifying one method. These typically need many arguments, have perhaps multiple return values, so the resulting complexity is not worth doing it.  Or am I missing something?

Nope.  +1.

If it weren't for comments (and comments are /really/ important) we'd have implemented a parameterised formatted by now that auto-formatted code to the preferences of the reader and this would all be moot.  But without a good AI I don't see how to spot and preserve while reformatting multi-line comments, comments with diagrams in them, etc, etc, etc.
--
best,
Eliot


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

timrowledge

On 08-10-2013, at 12:58 PM, Eliot Miranda <[hidden email]> wrote:
>
> If it weren't for comments (and comments are /really/ important) we'd have implemented a parameterised formatted by now that auto-formatted code to the preferences of the reader and this would all be moot.  But without a good AI I don't see how to spot and preserve while reformatting multi-line comments, comments with diagrams in them, etc, etc, etc.
> --

One possible thing we could do with comments is make them act like comments to annotated Word/Pages documents. Select the section of code, hit MagicKey-comment, enter comment in balloon. Comments get to live in their own private formatting space, unaffected by whatever happens to the code layout. Possibly, they could be handled so that the code differ doesn't have to get confused by them, potentially simplifying that important job.

once you have them separated, you can display them according to whatever algorithm you like. Inline them, have them float at the side, have them only pop-up when pointer is in the relevant region, list them at the end like footnotes, whatever. Or even invert the view - have the comments appear as the main text with the code off to the side.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
I haven't lost my mind; it's backed up on tape somewhere.



Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Tobias Pape
Am 08.10.2013 um 22:49 schrieb tim Rowledge <[hidden email]>:

> On 08-10-2013, at 12:58 PM, Eliot Miranda <[hidden email]> wrote:
>>
>> If it weren't for comments (and comments are /really/ important) we'd have implemented a parameterised formatted by now that auto-formatted code to the preferences of the reader and this would all be moot.  But without a good AI I don't see how to spot and preserve while reformatting multi-line comments, comments with diagrams in them, etc, etc, etc.
>> --
>
> One possible thing we could do with comments is make them act like comments to annotated Word/Pages documents. Select the section of code, hit MagicKey-comment, enter comment in balloon. Comments get to live in their own private formatting space, unaffected by whatever happens to the code layout. Possibly, they could be handled so that the code differ doesn't have to get confused by them, potentially simplifying that important job.
>

CodeTalk. https://www.hpi.uni-potsdam.de/hirschfeld/trac/SqueakCommunityProjects/wiki/codetalk
Yours truly had been involved with this in his bachelor's project[1]
which then was done in cooperation with Andreas and Qwaq.

There is a Paper[2] with screenshots also, an Marcel[3] wrote his Bachelor's Thesis
about this[4].

You get pop-out chats on your code that get sync-ed via a monticello
extension.


> once you have them separated, you can display them according to whatever algorithm you like. Inline them, have them float at the side, have them only pop-up when pointer is in the relevant region, list them at the end like footnotes, whatever. Or even invert the view - have the comments appear as the main text with the code off to the side.
>
> tim

Best
        -Tobias


[1] Our Univerisities way to get your fingers dirty in order to be able to
    write your thesis.
[2] http://www.taeumel.eu/pdf/codetalk-ieee.pdf
[3] The guy who also did the Morpic designer: https://www.hpi.uni-potsdam.de/hirschfeld/trac/SqueakCommunityProjects/wiki/designer
[4] http://www.taeumel.eu/pdf/bachelors-thesis.pdf



signature.asc (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Chris Muller-3
In reply to this post by Eliot Miranda-2
> On Mon, Oct 7, 2013 at 3:01 AM, Bert Freudenberg <[hidden email]>
> wrote:
>>
>> On 2013-10-06, at 20:25, Eliot Miranda <[hidden email]> wrote:
>>
>> > hence we're left with the war between visual thinkers (rectangular
>> > blocks) and verbal thinkers (pascal formatting).  just throwing wood on the
>> > fire ;-)
>>
>> I very much like rectangular blocks as the general formatting rule; this
>> is how Smalltalk code looks "naturally" to me. However, you must *not* put a
>> space inside the brackets because then they draw too much attention,
>> standing there on their own:
>>
>>         [this is
>>         rectangular]
>
>
> Ian Piumarta and I are anal enough to prefer
>
>         [this is
>          rectangular
>          and nicely indented]
>
> ;-)
>
>>
>> vs
>>
>>         [ this is not
>>         as rectangular ]
>
>
> yuck.  Ugly as sin.  Hate the extra whitespace.  I like asSortedCollection:
> [:a :b| a < b], *not* *horrible* [ :a :b |, or even *worse*, [ : a : b |
> (argh)... ;-)

I guess there's no accounting for taste.  :)

My gripe with [:each | each doSomething] is that word-selection then
includes the colon, which is a pain when you want to Command+h,
Command+g it.  Plus, [: each | each doSomething] is consistent with
method signatures, an anonymous selector.

>> Conventional wisdom says in that case one should refactor the method
>> because it got too complex, which I agree to if there is a part that makes
>> sense as its own method. However, I personally don't like one-off private
>> methods just for the sake of simplifying one method. These typically need
>> many arguments, have perhaps multiple return values, so the resulting
>> complexity is not worth doing it.  Or am I missing something?
>
> Nope.  +1.
>
> If it weren't for comments (and comments are /really/ important) we'd have
> implemented a parameterised formatted by now that auto-formatted code to the
> preferences of the reader and this would all be moot.  But without a good AI
> I don't see how to spot and preserve while reformatting multi-line comments,
> comments with diagrams in them, etc, etc, etc.

Right the formatter butchers comments is all the more reason I lean
toward composing methods to expose more meaning.  Auto-formatting is
too valuable to give up.

Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Nicolas Cellier
Not only comments, literal formatting is also important...
If I want to put line breaks and tabs inside a #( ... ), the formatter shall not break it.
If I want to write 2r0110, there must be a reason, and the formatter shall not normalize to 6.


2013/10/8 Chris Muller <[hidden email]>
> On Mon, Oct 7, 2013 at 3:01 AM, Bert Freudenberg <[hidden email]>
> wrote:
>>
>> On 2013-10-06, at 20:25, Eliot Miranda <[hidden email]> wrote:
>>
>> > hence we're left with the war between visual thinkers (rectangular
>> > blocks) and verbal thinkers (pascal formatting).  just throwing wood on the
>> > fire ;-)
>>
>> I very much like rectangular blocks as the general formatting rule; this
>> is how Smalltalk code looks "naturally" to me. However, you must *not* put a
>> space inside the brackets because then they draw too much attention,
>> standing there on their own:
>>
>>         [this is
>>         rectangular]
>
>
> Ian Piumarta and I are anal enough to prefer
>
>         [this is
>          rectangular
>          and nicely indented]
>
> ;-)
>
>>
>> vs
>>
>>         [ this is not
>>         as rectangular ]
>
>
> yuck.  Ugly as sin.  Hate the extra whitespace.  I like asSortedCollection:
> [:a :b| a < b], *not* *horrible* [ :a :b |, or even *worse*, [ : a : b |
> (argh)... ;-)

I guess there's no accounting for taste.  :)

My gripe with [:each | each doSomething] is that word-selection then
includes the colon, which is a pain when you want to Command+h,
Command+g it.  Plus, [: each | each doSomething] is consistent with
method signatures, an anonymous selector.

>> Conventional wisdom says in that case one should refactor the method
>> because it got too complex, which I agree to if there is a part that makes
>> sense as its own method. However, I personally don't like one-off private
>> methods just for the sake of simplifying one method. These typically need
>> many arguments, have perhaps multiple return values, so the resulting
>> complexity is not worth doing it.  Or am I missing something?
>
> Nope.  +1.
>
> If it weren't for comments (and comments are /really/ important) we'd have
> implemented a parameterised formatted by now that auto-formatted code to the
> preferences of the reader and this would all be moot.  But without a good AI
> I don't see how to spot and preserve while reformatting multi-line comments,
> comments with diagrams in them, etc, etc, etc.

Right the formatter butchers comments is all the more reason I lean
toward composing methods to expose more meaning.  Auto-formatting is
too valuable to give up.




Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Eliot Miranda-2



On Tue, Oct 8, 2013 at 2:05 PM, Nicolas Cellier <[hidden email]> wrote:
Not only comments, literal formatting is also important...
If I want to put line breaks and tabs inside a #( ... ), the formatter shall not break it.
If I want to write 2r0110, there must be a reason, and the formatter shall not normalize to 6.

Yes, very important point.
 


2013/10/8 Chris Muller <[hidden email]>
> On Mon, Oct 7, 2013 at 3:01 AM, Bert Freudenberg <[hidden email]>
> wrote:
>>
>> On 2013-10-06, at 20:25, Eliot Miranda <[hidden email]> wrote:
>>
>> > hence we're left with the war between visual thinkers (rectangular
>> > blocks) and verbal thinkers (pascal formatting).  just throwing wood on the
>> > fire ;-)
>>
>> I very much like rectangular blocks as the general formatting rule; this
>> is how Smalltalk code looks "naturally" to me. However, you must *not* put a
>> space inside the brackets because then they draw too much attention,
>> standing there on their own:
>>
>>         [this is
>>         rectangular]
>
>
> Ian Piumarta and I are anal enough to prefer
>
>         [this is
>          rectangular
>          and nicely indented]
>
> ;-)
>
>>
>> vs
>>
>>         [ this is not
>>         as rectangular ]
>
>
> yuck.  Ugly as sin.  Hate the extra whitespace.  I like asSortedCollection:
> [:a :b| a < b], *not* *horrible* [ :a :b |, or even *worse*, [ : a : b |
> (argh)... ;-)

I guess there's no accounting for taste.  :)

My gripe with [:each | each doSomething] is that word-selection then
includes the colon, which is a pain when you want to Command+h,
Command+g it.  Plus, [: each | each doSomething] is consistent with
method signatures, an anonymous selector.

>> Conventional wisdom says in that case one should refactor the method
>> because it got too complex, which I agree to if there is a part that makes
>> sense as its own method. However, I personally don't like one-off private
>> methods just for the sake of simplifying one method. These typically need
>> many arguments, have perhaps multiple return values, so the resulting
>> complexity is not worth doing it.  Or am I missing something?
>
> Nope.  +1.
>
> If it weren't for comments (and comments are /really/ important) we'd have
> implemented a parameterised formatted by now that auto-formatted code to the
> preferences of the reader and this would all be moot.  But without a good AI
> I don't see how to spot and preserve while reformatting multi-line comments,
> comments with diagrams in them, etc, etc, etc.

Right the formatter butchers comments is all the more reason I lean
toward composing methods to expose more meaning.  Auto-formatting is
too valuable to give up.








--
best,
Eliot


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Eliot Miranda-2
In reply to this post by Tobias Pape
Hi Tobias, Tim,


On Tue, Oct 8, 2013 at 1:58 PM, Tobias Pape <[hidden email]> wrote:
Am 08.10.2013 um 22:49 schrieb tim Rowledge <[hidden email]>:

> On 08-10-2013, at 12:58 PM, Eliot Miranda <[hidden email]> wrote:
>>
>> If it weren't for comments (and comments are /really/ important) we'd have implemented a parameterised formatted by now that auto-formatted code to the preferences of the reader and this would all be moot.  But without a good AI I don't see how to spot and preserve while reformatting multi-line comments, comments with diagrams in them, etc, etc, etc.
>> --
>
> One possible thing we could do with comments is make them act like comments to annotated Word/Pages documents. Select the section of code, hit MagicKey-comment, enter comment in balloon. Comments get to live in their own private formatting space, unaffected by whatever happens to the code layout. Possibly, they could be handled so that the code differ doesn't have to get confused by them, potentially simplifying that important job.
>

CodeTalk. https://www.hpi.uni-potsdam.de/hirschfeld/trac/SqueakCommunityProjects/wiki/codetalk
Yours truly had been involved with this in his bachelor's project[1]
which then was done in cooperation with Andreas and Qwaq.

There is a Paper[2] with screenshots also, an Marcel[3] wrote his Bachelor's Thesis
about this[4].

You get pop-out chats on your code that get sync-ed via a monticello
extension.

So what does a file-out look like?  What's the textual/interchange format e.g. in a Monticello package?
 
> once you have them separated, you can display them according to whatever algorithm you like. Inline them, have them float at the side, have them only pop-up when pointer is in the relevant region, list them at the end like footnotes, whatever. Or even invert the view - have the comments appear as the main text with the code off to the side.
>
> tim

Best
        -Tobias


[1] Our Univerisities way to get your fingers dirty in order to be able to
    write your thesis.
[2] http://www.taeumel.eu/pdf/codetalk-ieee.pdf
[3] The guy who also did the Morpic designer: https://www.hpi.uni-potsdam.de/hirschfeld/trac/SqueakCommunityProjects/wiki/designer
[4] http://www.taeumel.eu/pdf/bachelors-thesis.pdf






--
best,
Eliot


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

timrowledge

On 08-10-2013, at 2:14 PM, Eliot Miranda <[hidden email]> wrote:
>
> So what does a file-out look like?  What's the textual/interchange format e.g. in a Monticello package?

Not having looked at Tobias' stuff yet, I'm going to guess that one could use the same style-embedding that we already have, with some (probably) simple extensions. Or change to using xml? Is that too scary?


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: LC: Lobotomize CPU



Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Tobias Pape
In reply to this post by Eliot Miranda-2
Am 08.10.2013 um 23:14 schrieb Eliot Miranda <[hidden email]>:

> Hi Tobias, Tim,
>
>
> On Tue, Oct 8, 2013 at 1:58 PM, Tobias Pape <[hidden email]> wrote:
>
>> Am 08.10.2013 um 22:49 schrieb tim Rowledge <[hidden email]>:
>>
>>> On 08-10-2013, at 12:58 PM, Eliot Miranda <[hidden email]>
>> wrote:
>>>>
>>>> If it weren't for comments (and comments are /really/ important) we'd
>> have implemented a parameterised formatted by now that auto-formatted code
>> to the preferences of the reader and this would all be moot.  But without a
>> good AI I don't see how to spot and preserve while reformatting multi-line
>> comments, comments with diagrams in them, etc, etc, etc.
>>>> --
>>>
>>> One possible thing we could do with comments is make them act like
>> comments to annotated Word/Pages documents. Select the section of code, hit
>> MagicKey-comment, enter comment in balloon. Comments get to live in their
>> own private formatting space, unaffected by whatever happens to the code
>> layout. Possibly, they could be handled so that the code differ doesn't
>> have to get confused by them, potentially simplifying that important job.
>>>
>>
>> CodeTalk.
>> https://www.hpi.uni-potsdam.de/hirschfeld/trac/SqueakCommunityProjects/wiki/codetalk
>> Yours truly had been involved with this in his bachelor's project[1]
>> which then was done in cooperation with Andreas and Qwaq.
>>
>> There is a Paper[2] with screenshots also, an Marcel[3] wrote his
>> Bachelor's Thesis
>> about this[4].
>>
>> You get pop-out chats on your code that get sync-ed via a monticello
>> extension.
>>
>
> So what does a file-out look like?  What's the textual/interchange format
> e.g. in a Monticello package?
There is no textual form in the monticello file.
The presence of chatting information is stored as extended
text attibutes (like links or colors) and the chats itself
are serialized binary as a new zip part (like snapshot.bin)
(see §3.6 of http://www.taeumel.eu/pdf/bachelors-thesis.pdf)

Best
        -Tobias

>
>
>>> once you have them separated, you can display them according to whatever
>> algorithm you like. Inline them, have them float at the side, have them
>> only pop-up when pointer is in the relevant region, list them at the end
>> like footnotes, whatever. Or even invert the view - have the comments
>> appear as the main text with the code off to the side.
>>>
>>> tim
>>
>> Best
>>        -Tobias
>>
>>
>> [1] Our Univerisities way to get your fingers dirty in order to be able to
>>    write your thesis.
>> [2] http://www.taeumel.eu/pdf/codetalk-ieee.pdf
>> [3] The guy who also did the Morpic designer:
>> https://www.hpi.uni-potsdam.de/hirschfeld/trac/SqueakCommunityProjects/wiki/designer
>> [4] http://www.taeumel.eu/pdf/bachelors-thesis.pdf





signature.asc (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Eliot Miranda-2
In reply to this post by timrowledge



On Tue, Oct 8, 2013 at 2:46 PM, tim Rowledge <[hidden email]> wrote:

On 08-10-2013, at 2:14 PM, Eliot Miranda <[hidden email]> wrote:
>
> So what does a file-out look like?  What's the textual/interchange format e.g. in a Monticello package?

Not having looked at Tobias' stuff yet, I'm going to guess that one could use the same style-embedding that we already have, with some (probably) simple extensions. Or change to using xml? Is that too scary?

XML is way too heavy-weight.  I want something that is easily manually edited.  But it's hardly scary, merely ludicrously verbose (and then there's the escape conventions; you thought !! was a pain, but &quot;no way&quot; :) )

Strange OpCodes: LC: Lobotomize CPU






--
best,
Eliot


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Eliot Miranda-2
In reply to this post by Tobias Pape



On Tue, Oct 8, 2013 at 2:49 PM, Tobias Pape <[hidden email]> wrote:
Am 08.10.2013 um 23:14 schrieb Eliot Miranda <[hidden email]>:

> Hi Tobias, Tim,
>
>
> On Tue, Oct 8, 2013 at 1:58 PM, Tobias Pape <[hidden email]> wrote:
>
>> Am 08.10.2013 um 22:49 schrieb tim Rowledge <[hidden email]>:
>>
>>> On 08-10-2013, at 12:58 PM, Eliot Miranda <[hidden email]>
>> wrote:
>>>>
>>>> If it weren't for comments (and comments are /really/ important) we'd
>> have implemented a parameterised formatted by now that auto-formatted code
>> to the preferences of the reader and this would all be moot.  But without a
>> good AI I don't see how to spot and preserve while reformatting multi-line
>> comments, comments with diagrams in them, etc, etc, etc.
>>>> --
>>>
>>> One possible thing we could do with comments is make them act like
>> comments to annotated Word/Pages documents. Select the section of code, hit
>> MagicKey-comment, enter comment in balloon. Comments get to live in their
>> own private formatting space, unaffected by whatever happens to the code
>> layout. Possibly, they could be handled so that the code differ doesn't
>> have to get confused by them, potentially simplifying that important job.
>>>
>>
>> CodeTalk.
>> https://www.hpi.uni-potsdam.de/hirschfeld/trac/SqueakCommunityProjects/wiki/codetalk
>> Yours truly had been involved with this in his bachelor's project[1]
>> which then was done in cooperation with Andreas and Qwaq.
>>
>> There is a Paper[2] with screenshots also, an Marcel[3] wrote his
>> Bachelor's Thesis
>> about this[4].
>>
>> You get pop-out chats on your code that get sync-ed via a monticello
>> extension.
>>
>
> So what does a file-out look like?  What's the textual/interchange format
> e.g. in a Monticello package?

There is no textual form in the monticello file.
The presence of chatting information is stored as extended
text attibutes (like links or colors) and the chats itself
are serialized binary as a new zip part (like snapshot.bin)
(see §3.6 of http://www.taeumel.eu/pdf/bachelors-thesis.pdf)

thanks!
 

Best
        -Tobias

>
>
>>> once you have them separated, you can display them according to whatever
>> algorithm you like. Inline them, have them float at the side, have them
>> only pop-up when pointer is in the relevant region, list them at the end
>> like footnotes, whatever. Or even invert the view - have the comments
>> appear as the main text with the code off to the side.
>>>
>>> tim
>>
>> Best
>>        -Tobias
>>
>>
>> [1] Our Univerisities way to get your fingers dirty in order to be able to
>>    write your thesis.
>> [2] http://www.taeumel.eu/pdf/codetalk-ieee.pdf
>> [3] The guy who also did the Morpic designer:
>> https://www.hpi.uni-potsdam.de/hirschfeld/trac/SqueakCommunityProjects/wiki/designer
>> [4] http://www.taeumel.eu/pdf/bachelors-thesis.pdf









--
best,
Eliot


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

timrowledge
In reply to this post by Eliot Miranda-2

On 08-10-2013, at 2:53 PM, Eliot Miranda <[hidden email]> wrote:
>
> XML is way too heavy-weight.  I want something that is easily manually edited.  But it's hardly scary, merely ludicrously verbose (and then there's the escape conventions; you thought !! was a pain, but &quot;no way&quot; :)

Surely that should be
&ampersand;quot&semicol;

oh, wait, that would be
&ampersand&semicol;quo…. no wait, stack overflow

I admit to having successfully ignored xml stuff, but is it plausible to use only a small part of the full monty? Does it *have* to be heavyweight, or could we write out source code in an xml correct manner that only uses the parts required, then only handle those parts as part of reading the source?

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Esc key to reboot Universe, or any other key to continue...



Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Bob Arning-2
In reply to this post by timrowledge
Not sure you need special magic key. Comments know where they are in the text, but could be displayed just about anywhere. Some experiments underway at:

http://69.251.218.6:9116/split

Cheers,
Bob

On 10/8/13 4:49 PM, tim Rowledge wrote:
One possible thing we could do with comments is make them act like comments to annotated Word/Pages documents. Select the section of code, hit MagicKey-comment, enter comment in balloon. Comments get to live in their own private formatting space, unaffected by whatever happens to the code layout. Possibly, they could be handled so that the code differ doesn't have to get confused by them, potentially simplifying that important job. 



Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Jecel Assumpcao Jr
Bob Arning wrote:

> Not sure you need special magic key. Comments know where they are
> in the text, but could be displayed just about anywhere. Some experiments
> underway at:
>
> http://69.251.218.6:9116/split

That looks pretty good!

For a very compact Smalltalk that I designed, I didn't add comments to
the language itself but rather had this method for Points:

comment: explanation on: expression
  ^ expression

which allowed code like:

a := b + (15@15 comment: 'this is scaled for 32 bit words' on: c*4)

This would work with a very simple text editor and would give the
correct result with a very dumb compiler. But you could have a smarter
compiler notice that the receiver is a constant object and optimize the
message send away. And a fancier editor could show just:

a := b + (c*4)

with the expression in parenthesis having a slightly different
background color, so when you passed the cursor over it the text 'this
is scaled for 32 bit words' would appear at the indicated offset (15@15)
from the bottom left of the left parenthesis.

Two advantages of this scheme were that the comment could be any object
at all, and not just Strings, and that the comment refers to a whole
code fragment and not just to a single point in the code text.

-- Jecel


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Bert Freudenberg
In reply to this post by Chris Muller-3
On 08.10.2013, at 23:02, Chris Muller <[hidden email]> wrote:

> My gripe with [:each | each doSomething] is that word-selection then includes the colon, which is a pain when you want to Command+h, Command+g it.

Now that sounds like it would be easy to fix, no? We should fix the tools, not work around them.

>  Plus, [: each | each doSomething] is consistent with method signatures, an anonymous selector.

Emerson's quote regarding consistency applies. Sorry, could not resist ;)

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: Code formatting patterns

Bert Freudenberg
In reply to this post by timrowledge

On 08.10.2013, at 23:46, tim Rowledge <[hidden email]> wrote:

>
> On 08-10-2013, at 2:14 PM, Eliot Miranda <[hidden email]> wrote:
>>
>> So what does a file-out look like?  What's the textual/interchange format e.g. in a Monticello package?
>
> Not having looked at Tobias' stuff yet, I'm going to guess that one could use the same style-embedding that we already have

... except that gets dropped by MC.

- Bert -



123