- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
class literals
Tue, 2009-10-20, 15:23
I noticed #2445 was listed as being in the meeting today:
http://lampsvn.epfl.ch/trac/scala/ticket/2445
"Spec says classOf[C] is a literal, but pattern matching doesn't work"
I am pretty curious about what is supposed to happen wrt class literals.
The spec does indeed seem to say that classOf[C] is a literal.
8.1.3: A literal pattern L matches any value that is equal (in terms of
==) to the literal L. The type of L must conform to the expected type of
the pattern.
6.2 Literals: Typing of literals is as described in (§1.3); their
evaluation is immediate. A different form of literals designate classes.
These are written classOf[C ] Here, classOf is a method defined in
scala.Predef (§12.5) and C is a class type.
...
A "different" form? To me that applies a dusting of uncertainty to
anything I might infer from the words which follow. Are they literals
in the sense of section 1.3 or not? If they are then everywhere in the
spec which refers to "literals" should work.
I found ticket #7c7c7c which was opened as an enhancement and closed
wontfix in one of those flurries of "there are too many open tickets"
closings. But if class literals are literals then that's a defect.
http://lampsvn.epfl.ch/trac/scala/ticket/882
"Matching Classes"
Another ticket of interest is:
http://lampsvn.epfl.ch/trac/scala/ticket/785
"Missing type parameter inference for stable identifier patterns."
Maybe all that's intended by "class literal" is "expression which will
be resolved statically". This interpretation is supported by the fact
that section 1.3 never mentions them. But it's kind of hard to tell.
Tue, 2009-10-20, 16:07
#2
Re: class literals
On Tue, Oct 20, 2009 at 04:39:29PM +0200, martin odersky wrote:
> The resolution was that class literals are, in fact, not literals.
> I'll remove that bit from the spec. It does indeed read funny the way
> it is written now. I have no idea how it got in there. It seems I
> added these clauses, but I have not the dimmest recollection why.
The copy of the spec at
http://www.scala-lang.org/docu/files/ScalaReference.pdf
dates March 15 and although I assume this is the source:
http://lampsvn.epfl.ch/svn-repos/scala/scala-documentation/trunk/src/ref...
...it wasn't too obvious to me how to "build" the pdf. Can we get an
updated copy on the site and/or can someone tell me how I'm supposed to
go from a pile of .tex files to a pdf without my having to take time off
to try to make some sense of tex?
Also nice would be to have a copy of the pdf checked into that repo
alongside the .tex files.
Tue, 2009-10-20, 16:07
#3
Re: class literals
On Tue, Oct 20, 2009 at 4:55 PM, Paul Phillips wrote:
> On Tue, Oct 20, 2009 at 04:39:29PM +0200, martin odersky wrote:
>> The resolution was that class literals are, in fact, not literals.
>> I'll remove that bit from the spec. It does indeed read funny the way
>> it is written now. I have no idea how it got in there. It seems I
>> added these clauses, but I have not the dimmest recollection why.
>
> The copy of the spec at
>
> http://www.scala-lang.org/docu/files/ScalaReference.pdf
>
> dates March 15 and although I assume this is the source:
>
> http://lampsvn.epfl.ch/svn-repos/scala/scala-documentation/trunk/src/reference/
>
> ...it wasn't too obvious to me how to "build" the pdf. Can we get an
> updated copy on the site and/or can someone tell me how I'm supposed to
> go from a pile of .tex files to a pdf without my having to take time off
> to try to make some sense of tex?
>
It's just:
pdflatex ScalaReference
Cheers
Tue, 2009-10-20, 16:47
#4
Re: class literals
Since it's actually slightly non-trivial to pdflatex the reference, here's an apocryphal (strictly formatting-wise) pdf (I couldn't immediately get it to compile on my machine that has latex set up, so I removed the fourier font selection).
hthadriaan
On Tue, Oct 20, 2009 at 5:00 PM, martin odersky <martin.odersky@epfl.ch> wrote:
hthadriaan
On Tue, Oct 20, 2009 at 5:00 PM, martin odersky <martin.odersky@epfl.ch> wrote:
On Tue, Oct 20, 2009 at 4:55 PM, Paul Phillips <paulp@improving.org> wrote:
> On Tue, Oct 20, 2009 at 04:39:29PM +0200, martin odersky wrote:
>> The resolution was that class literals are, in fact, not literals.
>> I'll remove that bit from the spec. It does indeed read funny the way
>> it is written now. I have no idea how it got in there. It seems I
>> added these clauses, but I have not the dimmest recollection why.
>
> The copy of the spec at
>
> http://www.scala-lang.org/docu/files/ScalaReference.pdf
>
> dates March 15 and although I assume this is the source:
>
> http://lampsvn.epfl.ch/svn-repos/scala/scala-documentation/trunk/src/reference/
>
> ...it wasn't too obvious to me how to "build" the pdf. Can we get an
> updated copy on the site and/or can someone tell me how I'm supposed to
> go from a pile of .tex files to a pdf without my having to take time off
> to try to make some sense of tex?
>
It's just:
pdflatex ScalaReference
Cheers
Tue, 2009-10-20, 17:17
#5
Re: class literals
The copy of the Scala Reference on the website refers to March 15 because
that is the snapshot of the documentation files used for building 2.7.x:
the documents on the website are updated as part of the release process.
The SLS certainly evolved since 2.7.x was forked, and not all changes
would be matching the current stable release.
Which raises the point on whether we should build the pdf docs as part of
the nightly, however.
Toni
On Tue, October 20, 2009 5:45 pm, Adriaan Moors wrote:
> Since it's actually slightly non-trivial to pdflatex the reference, here's
> an apocryphal (strictly formatting-wise) pdf (I couldn't immediately get
> it
> to compile on my machine that has latex set up, so I removed the fourier
> font selection).
> hth
> adriaan
>
> On Tue, Oct 20, 2009 at 5:00 PM, martin odersky
> wrote:
>
>> On Tue, Oct 20, 2009 at 4:55 PM, Paul Phillips
>> wrote:
>> > On Tue, Oct 20, 2009 at 04:39:29PM +0200, martin odersky wrote:
>> >> The resolution was that class literals are, in fact, not literals.
>> >> I'll remove that bit from the spec. It does indeed read funny the way
>> >> it is written now. I have no idea how it got in there. It seems I
>> >> added these clauses, but I have not the dimmest recollection why.
>> >
>> > The copy of the spec at
>> >
>> > http://www.scala-lang.org/docu/files/ScalaReference.pdf
>> >
>> > dates March 15 and although I assume this is the source:
>> >
>> >
>> http://lampsvn.epfl.ch/svn-repos/scala/scala-documentation/trunk/src/ref...
>> >
>> > ...it wasn't too obvious to me how to "build" the pdf. Can we get an
>> > updated copy on the site and/or can someone tell me how I'm supposed
>> to
>> > go from a pile of .tex files to a pdf without my having to take time
>> off
>> > to try to make some sense of tex?
>> >
>> It's just:
>>
>> pdflatex ScalaReference
>>
>> Cheers
>>
>> -- Martin
>>
>>
>> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>>
>
Tue, 2009-10-20, 18:47
#6
Re: class literals
On Tue, Oct 20, 2009 at 06:12:54PM +0200, Antonio Cunei wrote:
> The SLS certainly evolved since 2.7.x was forked, and not all changes
> would be matching the current stable release.
OK that's fine, I don't care where it is, I just want to be able to read
the spec I'm trying to implement.
> As Martin explained, building the pdf from the source is rather easy.
> The LuxiMono TeX font is probably used in the file however, you might
> have to install that separately to get the best result.
This is statement is pretty silly all by itself -- when you have to
start listing the fonts which I need to install separately, it's so far
from "easy" it's not even funny -- but let's see what I found when I
went to try to find pdflatex for my system, since it's not already on it
or in macports where I get 99% of my external software. Looks like this:
http://www.tug.org/mactex/
approximately 1.2G - 20 March 2009
Oh good, it's only a 1.2 GB download, no problem. But I've done this
before, for the same reason, and I still didn't have pdflatex working.
So there I am digging through FAQs about TEX and trying to figure out
why the frobozz is not version foo compatible and what fascinating
twists snow leopard brought to the equation.
Hey wait a minute, I have ZERO INTEREST in this! I'm trying to read the
current documentation! I'm working full-time for free, would it to be
too much to ask that I be able to read the spec without enjoying the
considerable thrill of separately installing the LuxiMono TeX font for
best results?
Thank you adriaan for the pdf and also for acknowledging that it's
probably not necessarily as easy as typing a dozen characters. Much as
I wish we could, we can't all be experts at everything, we don't all use
the same systems, and time spent keeping up with mactex is time not
spent on improving our shared interest.
Tue, 2009-10-20, 19:17
#7
Re: class literals
On Tue, October 20, 2009 7:41 pm, Paul Phillips wrote:
> Hey wait a minute, I have ZERO INTEREST in this! I'm trying to read the
> current documentation! I'm working full-time for free, would it to be
> too much to ask that I be able to read the spec without enjoying the
> considerable thrill of separately installing the LuxiMono TeX font for
> best results?
>
Paul,
if you read the following message I sent, I mentioned setting up the pdf
building process as part of the nightly, so that you don't have to make
any effort to obtain a constantly up-to-date version.
I suppose that would be acceptable?
Toni
Tue, 2009-10-20, 19:27
#8
Re: class literals
>>>>> "Antonio" == Antonio Cunei writes:
Antonio> if you read the following message I sent, I mentioned setting
Antonio> up the pdf building process as part of the nightly, so that
Antonio> you don't have to make any effort to obtain a constantly
Antonio> up-to-date version.
I think a lot of us would appreciate that, actually.
Tue, 2009-10-20, 19:37
#9
Re: class literals
On Tue, Oct 20, 2009 at 08:08:01PM +0200, Antonio Cunei wrote:
> I suppose that would be acceptable?
That would be more than acceptable, thank you. For what it's worth I
hadn't figured out when replying that you had written an edited version
of the same email (I'm presuming the first one bounced because of your
From address, and you took the opportunity to edit it before resending
it: but as the guy on the To line I received both copies, and then
unwittingly quoted the earlier one back to the list.) Had I realized, I
wouldn't have had that reaction, or quoted the earlier one publicly.
Apologies: the bits, they move too fast for us (or for me anyway.)
Tue, 2009-10-20, 20:57
#10
Re: class literals
I for one would love if there were a way to produce an annotated
version showing diffs from the previous.
I guess that would be hard, if not impossible, but is there anything
else we can do to offer similar functionality?
On Tue, Oct 20, 2009 at 7:17 PM, Paul Phillips wrote:
> On Tue, Oct 20, 2009 at 08:08:01PM +0200, Antonio Cunei wrote:
>> I suppose that would be acceptable?
>
> That would be more than acceptable, thank you. For what it's worth I
> hadn't figured out when replying that you had written an edited version
> of the same email (I'm presuming the first one bounced because of your
> From address, and you took the opportunity to edit it before resending
> it: but as the guy on the To line I received both copies, and then
> unwittingly quoted the earlier one back to the list.) Had I realized, I
> wouldn't have had that reaction, or quoted the earlier one publicly.
> Apologies: the bits, they move too fast for us (or for me anyway.)
>
> --
> Paul Phillips | The most dangerous man to any government is the man who
> Analgesic | is able to think things out [...] Almost inevitably he
> Empiricist | comes to the conclusion that the government he lives under
> ha! spill, pupil | is dishonest, insane, intolerable. -- H. L. Mencken
>
Tue, 2009-10-20, 21:57
#11
Re: class literals
Kevin,
You can use the Trac log facility to have an overall view of what changed.
Just browse:
http://lampsvn.epfl.ch/trac/scala/log/scala-documentation/trunk/src/refe...
and select the versions you would like to compare.
Toni
On Tue, October 20, 2009 9:50 pm, Kevin Wright wrote:
> I for one would love if there were a way to produce an annotated
> version showing diffs from the previous.
>
> I guess that would be hard, if not impossible, but is there anything
> else we can do to offer similar functionality?
>
Wed, 2009-10-21, 16:07
#12
Re: pdf documents (was: class literals)
I updated the nightly scripts; the pdf documents from trunk will be
automatically regenerated every night. They are now available in:
http://www.scala-lang.org/node/212/pdfs
Toni
Wed, 2009-10-21, 16:17
#13
Re: pdf documents (was: class literals)
Would it also be possible to generate the compiler scaladoc as part of
the nightly, in addition to the library scaladoc?
On Wed, Oct 21, 2009 at 4:04 PM, Antonio Cunei wrote:
> I updated the nightly scripts; the pdf documents from trunk will be
> automatically regenerated every night. They are now available in:
> http://www.scala-lang.org/node/212/pdfs
>
> Toni
>
>
Wed, 2009-10-21, 16:57
#14
Re: pdf documents
yes, I've made the necessary changes; we'll see tonight if all works ok.
Toni
Kevin Wright wrote:
> Would it also be possible to generate the compiler scaladoc as part of
> the nightly, in addition to the library scaladoc?
>
> On Wed, Oct 21, 2009 at 4:04 PM, Antonio Cunei wrote:
>> I updated the nightly scripts; the pdf documents from trunk will be
>> automatically regenerated every night. They are now available in:
>> http://www.scala-lang.org/node/212/pdfs
>>
>> Toni
>>
>>
>
Wed, 2009-10-21, 17:27
#15
Re: pdf documents
Thanks, I owe you a beer or two...
On Wed, Oct 21, 2009 at 4:56 PM, Antonio Cunei wrote:
> yes, I've made the necessary changes; we'll see tonight if all works ok.
> Toni
>
> Kevin Wright wrote:
>>
>> Would it also be possible to generate the compiler scaladoc as part of
>> the nightly, in addition to the library scaladoc?
>>
>> On Wed, Oct 21, 2009 at 4:04 PM, Antonio Cunei
>> wrote:
>>>
>>> I updated the nightly scripts; the pdf documents from trunk will be
>>> automatically regenerated every night. They are now available in:
>>> http://www.scala-lang.org/node/212/pdfs
>>>
>>> Toni
>>>
>>>
>>
>
>
Wed, 2009-10-21, 22:07
#16
Re: pdf documents (was: class literals)
ditto.
On Wed, Oct 21, 2009 at 4:10 PM, Kevin Wright <kev.lee.wright@googlemail.com> wrote:
On Wed, Oct 21, 2009 at 4:10 PM, Kevin Wright <kev.lee.wright@googlemail.com> wrote:
Would it also be possible to generate the compiler scaladoc as part of
the nightly, in addition to the library scaladoc?
On Wed, Oct 21, 2009 at 4:04 PM, Antonio Cunei <antonio.cunei@epfl.ch> wrote:
> I updated the nightly scripts; the pdf documents from trunk will be
> automatically regenerated every night. They are now available in:
> http://www.scala-lang.org/node/212/pdfs
>
> Toni
>
>
Sun, 2009-10-25, 09:47
#17
Re: pdf documents
The compiler scaladocs are now at:
http://www.scala-lang.org/node/212/docs/compiler
Toni
Kevin Wright wrote:
> Thanks, I owe you a beer or two...
>
> On Wed, Oct 21, 2009 at 4:56 PM, Antonio Cunei wrote:
>> yes, I've made the necessary changes; we'll see tonight if all works ok.
>> Toni
>>
>> Kevin Wright wrote:
>>> Would it also be possible to generate the compiler scaladoc as part of
>>> the nightly, in addition to the library scaladoc?
>>>
>>> On Wed, Oct 21, 2009 at 4:04 PM, Antonio Cunei
>>> wrote:
>>>> I updated the nightly scripts; the pdf documents from trunk will be
>>>> automatically regenerated every night. They are now available in:
>>>> http://www.scala-lang.org/node/212/pdfs
>>>>
>>>> Toni
>>>>
>>>>
>>
>
Sun, 2009-10-25, 13:27
#18
Re: pdf documents
Thanks again :)
On Sun, Oct 25, 2009 at 8:42 AM, Antonio Cunei wrote:
> The compiler scaladocs are now at:
> http://www.scala-lang.org/node/212/docs/compiler
> Toni
>
> Kevin Wright wrote:
>>
>> Thanks, I owe you a beer or two...
>>
>> On Wed, Oct 21, 2009 at 4:56 PM, Antonio Cunei
>> wrote:
>>>
>>> yes, I've made the necessary changes; we'll see tonight if all works ok.
>>> Toni
>>>
>>> Kevin Wright wrote:
>>>>
>>>> Would it also be possible to generate the compiler scaladoc as part of
>>>> the nightly, in addition to the library scaladoc?
>>>>
>>>> On Wed, Oct 21, 2009 at 4:04 PM, Antonio Cunei
>>>> wrote:
>>>>>
>>>>> I updated the nightly scripts; the pdf documents from trunk will be
>>>>> automatically regenerated every night. They are now available in:
>>>>> http://www.scala-lang.org/node/212/pdfs
>>>>>
>>>>> Toni
>>>>>
>>>>>
>>>
>>
>
>
The resolution was that class literals are, in fact, not literals.
I'll remove that bit from the spec. It does indeed read funny the way
it is written now. I have no idea how it got in there. It seems I
added these clauses, but I have not the dimmest recollection why.
Cheers