Mads Hartmann Jensen | 1 Sep 09:52 2010
Picon

Re: Using TextMate for Scala Development

If you give me a fancy sounding description of what you do I'd be happy to put it in ;) 

Also why can't I find you on the "The Scala Development Team" page? http://www.scala-lang.org/node/89

On Sep 1, 2010, at 12:27 AM, Alex Kravets wrote:

Yes, until Scala compiler has full support for Refinement Types and allows inline theorem-prover-checked specifications (ala to Sage) ... it ain't good enough :-)

On Tue, Aug 31, 2010 at 2:10 PM, Kevin Wright <kev.lee.wright <at> gmail.com> wrote:
Damn, who are you again?
You're obviously not putting out enough :)


On 31 August 2010 22:00, Paul Phillips <paulp <at> improving.org> wrote:
On Tue, Aug 31, 2010 at 08:45:39PM +0200, Mads Hartmann Jensen wrote:
> I wrote a blog post: "Using TextMate for Scala Development" and
> thought it might be interesting to some :)
> http://www.sidewayscoding.com/2010/08/using-textmate-for-scala-development.html

"Paul Phillips works on the Scala compiler (to my knowledge) "

What's a girl gotta do to get noticed in this town!

--
Paul Phillips      | We act as though comfort and luxury were the chief
Analgesic          | requirements of life, when all that we need to make us
Empiricist         | really happy is something to be enthusiastic about.
pp: i haul pills   |     -- Charles Kingsley



--
Kevin Wright

mail/google talk: kev.lee.wright <at> gmail.com
wave: kev.lee.wright <at> googlewave.com
skype: kev.lee.wright
twitter: <at> thecoda




--
Alex Kravets      (define red-pill 'lisp)
[[ brutal honesty is the best policy ]]


Lukas Rytz | 1 Sep 10:13 2010
Picon
Picon

Re: Using TextMate for Scala Development

On Wed, Sep 1, 2010 at 09:52, Mads Hartmann Jensen <mads379 <at> gmail.com> wrote:
If you give me a fancy sounding description of what you do I'd be happy to put it in ;) 

Also why can't I find you on the "The Scala Development Team" page? http://www.scala-lang.org/node/89

That's fixed now.
 

On Sep 1, 2010, at 12:27 AM, Alex Kravets wrote:

Yes, until Scala compiler has full support for Refinement Types and allows inline theorem-prover-checked specifications (ala to Sage) ... it ain't good enough :-)

On Tue, Aug 31, 2010 at 2:10 PM, Kevin Wright <kev.lee.wright <at> gmail.com> wrote:
Damn, who are you again?
You're obviously not putting out enough :)


On 31 August 2010 22:00, Paul Phillips <paulp <at> improving.org> wrote:
On Tue, Aug 31, 2010 at 08:45:39PM +0200, Mads Hartmann Jensen wrote:
> I wrote a blog post: "Using TextMate for Scala Development" and
> thought it might be interesting to some :)
> http://www.sidewayscoding.com/2010/08/using-textmate-for-scala-development.html

"Paul Phillips works on the Scala compiler (to my knowledge) "

What's a girl gotta do to get noticed in this town!

--
Paul Phillips      | We act as though comfort and luxury were the chief
Analgesic          | requirements of life, when all that we need to make us
Empiricist         | really happy is something to be enthusiastic about.
pp: i haul pills   |     -- Charles Kingsley



--
Kevin Wright

mail/google talk: kev.lee.wright <at> gmail.com
wave: kev.lee.wright <at> googlewave.com
skype: kev.lee.wright
twitter: <at> thecoda




