For me the new style lacks visual hints of where the comment starts
and ends and I feel the "old" Javadoc style does quite well in that
regard.
Regards,
Rüdiger
2011/5/9 Stuart Roebuck <stuart....@gmail.com>:
I don't see why closing the comment on the last line is recommended, though.
--
Johannes
-----------------------------------------------
Johannes Rudolph
http://virtual-void.net
Surely someone can write a few lines of code that figure out where the left border is. Something like
val validDoc = """(\s+\*\s*\S.)"""r
val doccable = lines.flatMap(s = validDoc.findPrefixMatchOf(s).map(_.end-2))
val left = if (doccable.isEmpty) 0 else doccable.min
lines.map(_.substring(left))
I don't see the problem here. Why should it be a problem to determine
where the left border is? Unless you begin your comment in the first
line starting with /** there are no ambiguities. And beginning in the
first line would be against the conventions if I'm not mistaken.
Sure, there is some rather involved regex code for handling the left
border in the current Scaladoc implementation, but that isn't affected
by the new style as far as I remember.
Regards,
Rüdiger
I think the intended benefit is for human-, rather than machine-, parseability.
-jason
Regards,
Rüdiger
2011/5/9 Jason Zaugg <jza...@gmail.com>:
Of course, you can determine the left border automatically in the
compiler if you assume some convention of where the left border is. If
you look at the Scaladoc comments as they are now in the library this
convention seems to be - at places - non-obvious [1]. Compare that
with the new convention where this question doesn't even arise. This
is more about visual clarity than implementation.
This said, I don't really prefer one way over the other, however,
having to move a complete code base to a new comment scheme to appease
the IDE doesn't seem to be the right way.
--
Johannes
[1] It seems to be something along: The first line starts one blank
after **, the next lines need two blanks to be aligned with the first
and if you use the <pre>-tag it uses only one blank so that the inner
code is aligned.
It doesn't matter in JavaDoc, but with the WikiSyntax it wastes a lot of
time, if one sees after half an hour that ScalaDoc actually had a
different interpretation of what the right indentation should be.
I think there were good reasons when it changed in 2.8 and back-pedaling
on it just because the IDEs don't support Scala as fast as we all would
like to see it and some people didn't read the documentation, is really
a shame.
Maybe someone should ask the original authors for comments?
Imho the current style is an improvement over the old one, especially
from a human-readability POV and as someone who actually writes
documentation a lot I really like it, although it took some time to
acclimate with it.
Personally I would prefer it to actually work on the 70% of ScalaDoc
which are not implemented yet (despite claims in the wiki), instead of
ripping apart the pieces which actually started to work recently.
Thanks and bye!
Simon
It's supported, not enforced, in IntelliJ. We'll review the default
setting based on this thread.
To revert to the old style, Settings, Code Style, Spaces, Scala, "Use
formatting for ScalaDoc2 options".
-jason
I remember seeing some "strangely" formatted comments in the Scaladoc
code. Thinking back now, it was probably following the new proposed
convention.
Nevertheless, if I remember the code correctly the Scaladoc tool
assumes that the border of a comment is everything up to and including
the first * and then one additional whitespace if there is some. For
the first line, it's everything up to and including the /** and also
one additional whitespace. So if you have one whitespace in the first
line and two in the following lines to align them, you end up with
differing indentations as far as Scaladoc is concerned...
Personally I would prefer the classical Javadoc style with an empty
first line, but to each his own.
Regards,
Rüdiger
2011/5/9 Johannes Rudolph <johannes...@googlemail.com>:
Hi everyone,
Exactly. It is just not intuitive at all with the old style.I think the intended benefit is for human-, rather than machine-, parseability.If I understand Simon's comment from the ticket, the problem is, that
the Scaladoc markup language (the 'wiki syntax') relies on indentation
to be correct. And this can be hard to get right if it isn't clear
what the left border of your text actually is.
It doesn't matter in JavaDoc, but with the WikiSyntax it wastes a lot of time, if one sees after half an hour that ScalaDoc actually had a different interpretation of what the right indentation should be.
> I think that's backwards. If ScalaDoc cannot deal with the standard
> convention it needs to be fixed. If you know it does not work, can you
> please file a ticket? And I mean that independently of how the style
> discussion pans out. Clearly scaladoc's functioning should not be
> dependent on a particular style.
>
I don't think that there is a solution with the old format. Consider for
example an unordered list starting at the first line.
Either I don't have the text aligned, which just looks horrible and is
counterintuitive, because it ends up on the same level in HTML.
Or I align the text, and now my list has actually a sublist in it as a
result, while it looks totally innocent in the source code.
Maybe I'm exaggerating a bit, but I think it is either going back to the
old style and using html tags again or going with the new style and
using trac style (although I'm not really sure if it obsoletes all use
cases of html currently, especially in code examples + formatting).
I have just seen too much mis-formatted ScalaDoc in the last few weeks
while fixing the old TeX-style quotes, and I think the current style of
same-indentation-everywhere might reduce some of the most common errors.
I just wonder, if we pack-pedal that thing, will we back-pedal for
instance on the matter of TeX-style quotes, too, just because not many
people care that it is totally unsupported and breaks the formatting
everywhere in ScalaDoc2?
Thanks and bye,
Simon
Hi!I don't think that there is a solution with the old format. Consider for example an unordered list starting at the first line.
I think that's backwards. If ScalaDoc cannot deal with the standard convention it needs to be fixed. If you know it does not work, can you please file a ticket? And I mean that independently of how the style discussion pans out. Clearly scaladoc's functioning should not be dependent on a particular style.
Either I don't have the text aligned, which just looks horrible and is counterintuitive, because it ends up on the same level in HTML.
Or I align the text, and now my list has actually a sublist in it as a result, while it looks totally innocent in the source code.
How often does that come up? Did you find this in the comments for
scalac or the standard library?
-jason
> Does anyone actually do that? Scaladoc with an unordered list at the
> first line? What kind of meaningful doc comment would start with an
> unordered list?
It was just one example where ScalaDoc behaves inconsistent. The whole
tool is full of these quirks and it is quite hard to remember all of
them while writing documentation.
It would be nice to reduce the complexity of writing documentation and I
think the current comment style does that, while also reducing the
visual clutter and making the appearance in the source code similar with
the appearance in HTML.
> I'd say, if people do that, they'd deserve any random behavior of the
> tool.
Yes, sure. But abusing tools often shows the weaknesses they have more
clearly. :-)
There is just so much work left on ScalaDoc, implementation-wise _and_
specification-wise, and hope this discussion about comment style won't
waste time with things which should be considered fixed.
Maybe there should be more attention spent on IDE plugins instead so
that the recommended style is implemented with less delay. (So that
people can see it and complain in a timely manner and not 2 releases
later :-D)
Thanks and bye,
Simon
It is just that I'm grateful for any actual reduction of complexity
after I tried to make some fixes to the library. I believe there is
something wrong when even the gods of higher-kinded types and implicits
sometimes don't understand ScalaDoc correctly. :-)
Thanks and bye,
Simon
I too prefer an empty first line and end line. I find the op example unpleasant to read.
On 9 May 2011 17:49, "Rüdiger Keller" <ruedige...@googlemail.com> wrote:
Ok, it seems that leaving the first line of a Scaladoc comment empty
is not something appreciated by many Scala coders.
I remember seeing some "strangely" formatted comments in the Scaladoc
code. Thinking back now, it was probably following the new proposed
convention.
Nevertheless, if I remember the code correctly the Scaladoc tool
assumes that the border of a comment is everything up to and including
the first * and then one additional whitespace if there is some. For
the first line, it's everything up to and including the /** and also
one additional whitespace. So if you have one whitespace in the first
line and two in the following lines to align them, you end up with
differing indentations as far as Scaladoc is concerned...
Personally I would prefer the classical Javadoc style with an empty
first line, but to each his own.
Regards,
Rüdiger
2011/5/9 Johannes Rudolph <johannes...@googlemail.com>:
> On Mon, May 9, 2011 at 5:16 PM, Rüdiger Keller
> <ruedige...@googlemail.com> wrote:
>> I don'...
It does feel like a solution looking for a problem and causing one!
Edge cases that don't conform to the above just need to be handled consistently with some documented algorithm so that developers who like to be different can understand why their comments are broken. Personally I think the left margin should simply be defined as "* " which is at least simple and consistent with the Scala stripMargin approach to handling left margins.
P.S. I think ScalaDoc 2 and the new HTML rendering is great. That's why this matters! :)
> Let's just take a step back. So far, I hear one opinion from Simon and
> another opinion from everyone else.
>
> Given that the recommendation in the Scaladoc document was made
> without consultation with the Scala community by I do not know who,
> and none of the original contributors speak up in favor here, let's
> bring this to a close:
Maybe they don't checked their emails yet. It is just 3 hours since the
discussion started.
> First, Scaladoc needs to be fixed so that it conforms to any start of
> line convention.
>
> Second, the Scaladoc recommendations should be brought in line with
> what everyone else is using. That style should be kept for the
> documentation of the standard library and compiler.
Sometimes an improvement seems to be not worth the amount of discussion
it generates. :-(
Judging from the amount of mails this has already generated in less than
3 hours, I'm in favor of this fast decision, even if it reverts the
improvements made in 2.8 instead of loosing time with endless discussions.
Thanks and bye,
Simon
Do we have to use the silly stars down the left hand side? What purpose
do they serve?
> Stuart.
Randall Schulz
> Stuart.
Randall Schulz
How can you fail to see that even in the absence of the asterisks?
Randall Schulz
That argument would have held a little more water twenty years ago.
Syntax highlighting is ubiquitous: if you don't have or choose not to
use syntax highlighting, you are either hard-core old school or pretty
out of touch with the tools. We know it can compile scala programs so
it's not a vic-20 or anything. But whatever the underlying reasoning,
it's only applicable to a small minority.
Am 10.05.2011 05:31, schrieb Randall R Schulz:
>> /**
>> * COMMENTS GO HERE
>> * AND HERE
>> * ETC
>> */
>>
>> ...
>
> Do we have to use the silly stars down the left hand side? What purpose
> do they serve?
I would prefere code-blocks of the form:
/** COMMENTS GO HERE
AND HERE
AND HERE
ETC */
def dummy (foo: Foo)
without unused stars, or better:
/** COMMENTS GO HERE
AND HERE
AND HERE
ETC */
def dummy (foo: Foo)
For html, a line.trim () should remove all leading and trailing blanks.
- --
Tschööö--->...Stefan
- ---------------------------
Don't visit my homepage at:
http://home.arcor-online.net/hirnstrom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3KCs0ACgkQQeATqGpDnRqt9ACeOHoRHsN1cVLvDBaQNkChSi0p
hhAAmgKkOfIiTafHFaggGeAc372ZJ3K3
=pUUl
-----END PGP SIGNATURE-----
Yes, there are lot of tastes, like for whitespace handling for indentation, choice of
brace positions, and so on.
Everybody has a different concept of readability, and then there is tradition, JavaDoc
being firmly planted in many developer's minds, and even Qt, thus Doxygen, reused the
convention for C++ (and more) code.
So, the best is to make a flexible tool able to handle all these styles. If not by
auto-discovering, at least by some settings.
As a reminder, speaking of Doxygen, we already debated the advantages of commenting
method's parameters inline, instead of repeating parameter names in the doc, which is
prone to desynchronization (method changes, comments are forgotten):
def someMethod(
foo: Int, ///< A number
bar: String, ///< The message
zot: Boolean ///< An option
)
Here, the doc tool automatically extract information from the code, instead of having the
developer to manually repeat them (even if IDEs can help, not everybody use them).
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
> /** COMMENTS GO HERE
> AND HERE
> AND HERE
> ETC */
> def dummy (foo: Foo)
>
> For html, a line.trim () should remove all leading and trailing blanks.
That doesn't work with wiki markup.
--
Daniel C. Sobral
I travel to the future all the time.
It does: Settings, Code Style, Spacing, Scala, Scaladoc2 Formatting.
-jason
I think we need an intercal-y feature where you must provide enough ascii artsy astectics in code, perhaps a self portrait, for scaladoc to generate any documentation.
I think we need an intercal-y feature where you must provide enough ascii artsy astectics in code, perhaps a self portrait, for scaladoc to generate any documentation.
On May 10, 2011 1:28 AM, "Paul Phillips" <pa...@improving.org> wrote:
> On 5/9/11 9:52 PM, Elazar Leibovich wrote:
>> You can see instantly that a long comment is a comment. Think for
>> example for a comment which contains code samples.
>
> That argument would have held a little more water twenty years ago.
> Syntax highlighting is ubiquitous: if you don't have or choose not to
> use syntax highlighting, you are either hard-core old school or pretty
> out of touch with the tools. We know it can compile scala programs so
> it's not a vic-20 or anything. But whatever the underlying reasoning,
> it's only applicable to a small minority.
I personally like the ScalaDoc2 comment convention very much.
I've already been writing comments like that for quite long and I'm very
happy that IntelliJ now supports it.
Regards,
Piotr