- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Wondering about REPL interaction
Tue, 2011-11-08, 19:59
Dear Scalarazzi,
The following trace has me wondering about the basics.
scala> case class Wonder( aboutYourself : String )case class Wonder( aboutYourself : String ) defined class Wonder
scala> val WonderOne = Wonder( "Gnossienne" )val WonderOne = Wonder( "Gnossienne" )WonderOne: Wonder = Wonder(Gnossienne)
scala> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }l2ns: (String) => java.lang.String = <function1>
scala> l2ns( "Wonder" )l2ns( "Wonder" )res15: java.lang.String = wonder
scala> WonderOne.getClass.getNameWonderOne.getClass.getName res16: java.lang.String = Wonder
scala> l2ns( WonderOne.getClass.getName )l2ns( WonderOne.getClass.getName )res17: java.lang.String = Wonder
scala>
Best wishes,
--greg
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
The following trace has me wondering about the basics.
scala> case class Wonder( aboutYourself : String )case class Wonder( aboutYourself : String ) defined class Wonder
scala> val WonderOne = Wonder( "Gnossienne" )val WonderOne = Wonder( "Gnossienne" )WonderOne: Wonder = Wonder(Gnossienne)
scala> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }l2ns: (String) => java.lang.String = <function1>
scala> l2ns( "Wonder" )l2ns( "Wonder" )res15: java.lang.String = wonder
scala> WonderOne.getClass.getNameWonderOne.getClass.getName res16: java.lang.String = Wonder
scala> l2ns( WonderOne.getClass.getName )l2ns( WonderOne.getClass.getName )res17: java.lang.String = Wonder
scala>
Best wishes,
--greg
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Tue, 2011-11-08, 20:37
#2
Re: Wondering about REPL interaction
It looks like there's some magic that's hiding repl-specific conventions:
scala> WonderOne.getClass.getName foreach print
$line1.$read$$iw$$iw$Wonder
scala> WonderOne.getClass.getName.take(3)
res20: String = $li
scala> WonderOne.getClass.getName.take(6)
res22: String = $line1
scala> WonderOne.getClass.getName.take(10)
res23: String = $line1.$re
scala> WonderOne.getClass.getName.take(20)
res25: String = $iw
scala> WonderOne.getClass.getName.take(100)
res26: String = Wonder
On Tue, Nov 8, 2011 at 10:59 AM, Meredith Gregory
wrote:
> Dear Scalarazzi,
> The following trace has me wondering about the basics.
>
> scala> case class Wonder( aboutYourself : String )
> case class Wonder( aboutYourself : String )
> defined class Wonder
> scala> val WonderOne = Wonder( "Gnossienne" )
> val WonderOne = Wonder( "Gnossienne" )
> WonderOne: Wonder = Wonder(Gnossienne)
> scala> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 )
> }
> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }
> l2ns: (String) => java.lang.String =
> scala> l2ns( "Wonder" )
> l2ns( "Wonder" )
> res15: java.lang.String = wonder
> scala> WonderOne.getClass.getName
> WonderOne.getClass.getName
> res16: java.lang.String = Wonder
> scala> l2ns( WonderOne.getClass.getName )
> l2ns( WonderOne.getClass.getName )
> res17: java.lang.String = Wonder
> scala>
> Best wishes,
> --greg
>
> --
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 7329 39th Ave SW
> Seattle, WA 98136
>
> +1 206.650.3740
>
> http://biosimilarity.blogspot.com
>
Tue, 2011-11-08, 20:47
#3
Re: Wondering about REPL interaction
Dear Seth and David,
Thanks! It's what i suspect, but it was great to get confirmation.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 11:15 AM, Seth Tisue <seth@tisue.net> wrote:
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Thanks! It's what i suspect, but it was great to get confirmation.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 11:15 AM, Seth Tisue <seth@tisue.net> wrote:
On Tue, Nov 8, 2011 at 1:59 PM, Meredith Gregory
<lgreg.meredith@gmail.com> wrote:
> Dear Scalarazzi,
> The following trace has me wondering about the basics.
One's first encounter with the REPL's class name tomfoolery can have
one doubting one's own sanity.
~ % scala29
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server
VM, Java 1.6.0_27).
scala> class C
defined class C
scala> classOf[C]
res0: java.lang.Class[C] = class C
scala> classOf[C].getName
res1: java.lang.String = C
scala> println(classOf[C].getName)
$line1.$read$$iw$$iw$C
println rips the curtain aside and reveals the REPL's shameful hijinks
when it thought no one was looking.
You can mess with its mind right back at it:
scala> "$line999999.$read$$iw$$iw$GOTCHA"
res11: java.lang.String = GOTCHA
Fooled you, REPL!
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Tue, 2011-11-08, 20:57
#4
RE: Wondering about REPL interaction
here’s a fuller workaround. Trust me, it took a while to write J
https://github.com/razie/razbase/blob/master/base/src/main/scala/razie/xp/BeanSolver.scala#L207
you have to hack all 3 Class methods to get name…
From: scala-user@googlegroups.com [mailto:scala-user@googlegroups.com] On Behalf Of Meredith Gregory
Sent: November-08-11 2:28 PM
To: Seth Tisue
Cc: scala-user
Subject: Re: [scala-user] Wondering about REPL interaction
Dear Seth and David,
Thanks! It's what i suspect, but it was great to get confirmation.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 11:15 AM, Seth Tisue <seth@tisue.net> wrote:
On Tue, Nov 8, 2011 at 1:59 PM, Meredith Gregory
<lgreg.meredith@gmail.com> wrote:
> Dear Scalarazzi,
> The following trace has me wondering about the basics.
One's first encounter with the REPL's class name tomfoolery can have
one doubting one's own sanity.
~ % scala29
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server
VM, Java 1.6.0_27).
scala> class C
defined class C
scala> classOf[C]
res0: java.lang.Class[C] = class C
scala> classOf[C].getName
res1: java.lang.String = C
scala> println(classOf[C].getName)
$line1.$read$$iw$$iw$C
println rips the curtain aside and reveals the REPL's shameful hijinks
when it thought no one was looking.
You can mess with its mind right back at it:
scala> "$line999999.$read$$iw$$iw$GOTCHA"
res11: java.lang.String = GOTCHA
Fooled you, REPL!
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SW
Seattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Wed, 2011-11-09, 04:07
#5
Re: Wondering about REPL interaction
Dear Scalarazzi,
It is interesting to see how this informs the beginner's experience. To my very simple mind and in my limited experience, something like this would be pretty confusing to me as a beginner. If i were to compare this to the experience of someone explaining a language feature in terms of a little mathematics -- even if the maths were something with which i was not familiar -- there wouldn't even be a contest. The trace below would represent a certain kind of cognitive disconnect that would have a lasting impact in terms of the design sensibilities it illustrates. Someone on the list using some unfamiliar maths would inspire me to learn more. The trace below is not inspiring me, yet.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 10:59 AM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
It is interesting to see how this informs the beginner's experience. To my very simple mind and in my limited experience, something like this would be pretty confusing to me as a beginner. If i were to compare this to the experience of someone explaining a language feature in terms of a little mathematics -- even if the maths were something with which i was not familiar -- there wouldn't even be a contest. The trace below would represent a certain kind of cognitive disconnect that would have a lasting impact in terms of the design sensibilities it illustrates. Someone on the list using some unfamiliar maths would inspire me to learn more. The trace below is not inspiring me, yet.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 10:59 AM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Scalarazzi,
The following trace has me wondering about the basics.
scala> case class Wonder( aboutYourself : String )case class Wonder( aboutYourself : String ) defined class Wonder
scala> val WonderOne = Wonder( "Gnossienne" )val WonderOne = Wonder( "Gnossienne" )WonderOne: Wonder = Wonder(Gnossienne)
scala> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }l2ns: (String) => java.lang.String = <function1>
scala> l2ns( "Wonder" )l2ns( "Wonder" )res15: java.lang.String = wonder
scala> WonderOne.getClass.getNameWonderOne.getClass.getName res16: java.lang.String = Wonder
scala> l2ns( WonderOne.getClass.getName )l2ns( WonderOne.getClass.getName )res17: java.lang.String = Wonder
scala>
Best wishes,
--greg
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Wed, 2011-11-09, 04:07
#6
Re: Re: Wondering about REPL interaction
What would you suggest?
On Tue, Nov 8, 2011 at 9:53 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
On Tue, Nov 8, 2011 at 9:53 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Scalarazzi,
It is interesting to see how this informs the beginner's experience. To my very simple mind and in my limited experience, something like this would be pretty confusing to me as a beginner. If i were to compare this to the experience of someone explaining a language feature in terms of a little mathematics -- even if the maths were something with which i was not familiar -- there wouldn't even be a contest. The trace below would represent a certain kind of cognitive disconnect that would have a lasting impact in terms of the design sensibilities it illustrates. Someone on the list using some unfamiliar maths would inspire me to learn more. The trace below is not inspiring me, yet.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 10:59 AM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Scalarazzi,
The following trace has me wondering about the basics.
scala> case class Wonder( aboutYourself : String )case class Wonder( aboutYourself : String ) defined class Wonder
scala> val WonderOne = Wonder( "Gnossienne" )val WonderOne = Wonder( "Gnossienne" )WonderOne: Wonder = Wonder(Gnossienne)
scala> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }l2ns: (String) => java.lang.String = <function1>
scala> l2ns( "Wonder" )l2ns( "Wonder" )res15: java.lang.String = wonder
scala> WonderOne.getClass.getNameWonderOne.getClass.getName res16: java.lang.String = Wonder
scala> l2ns( WonderOne.getClass.getName )l2ns( WonderOne.getClass.getName )res17: java.lang.String = Wonder
scala>
Best wishes,
--greg
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Wed, 2011-11-09, 04:27
#7
Re: Re: Wondering about REPL interaction
Dear Naftoli,
Thanks for asking! i'm not inspired, yet. Certainly, consistency suggests that
Best wishes,
--greg
On Tue, Nov 8, 2011 at 6:58 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Thanks for asking! i'm not inspired, yet. Certainly, consistency suggests that
- whenever a == b, f( a ) == f( b ) for any function f.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 6:58 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
What would you suggest?
On Tue, Nov 8, 2011 at 9:53 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Scalarazzi,
It is interesting to see how this informs the beginner's experience. To my very simple mind and in my limited experience, something like this would be pretty confusing to me as a beginner. If i were to compare this to the experience of someone explaining a language feature in terms of a little mathematics -- even if the maths were something with which i was not familiar -- there wouldn't even be a contest. The trace below would represent a certain kind of cognitive disconnect that would have a lasting impact in terms of the design sensibilities it illustrates. Someone on the list using some unfamiliar maths would inspire me to learn more. The trace below is not inspiring me, yet.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 10:59 AM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Scalarazzi,
The following trace has me wondering about the basics.
scala> case class Wonder( aboutYourself : String )case class Wonder( aboutYourself : String ) defined class Wonder
scala> val WonderOne = Wonder( "Gnossienne" )val WonderOne = Wonder( "Gnossienne" )WonderOne: Wonder = Wonder(Gnossienne)
scala> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }l2ns: (String) => java.lang.String = <function1>
scala> l2ns( "Wonder" )l2ns( "Wonder" )res15: java.lang.String = wonder
scala> WonderOne.getClass.getNameWonderOne.getClass.getName res16: java.lang.String = Wonder
scala> l2ns( WonderOne.getClass.getName )l2ns( WonderOne.getClass.getName )res17: java.lang.String = Wonder
scala>
Best wishes,
--greg
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Wed, 2011-11-09, 05:17
#8
Re: Re: Wondering about REPL interaction
So you would have it work like this?
scala> WonderOne.getClass
$line1.$read$$iw$$iw$Wonder
On Tue, Nov 8, 2011 at 10:15 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
scala> WonderOne.getClass
$line1.$read$$iw$$iw$Wonder
On Tue, Nov 8, 2011 at 10:15 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Naftoli,
Thanks for asking! i'm not inspired, yet. Certainly, consistency suggests thatSimplicity might suggest that for inhabitants of ground types, at least, evidently equal elements are actually equal. Transparency might chime in that the print representation of strings commit to full disclosure. Personally, i bend my ear to simplicity and transparency over convenience. Consistency also gets slightly preferential treatment.
- whenever a == b, f( a ) == f( b ) for any function f.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 6:58 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
What would you suggest?
On Tue, Nov 8, 2011 at 9:53 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Scalarazzi,
It is interesting to see how this informs the beginner's experience. To my very simple mind and in my limited experience, something like this would be pretty confusing to me as a beginner. If i were to compare this to the experience of someone explaining a language feature in terms of a little mathematics -- even if the maths were something with which i was not familiar -- there wouldn't even be a contest. The trace below would represent a certain kind of cognitive disconnect that would have a lasting impact in terms of the design sensibilities it illustrates. Someone on the list using some unfamiliar maths would inspire me to learn more. The trace below is not inspiring me, yet.
Best wishes,
--greg
On Tue, Nov 8, 2011 at 10:59 AM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Scalarazzi,
The following trace has me wondering about the basics.
scala> case class Wonder( aboutYourself : String )case class Wonder( aboutYourself : String ) defined class Wonder
scala> val WonderOne = Wonder( "Gnossienne" )val WonderOne = Wonder( "Gnossienne" )WonderOne: Wonder = Wonder(Gnossienne)
scala> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }l2ns: (String) => java.lang.String = <function1>
scala> l2ns( "Wonder" )l2ns( "Wonder" )res15: java.lang.String = wonder
scala> WonderOne.getClass.getNameWonderOne.getClass.getName res16: java.lang.String = Wonder
scala> l2ns( WonderOne.getClass.getName )l2ns( WonderOne.getClass.getName )res17: java.lang.String = Wonder
scala>
Best wishes,
--greg
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Wed, 2011-11-09, 05:48
#9
Re: Re: Wondering about REPL interaction
On Wed, Nov 9, 2011 at 00:53, Meredith Gregory wrote:
> Dear Scalarazzi,
> It is interesting to see how this informs the beginner's experience. To my
> very simple mind and in my limited experience, something like this would be
> pretty confusing to me as a beginner. If i were to compare this to the
> experience of someone explaining a language feature in terms of a little
> mathematics -- even if the maths were something with which i was not
> familiar -- there wouldn't even be a contest. The trace below would
> represent a certain kind of cognitive disconnect that would have a lasting
> impact in terms of the design sensibilities it illustrates. Someone on the
> list using some unfamiliar maths would inspire me to learn more. The trace
> below is not inspiring me, yet.
IMHO, a beginner has no business doing reflection.
> Best wishes,
> --greg
>
> On Tue, Nov 8, 2011 at 10:59 AM, Meredith Gregory
> wrote:
>>
>> Dear Scalarazzi,
>> The following trace has me wondering about the basics.
>>
>> scala> case class Wonder( aboutYourself : String )
>> case class Wonder( aboutYourself : String )
>> defined class Wonder
>> scala> val WonderOne = Wonder( "Gnossienne" )
>> val WonderOne = Wonder( "Gnossienne" )
>> WonderOne: Wonder = Wonder(Gnossienne)
>> scala> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1
>> ) }
>> val l2ns = ( s : String ) => { s.take( 1 ).toLowerCase + s.drop( 1 ) }
>> l2ns: (String) => java.lang.String =
>> scala> l2ns( "Wonder" )
>> l2ns( "Wonder" )
>> res15: java.lang.String = wonder
>> scala> WonderOne.getClass.getName
>> WonderOne.getClass.getName
>> res16: java.lang.String = Wonder
>> scala> l2ns( WonderOne.getClass.getName )
>> l2ns( WonderOne.getClass.getName )
>> res17: java.lang.String = Wonder
>> scala>
>> Best wishes,
>> --greg
>>
>> --
>> L.G. Meredith
>> Managing Partner
>> Biosimilarity LLC
>> 7329 39th Ave SW
>> Seattle, WA 98136
>>
>> +1 206.650.3740
>>
>> http://biosimilarity.blogspot.com
>
>
>
> --
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 7329 39th Ave SW
> Seattle, WA 98136
>
> +1 206.650.3740
>
> http://biosimilarity.blogspot.com
>
Wed, 2011-11-09, 12:57
#10
Re: Re: Wondering about REPL interaction
On Tue, Nov 8, 2011 at 11:13 PM, Naftoli Gugenheim wrote:
> So you would have it work like this?
> scala> WonderOne.getClass
> $line1.$read$$iw$$iw$Wonder
I'm more comfortable with the REPL printing some Class instances
specially, much less comfortable with certain Strings being printed
differently...!
Thu, 2011-11-10, 03:27
#11
Re: Re: Wondering about REPL interaction
Dear Seth, Naftoli and other interested Scalarazzi,
Here's a solution that occurred to me based on standard practice. Many REPLs have an elision convention for the print representations of instances that would otherwise be too large to print. A great example is circular structures. Their print representations can often be successfully elided.
With an elision convention in hand we could make convenient, concise and readable print representation for the names of classes that disambiguates them from the truncated strings the REPL currently uses. Using the running example,
> WonderOne.getClass[...]Wonder
would be a possible response. It really depends on finding a workable elision convention. This is not necessarily an inspired solution, but one of a family of possibilities drawn from standard practice.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 3:50 AM, Seth Tisue <seth@tisue.net> wrote:
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Here's a solution that occurred to me based on standard practice. Many REPLs have an elision convention for the print representations of instances that would otherwise be too large to print. A great example is circular structures. Their print representations can often be successfully elided.
With an elision convention in hand we could make convenient, concise and readable print representation for the names of classes that disambiguates them from the truncated strings the REPL currently uses. Using the running example,
> WonderOne.getClass[...]Wonder
would be a possible response. It really depends on finding a workable elision convention. This is not necessarily an inspired solution, but one of a family of possibilities drawn from standard practice.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 3:50 AM, Seth Tisue <seth@tisue.net> wrote:
On Tue, Nov 8, 2011 at 11:13 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
> So you would have it work like this?
> scala> WonderOne.getClass
> $line1.$read$$iw$$iw$Wonder
I'm more comfortable with the REPL printing some Class instances
specially, much less comfortable with certain Strings being printed
differently...!
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Thu, 2011-11-10, 04:17
#12
Re: Re: Wondering about REPL interaction
Not taking any position here, but I think the reasoning behind the current behavior is that the REPL should act as a preview of what will happen when you run code standalone. In other words the results should be the same. You would have to ask paulp, who doesn't follow scala-user anymore, so I added scala-debate to the CC list.
On Wed, Nov 9, 2011 at 9:11 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
On Wed, Nov 9, 2011 at 9:11 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Seth, Naftoli and other interested Scalarazzi,
Here's a solution that occurred to me based on standard practice. Many REPLs have an elision convention for the print representations of instances that would otherwise be too large to print. A great example is circular structures. Their print representations can often be successfully elided.
With an elision convention in hand we could make convenient, concise and readable print representation for the names of classes that disambiguates them from the truncated strings the REPL currently uses. Using the running example,
> WonderOne.getClass[...]Wonder
would be a possible response. It really depends on finding a workable elision convention. This is not necessarily an inspired solution, but one of a family of possibilities drawn from standard practice.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 3:50 AM, Seth Tisue <seth@tisue.net> wrote:
On Tue, Nov 8, 2011 at 11:13 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
> So you would have it work like this?
> scala> WonderOne.getClass
> $line1.$read$$iw$$iw$Wonder
I'm more comfortable with the REPL printing some Class instances
specially, much less comfortable with certain Strings being printed
differently...!
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Thu, 2011-11-10, 04:17
#13
Re: Re: Wondering about REPL interaction
Not taking any position here, but I think the reasoning behind the current behavior is that the REPL should act as a preview of what will happen when you run code standalone. In other words the results should be the same. You would have to ask paulp, who doesn't follow scala-user anymore, so I added scala-debate to the CC list.
On Wed, Nov 9, 2011 at 9:11 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
On Wed, Nov 9, 2011 at 9:11 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Seth, Naftoli and other interested Scalarazzi,
Here's a solution that occurred to me based on standard practice. Many REPLs have an elision convention for the print representations of instances that would otherwise be too large to print. A great example is circular structures. Their print representations can often be successfully elided.
With an elision convention in hand we could make convenient, concise and readable print representation for the names of classes that disambiguates them from the truncated strings the REPL currently uses. Using the running example,
> WonderOne.getClass[...]Wonder
would be a possible response. It really depends on finding a workable elision convention. This is not necessarily an inspired solution, but one of a family of possibilities drawn from standard practice.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 3:50 AM, Seth Tisue <seth@tisue.net> wrote:
On Tue, Nov 8, 2011 at 11:13 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
> So you would have it work like this?
> scala> WonderOne.getClass
> $line1.$read$$iw$$iw$Wonder
I'm more comfortable with the REPL printing some Class instances
specially, much less comfortable with certain Strings being printed
differently...!
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Thu, 2011-11-10, 04:27
#14
Re: Re: Wondering about REPL interaction
Dear Naftoli,
Thanks for clarifying this laudable goal! i believe that the elision-convention-based approach is compatible. The elision can be successfully overloaded to mean "this bit will not be relevant when you run your code". Such an overload is perfectly aligned with conventions in multiple disciplines. So, even a beginner, such as myself, will be alerted to subtle differences between instances while still being guided by the REPL as to what ought to happen during execution -- if justice prevails.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:06 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Thanks for clarifying this laudable goal! i believe that the elision-convention-based approach is compatible. The elision can be successfully overloaded to mean "this bit will not be relevant when you run your code". Such an overload is perfectly aligned with conventions in multiple disciplines. So, even a beginner, such as myself, will be alerted to subtle differences between instances while still being guided by the REPL as to what ought to happen during execution -- if justice prevails.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:06 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
Not taking any position here, but I think the reasoning behind the current behavior is that the REPL should act as a preview of what will happen when you run code standalone. In other words the results should be the same. You would have to ask paulp, who doesn't follow scala-user anymore, so I added scala-debate to the CC list.
On Wed, Nov 9, 2011 at 9:11 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:Dear Seth, Naftoli and other interested Scalarazzi,
Here's a solution that occurred to me based on standard practice. Many REPLs have an elision convention for the print representations of instances that would otherwise be too large to print. A great example is circular structures. Their print representations can often be successfully elided.
With an elision convention in hand we could make convenient, concise and readable print representation for the names of classes that disambiguates them from the truncated strings the REPL currently uses. Using the running example,
> WonderOne.getClass[...]Wonder
would be a possible response. It really depends on finding a workable elision convention. This is not necessarily an inspired solution, but one of a family of possibilities drawn from standard practice.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 3:50 AM, Seth Tisue <seth@tisue.net> wrote:
On Tue, Nov 8, 2011 at 11:13 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
> So you would have it work like this?
> scala> WonderOne.getClass
> $line1.$read$$iw$$iw$Wonder
I'm more comfortable with the REPL printing some Class instances
specially, much less comfortable with certain Strings being printed
differently...!
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Thu, 2011-11-10, 04:27
#15
Re: Re: Wondering about REPL interaction
Dear Naftoli,
Thanks for clarifying this laudable goal! i believe that the elision-convention-based approach is compatible. The elision can be successfully overloaded to mean "this bit will not be relevant when you run your code". Such an overload is perfectly aligned with conventions in multiple disciplines. So, even a beginner, such as myself, will be alerted to subtle differences between instances while still being guided by the REPL as to what ought to happen during execution -- if justice prevails.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:06 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Thanks for clarifying this laudable goal! i believe that the elision-convention-based approach is compatible. The elision can be successfully overloaded to mean "this bit will not be relevant when you run your code". Such an overload is perfectly aligned with conventions in multiple disciplines. So, even a beginner, such as myself, will be alerted to subtle differences between instances while still being guided by the REPL as to what ought to happen during execution -- if justice prevails.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:06 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
Not taking any position here, but I think the reasoning behind the current behavior is that the REPL should act as a preview of what will happen when you run code standalone. In other words the results should be the same. You would have to ask paulp, who doesn't follow scala-user anymore, so I added scala-debate to the CC list.
On Wed, Nov 9, 2011 at 9:11 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:Dear Seth, Naftoli and other interested Scalarazzi,
Here's a solution that occurred to me based on standard practice. Many REPLs have an elision convention for the print representations of instances that would otherwise be too large to print. A great example is circular structures. Their print representations can often be successfully elided.
With an elision convention in hand we could make convenient, concise and readable print representation for the names of classes that disambiguates them from the truncated strings the REPL currently uses. Using the running example,
> WonderOne.getClass[...]Wonder
would be a possible response. It really depends on finding a workable elision convention. This is not necessarily an inspired solution, but one of a family of possibilities drawn from standard practice.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 3:50 AM, Seth Tisue <seth@tisue.net> wrote:
On Tue, Nov 8, 2011 at 11:13 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
> So you would have it work like this?
> scala> WonderOne.getClass
> $line1.$read$$iw$$iw$Wonder
I'm more comfortable with the REPL printing some Class instances
specially, much less comfortable with certain Strings being printed
differently...!
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Mon, 2011-12-19, 16:31
#16
Re: Re: Wondering about REPL interaction
Dear Scalarazzi,
Apparently the issue has nothing to do with reflection, but with string formats.
scala> s2s2res23: java.lang.String = CC1
scala> s2.substring( 0, 1 )s2.substring( 0, 1 )res24: java.lang.String = $
scala> println( s2 )println( s2 )$line1.$read$$iw$$iw$CC1
scala>
This trace happens because
scala> val s2 = "$line1.$read$$iw$$iw$CC1"val s2 = "$line1.$read$$iw$$iw$CC1" s2: java.lang.String = CC1
scala>
was executed just previously.
So, basic string manipulation will be an intriguing experience for the Java developer trying out Scala and attempting to use the Scala REPL on strings with certain formats.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:22 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Apparently the issue has nothing to do with reflection, but with string formats.
scala> s2s2res23: java.lang.String = CC1
scala> s2.substring( 0, 1 )s2.substring( 0, 1 )res24: java.lang.String = $
scala> println( s2 )println( s2 )$line1.$read$$iw$$iw$CC1
scala>
This trace happens because
scala> val s2 = "$line1.$read$$iw$$iw$CC1"val s2 = "$line1.$read$$iw$$iw$CC1" s2: java.lang.String = CC1
scala>
was executed just previously.
So, basic string manipulation will be an intriguing experience for the Java developer trying out Scala and attempting to use the Scala REPL on strings with certain formats.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:22 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Naftoli,
Thanks for clarifying this laudable goal! i believe that the elision-convention-based approach is compatible. The elision can be successfully overloaded to mean "this bit will not be relevant when you run your code". Such an overload is perfectly aligned with conventions in multiple disciplines. So, even a beginner, such as myself, will be alerted to subtle differences between instances while still being guided by the REPL as to what ought to happen during execution -- if justice prevails.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:06 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
Not taking any position here, but I think the reasoning behind the current behavior is that the REPL should act as a preview of what will happen when you run code standalone. In other words the results should be the same. You would have to ask paulp, who doesn't follow scala-user anymore, so I added scala-debate to the CC list.
On Wed, Nov 9, 2011 at 9:11 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:Dear Seth, Naftoli and other interested Scalarazzi,
Here's a solution that occurred to me based on standard practice. Many REPLs have an elision convention for the print representations of instances that would otherwise be too large to print. A great example is circular structures. Their print representations can often be successfully elided.
With an elision convention in hand we could make convenient, concise and readable print representation for the names of classes that disambiguates them from the truncated strings the REPL currently uses. Using the running example,
> WonderOne.getClass[...]Wonder
would be a possible response. It really depends on finding a workable elision convention. This is not necessarily an inspired solution, but one of a family of possibilities drawn from standard practice.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 3:50 AM, Seth Tisue <seth@tisue.net> wrote:
On Tue, Nov 8, 2011 at 11:13 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
> So you would have it work like this?
> scala> WonderOne.getClass
> $line1.$read$$iw$$iw$Wonder
I'm more comfortable with the REPL printing some Class instances
specially, much less comfortable with certain Strings being printed
differently...!
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Mon, 2011-12-19, 16:31
#17
Re: Re: Wondering about REPL interaction
Dear Scalarazzi,
Apparently the issue has nothing to do with reflection, but with string formats.
scala> s2s2res23: java.lang.String = CC1
scala> s2.substring( 0, 1 )s2.substring( 0, 1 )res24: java.lang.String = $
scala> println( s2 )println( s2 )$line1.$read$$iw$$iw$CC1
scala>
This trace happens because
scala> val s2 = "$line1.$read$$iw$$iw$CC1"val s2 = "$line1.$read$$iw$$iw$CC1" s2: java.lang.String = CC1
scala>
was executed just previously.
So, basic string manipulation will be an intriguing experience for the Java developer trying out Scala and attempting to use the Scala REPL on strings with certain formats.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:22 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Apparently the issue has nothing to do with reflection, but with string formats.
scala> s2s2res23: java.lang.String = CC1
scala> s2.substring( 0, 1 )s2.substring( 0, 1 )res24: java.lang.String = $
scala> println( s2 )println( s2 )$line1.$read$$iw$$iw$CC1
scala>
This trace happens because
scala> val s2 = "$line1.$read$$iw$$iw$CC1"val s2 = "$line1.$read$$iw$$iw$CC1" s2: java.lang.String = CC1
scala>
was executed just previously.
So, basic string manipulation will be an intriguing experience for the Java developer trying out Scala and attempting to use the Scala REPL on strings with certain formats.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:22 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Naftoli,
Thanks for clarifying this laudable goal! i believe that the elision-convention-based approach is compatible. The elision can be successfully overloaded to mean "this bit will not be relevant when you run your code". Such an overload is perfectly aligned with conventions in multiple disciplines. So, even a beginner, such as myself, will be alerted to subtle differences between instances while still being guided by the REPL as to what ought to happen during execution -- if justice prevails.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 7:06 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
Not taking any position here, but I think the reasoning behind the current behavior is that the REPL should act as a preview of what will happen when you run code standalone. In other words the results should be the same. You would have to ask paulp, who doesn't follow scala-user anymore, so I added scala-debate to the CC list.
On Wed, Nov 9, 2011 at 9:11 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:Dear Seth, Naftoli and other interested Scalarazzi,
Here's a solution that occurred to me based on standard practice. Many REPLs have an elision convention for the print representations of instances that would otherwise be too large to print. A great example is circular structures. Their print representations can often be successfully elided.
With an elision convention in hand we could make convenient, concise and readable print representation for the names of classes that disambiguates them from the truncated strings the REPL currently uses. Using the running example,
> WonderOne.getClass[...]Wonder
would be a possible response. It really depends on finding a workable elision convention. This is not necessarily an inspired solution, but one of a family of possibilities drawn from standard practice.
Best wishes,
--greg
On Wed, Nov 9, 2011 at 3:50 AM, Seth Tisue <seth@tisue.net> wrote:
On Tue, Nov 8, 2011 at 11:13 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
> So you would have it work like this?
> scala> WonderOne.getClass
> $line1.$read$$iw$$iw$Wonder
I'm more comfortable with the REPL printing some Class instances
specially, much less comfortable with certain Strings being printed
differently...!
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
On Tue, Nov 8, 2011 at 1:59 PM, Meredith Gregory
wrote:
> Dear Scalarazzi,
> The following trace has me wondering about the basics.
One's first encounter with the REPL's class name tomfoolery can have
one doubting one's own sanity.
~ % scala29
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server
VM, Java 1.6.0_27).
scala> class C
defined class C
scala> classOf[C]
res0: java.lang.Class[C] = class C
scala> classOf[C].getName
res1: java.lang.String = C
scala> println(classOf[C].getName)
$line1.$read$$iw$$iw$C
println rips the curtain aside and reveals the REPL's shameful hijinks
when it thought no one was looking.
You can mess with its mind right back at it:
scala> "$line999999.$read$$iw$$iw$GOTCHA"
res11: java.lang.String = GOTCHA
Fooled you, REPL!