--
Alex Kravets      (define red-pill 'lisp)
[[ brutal honesty is the best policy ]]



Gilles Dubochet | 1 Sep 14:57 2010
Picon

Re: Colladoc 1.0 Google Summer of Code Beta Public Announcement

> Today, I would like to announce the public availability of the new beta 
> of Colladoc. I call this version the “SoC beta” as it is the results of 
> my Google Summer of Code project.

I've been mentoring Petr througout this project, and I would like to 
congratulate him for his excellent work on Colladoc during his Google 
Summer of Code project. Colladoc is a complex piece of software that 
required many non-trivial problems to be solved. Petr has solved these 
problems with great results. His application, concentrating on the 
basic problems of the application (comment edition, history tracking, 
user management), is a solid starting point both to test the idea of 
"collaborative documentation" and for further developments.

I am looking forward to see how colladoc is taken up by the Scala 
community. It will hopefully quickly become a useful tool to improve 
the documentation of the Scala libraries. Already now, I strongly 
encourage anyone wishing to improve documentation to use Colladoc 
instead of submitting a bug report.

I am also very happy that Petr will continue working on Colladoc. I 
think that this is the best possible result for a Summer of Code 
project. If you are interested in joining the development of this 
exciting tool, I encourage you to take contact with Petr.

Cheers,
Gilles.

Olivier Pernet | 2 Sep 02:11 2010
Picon
Picon

Compiler plugin: how to access predefined types

Hi all,

Still working on my compiler plugin, and I need to retrieve the Type
for predefined types.
I'm currently using the following ugly kludge:

try { // fixme: hack
  definitions.getClass("scala." + tref.getName).tpe
} catch { case e: MissingRequirementError =>
  try {
    definitions.getClass("java.lang." + tref.getName).tpe
  } catch { case e: MissingRequirementError =>
    definitions.getClass("scala.Predef." + tref.getName).tpe
  }
}

Any better suggestions?

Olivier Pernet

We are the knights who say
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc

Paul Phillips | 2 Sep 03:37 2010

Re: Compiler plugin: how to access predefined types

On Thu, Sep 02, 2010 at 01:11:27AM +0100, Olivier Pernet wrote:
> Still working on my compiler plugin, and I need to retrieve the Type 
> for predefined types. I'm currently using the following ugly kludge:
> 
> try { // fixme: hack
>   definitions.getClass("scala." + tref.getName).tpe
> } catch { case e: MissingRequirementError =>
>   try {
>     definitions.getClass("java.lang." + tref.getName).tpe
>   } catch { case e: MissingRequirementError =>
>     definitions.getClass("scala.Predef." + tref.getName).tpe
>   }
> }

Some reason you can't look at the type members?

scala> import global._
import global._

scala> definitions.PredefModule.tpe.member("wrapIntArray")
res0: global.Symbol = method wrapIntArray

scala> definitions.PredefModule.tpe.member("notReallyAMethod")
res1: global.Symbol = <none>

scala> definitions.JavaLangPackage.tpe.member("String")
res2: global.Symbol = object String

scala> definitions.ScalaPackage.tpe.member("Immutable")
res3: global.Symbol = object Immutable

scala> definitions.PredefModule.tpe.nonPrivateMembers foreach println
method conforms
method arrayToCharSequence
method seqToCharSequence
method stringCanBuildFrom
method unaugmentString
method augmentString
method any2stringadd
method boolean2Boolean
method double2Double
method float2Float
method long2Long
method int2Integer
method char2Character
method short2Short
method byte2Byte
method float2double
method long2double
method long2float
method int2double
method int2float
method int2long
method char2double
...

--

-- 
Paul Phillips      | These are the climbs that apply men's soles.
Vivid              | 
Empiricist         | 
pull his pi pal!   |----------* http://www.improving.org/paulp/ *----------

Olivier Pernet | 2 Sep 04:02 2010
Picon
Picon

Re: Compiler plugin: how to access predefined types

Well, I don't know whether my pre-defined type will be from java.lang,
scala, or scala.Predef.
Is there a way to look up a name in all of them at once?

Olivier

On Thu, Sep 2, 2010 at 02:37, Paul Phillips <paulp <at> improving.org> wrote:
> On Thu, Sep 02, 2010 at 01:11:27AM +0100, Olivier Pernet wrote:
>> Still working on my compiler plugin, and I need to retrieve the Type
>> for predefined types. I'm currently using the following ugly kludge:
>>
>> try { // fixme: hack
>>   definitions.getClass("scala." + tref.getName).tpe
>> } catch { case e: MissingRequirementError =>
>>   try {
>>     definitions.getClass("java.lang." + tref.getName).tpe
>>   } catch { case e: MissingRequirementError =>
>>     definitions.getClass("scala.Predef." + tref.getName).tpe
>>   }
>> }
>
> Some reason you can't look at the type members?
>
> scala> import global._
> import global._
>
> scala> definitions.PredefModule.tpe.member("wrapIntArray")
> res0: global.Symbol = method wrapIntArray
>
> scala> definitions.PredefModule.tpe.member("notReallyAMethod")
> res1: global.Symbol = <none>
>
> scala> definitions.JavaLangPackage.tpe.member("String")
> res2: global.Symbol = object String
>
> scala> definitions.ScalaPackage.tpe.member("Immutable")
> res3: global.Symbol = object Immutable
>
> scala> definitions.PredefModule.tpe.nonPrivateMembers foreach println
> method conforms
> method arrayToCharSequence
> method seqToCharSequence
> method stringCanBuildFrom
> method unaugmentString
> method augmentString
> method any2stringadd
> method boolean2Boolean
> method double2Double
> method float2Float
> method long2Long
> method int2Integer
> method char2Character
> method short2Short
> method byte2Byte
> method float2double
> method long2double
> method long2float
> method int2double
> method int2float
> method int2long
> method char2double
> ...
>
> --
> Paul Phillips      | These are the climbs that apply men's soles.
> Vivid              |
> Empiricist         |
> pull his pi pal!   |----------* http://www.improving.org/paulp/ *----------
>

Paul Phillips | 2 Sep 04:35 2010

Re: Compiler plugin: how to access predefined types

On Thu, Sep 02, 2010 at 03:02:10AM +0100, Olivier Pernet wrote:
> Well, I don't know whether my pre-defined type will be from java.lang, 
> scala, or scala.Predef. Is there a way to look up a name in all of 
> them at once?

Sounds like somebody is ready for... Contexts!

scala> :power
** Power User mode enabled - BEEP BOOP      **
** scala.tools.nsc._ has been imported      **
** New vals! Try repl, global, power        **
** New cmds! :help to discover them         **
** New defs! Type power.<tab> to reveal     **

scala> import global._                            
import global._

scala> power.mkContext()                          
res0: power.compiler.analyzer.Context = [...]

scala> res0.imports                               
res1: List[power.compiler.analyzer.ImportInfo] = List(import scala.Predef._, import scala._,
import java.lang._)

scala> res1 flatMap (_.allImportedSymbols) sortBy (_.toString)
res2: List[power.compiler.analyzer.global.Symbol] = List(class <byname>, class <equals>, class
<repeated...>, class <repeated>, class AbstractMethodError, class AbstractStringBuilder, class
Annotation, class Any, class AnyVal, class Appendable, class Application, class
ApplicationShutdownHooks, class ApplicationShutdownHooks$1, class ArithmeticException, class
Array, class Array$, class Array$$anon$2, class Array$$anonfun$apply$1, class
Array$$anonfun$apply$10, class Array$$anonfun$apply$2, class Array$$anonfun$apply$3, class
Array$$anonfun$apply$4, class Array$$anonfun$apply$5, class Array$$anonfun$apply$6, class
Array$$anonfun$apply$7, class Array$$anonfun$apply$8, class Array$$anonfun$apply$9, class
Array$$anonfun$concat$1, class Array$$anonfun$concat$2, class Array$$anonfun$fill$1, ...

scala> res2 filter (x => x.isImplicit && x.tpe.resultType <:< definitions.IntClass.tpe) foreach println
method byte2int
method char2int
method short2int

--

-- 
Paul Phillips      | You think you know when you learn, are more sure
Future Perfect     | when you can write, even more when you can teach,
Empiricist         | but certain when you can program.  -- Alan Perlis
pal, i pill push   |----------* http://www.improving.org/paulp/ *----------

Olivier Pernet | 2 Sep 04:58 2010
Picon
Picon

Re: Compiler plugin: how to access predefined types

On Thu, Sep 2, 2010 at 03:35, Paul Phillips <paulp <at> improving.org> wrote:
> On Thu, Sep 02, 2010 at 03:02:10AM +0100, Olivier Pernet wrote:
>> Well, I don't know whether my pre-defined type will be from java.lang,
>> scala, or scala.Predef. Is there a way to look up a name in all of
>> them at once?
>
> Sounds like somebody is ready for... Contexts!
>
> scala> :power
> ** Power User mode enabled - BEEP BOOP      **
> ** scala.tools.nsc._ has been imported      **
> ** New vals! Try repl, global, power        **
> ** New cmds! :help to discover them         **
> ** New defs! Type power.<tab> to reveal     **

Level up! Someone wrote this late at night :)

> scala> import global._
> import global._
>
> scala> power.mkContext()
> res0: power.compiler.analyzer.Context = [...]

I'm not using this from the interpreter, is this really the best
compiled alternative:
global.analyzer.rootContext(new CompilationUnit(new
BatchSourceFile("<foo>", "")))

For reference: In the interpreter, in 2.8.0.final, mkContext takes a
String parameter, I set it to "" for the same results.

> scala> res0.imports
> res1: List[power.compiler.analyzer.ImportInfo] = List(import scala.Predef._, import scala._,
import java.lang._)
>
> scala> res1 flatMap (_.allImportedSymbols) sortBy (_.toString)
> res2: List[power.compiler.analyzer.global.Symbol] = List(class <byname>, class <equals>, class
<repeated...>, class <repeated>, class AbstractMethodError, class AbstractStringBuilder, class
Annotation, class Any, class AnyVal, class Appendable, class Application, class
ApplicationShutdownHooks, class ApplicationShutdownHooks$1, class ArithmeticException, class
Array, class Array$, class Array$$anon$2, class Array$$anonfun$apply$1, class
Array$$anonfun$apply$10, class Array$$anonfun$apply$2, class Array$$anonfun$apply$3, class
Array$$anonfun$apply$4, class Array$$anonfun$apply$5, class Array$$anonfun$apply$6, class
Array$$anonfun$apply$7, class Array$$anonfun$apply$8, class Array$$anonfun$apply$9, class
Array$$anonfun$concat$1, class Array$$anonfun$concat$2, class Array$$anonfun$fill$1, ...
>
> scala> res2 filter (x => x.isImplicit && x.tpe.resultType <:< definitions.IntClass.tpe) foreach println
> method byte2int
> method char2int
> method short2int

Nice! Just what I needed.

Cheers,
Olivier

Paul Phillips | 2 Sep 05:11 2010

Re: Compiler plugin: how to access predefined types

On Thu, Sep 02, 2010 at 03:58:09AM +0100, Olivier Pernet wrote:
> I'm not using this from the interpreter

I use the interpreter to demo because that's the easiest way, but the 
interpreter isn't anything more or less than a little guy huddled over 
his own compiler.  In other words, the implied message is always "if you 
want to do this, take a look at how the interpeter does it."

> is this really the best compiled alternative: 
> global.analyzer.rootContext(new CompilationUnit(new 
> BatchSourceFile("<foo>", "")))

We could take a look at how the interpreter does it:

  def mkContext(code: String = "") = compiler.analyzer.rootContext(mkUnit(code))
  def mkUnit(code: String) = new CompilationUnit(mkSourceFile(code))

Looks pretty darn similar.

> For reference: In the interpreter, in 2.8.0.final, mkContext takes a 
> String parameter, I set it to "" for the same results.

As you can see above, it doesn't.  I mean it does, but it has a default 
argument, which is how power.mkContext() turned up in my transcript 
without my having to falsify the history (as I of course enjoy doing 
like any red-blooded programmer.)

--

-- 
Paul Phillips      | Adultery is the application of democracy to love. 
Future Perfect     |     -- H. L. Mencken
Empiricist         | 
pp: i haul pills   |----------* http://www.improving.org/paulp/ *----------

Olivier Pernet | 2 Sep 05:11 2010
Picon
Picon

Re: Compiler plugin: how to access predefined types

Uh oh, it's not working quite right for me. I think you use a more recent build.

Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server
VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :power
** Power User mode enabled - BEEP BOOP      **
** scala.tools.nsc._ has been imported      **
** New vals! Try repl, global, power        **
** New cmds! :help to discover them         **
** New defs! Type power.<tab> to reveal     **

scala> val rootCtx = power.mkContext("")
rootCtx: power.compiler.analyzer.Context =
package <root>  <at>  class scala.reflect.generic.Trees$EmptyTree$ <empty>,
scope = 281202657 ...
...

scala> import global._
import global._

scala> rootCtx.imports flatMap (_.allImportedSymbols) filter (x =>
x.tpe <:< definitions.StringClass.tpe)
java.lang.AssertionError: assertion failed: trait
Function17.$anonfun$curried$1 linkedModule: <none>List()
	at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.innerSymbol$1(ClassfileParser.scala:1185)
	at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.classSymbol(ClassfileParser.scala:1197)
	at scala.tools.nsc.symtab.classfile.ClassfileParser.classNameToSymbol(ClassfileParser.scala:442)


Gmane