This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Scripting profiles for Scala.

63 replies
Razvan Cojocaru 3
Joined: 2010-07-28,
User offline. Last seen 42 years 45 weeks ago.
RE: Re: Re: Scripting profiles for Scala.

That’s to some extent what I had suggested. The same way the java compiler is configured to ignore or mark as a warning/error certain constructs (in Eclipse, go to preferences/java/compiler/Errors/Warning). These can show as compilation errors and are underlined by the editor as well. It’s also familiar to developers.

 

I don’t have an insight into the intricacies of doing this – I’m assuming it would be command line flags and/or property files. In terms of implementation, it should be strait in the compiler – don’t know if a compiler plugin would cut it… it’s for more knowledgeable minds to figure that one out J

 

Note that it’s possible that we could use FindBugs for this purpose as well – I believe it is fairly well integrated into the editors? I haven’t’ used it in a while…

 

Then, you’re free to configure your own profile. Martin’s levels would be the “standard” sets of switches but you could certainly make up your own.

 

Is there some reason this doesn’t make sense?

 

Yes, I have a fair experience in teaching and mentoring (both below and above but not high-school level, it’s true) but more importantly overseeing tens of interacting developers, which is why I started one of the older discussions about this. I guess we agree here though… hmm, no flame to start J Yeah, the error messages are not always helpful.

 

Anyways gents, do we live it like this once more or do we do something about it? I can’t afford to set this up, but I’d help. I guess something will start when there’s enough demand for it… is this that time?

 

Thanks,

Razie

 

From: scala-debate [at] googlegroups [dot] com [mailto:scala-debate [at] googlegroups [dot] com] On Behalf Of Kevin Wright
Sent: April-04-11 10:16 AM
To: Seth Tisue
Cc: scala-debate [at] googlegroups [dot] com
Subject: Re: [scala-debate] Re: [scala-user] Re: Scripting profiles for Scala.

 

How here's an idea...

 

 

Instead of outright banning certain features, how about a code-coverage-style static analysis tool?  Annotated source with lines colour coded according to some preconceived notion of "risk".

 

 

On 4 April 2011 15:10, Seth Tisue <seth [at] tisue [dot] net> wrote:

>>>>> "Philippe" == Philippe Lhoste <PhiLho [at] GMX [dot] net> writes:

(replying on scala-debate instead. please, could others still discussing
this on scala-user do the same?)

 Philippe> I was wondering when someone will mention Kojo... If not, I
 Philippe> would have pointed to it.  It is a friendly environment
 Philippe> (based on NetBeans platform, with auto-completion, variable
 Philippe> inspection and such) aimed at kids. Yet, it leaves full
 Philippe> access to Scala.

I think the big problem is the error messages.  The Racket/PLT people
have written a lot about this.

 Philippe> If a student hears of folderLeft (one can surf...) and wants
 Philippe> to try it, why forbid access to the feature?

It doesn't need to be "forbid".  It could alert you that you used
something that isn't in your current subset, and ask if you want to move
to the larger subset.

 Philippe> Yes, they can misuse a feature, make errors, forget one dot
 Philippe> where it is needed, try things. But it won't break anything,
 Philippe> they will get error messages, will learn and progress from
 Philippe> mistakes. That's the essence of education, no?

Well, you can't just sweep real teaching difficulties under the rug by
saying that anytime something goes wrong, "that's the essence of
education."  Problems and barriers multiply and accumulate, and the more
they pile up, the more students you start to lose.

An honest question (this is not directed at Philippe specifically):

Y'all who seem opposed (and some of you downright enraged and
belligerent; can't you see it's self-defeating?) to this idea of
subsetting, how much time have you spent teaching programming to college
students?  high school students?  middle school students?  etc.
"I taught my kid" doesn't count.  It's easy to get locked into a
professional-programmer, hacker-from-birth perspective and lose sight of
the fact that it's a big world out there.

--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/




--
Kevin Wright

gtalk / msn : kev [dot] lee [dot] wright [at] gmail [dot] com

mail: kevin [dot] wright [at] scalatechnology [dot] com

vibe / skype: kev.lee.wright

quora: http://www.quora.com/Kevin-Wright
twitter: @thecoda

 

"My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra

 

John Nilsson
Joined: 2008-12-20,
User offline. Last seen 42 years 45 weeks ago.
Re: Scripting profiles for Scala.

Maybe Scala is not the correct host language for your DSL?

You can use Scala as an implementation language, but provide the
interface for your library through some external language like Lua
(http://www.lua.org/).

You could write an interpreter using Scalas parser combinators, not
that hard actually.

If you require IDE support for your DSL there are tools like XText
(http://www.eclipse.org/Xtext/)

Just some suggestions.

BR,
John

On Sat, Apr 2, 2011 at 8:42 PM, Lex wrote:
> I am looking for a scripting environment for designers who less
> familiar with programming.
> I really like Scala, but many people I have personally ask find Scala
> features overwhelming. How difficult would it be to restrict Scala to
> a subset of normal functionality. Say, removing "operator
> overloading", parametrization, types, and pretty much leaving a
> javaScript like features.
> Maybe there is a framework out there that offers "limited profiles"
> with a restricted subset of Scala features.
>

John Nilsson
Joined: 2008-12-20,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Re: Scripting profiles for Scala.

Another idea.

Extending the use case beyond education, there are other reasons to
want to restrict how an API is used. After all that is why we use
types.

So, a more general approach to the issue would be implement the
subsetting as extensions to the type system. Maybe the way to do this
is to provide som nice hooks and a framework to make it easier
(assuming there are some resitance to writing a compiler plug-in).

F.ex. I've been looking at checker-framework
(http://types.cs.washington.edu/checker-framework/) recently for this
reason.

BR,
John

Philippe Lhoste
Joined: 2010-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Scripting profiles for Scala.

On 04/04/2011 16:10, Seth Tisue wrote:
> I think the big problem is the error messages. The Racket/PLT people
> have written a lot about this.

Sure, but it is rather a problem with the compiler. Not throwing a stone here, as I know
that writing sensible error messages (ie. understandable by the newbie, being on the right
line, one the exact problem, etc.) is very difficult.

> It doesn't need to be "forbid". It could alert you that you used
> something that isn't in your current subset, and ask if you want to move
> to the larger subset.

Mmm, unsure of the usefulness, except that the student will see this as going to the next
(game) level... :-)

> Well, you can't just sweep real teaching difficulties under the rug by
> saying that anytime something goes wrong, "that's the essence of
> education." Problems and barriers multiply and accumulate, and the more
> they pile up, the more students you start to lose.
>
> An honest question (this is not directed at Philippe specifically):
>
> Y'all who seem opposed (and some of you downright enraged and
> belligerent; can't you see it's self-defeating?) to this idea of
> subsetting, how much time have you spent teaching programming to college
> students? high school students? middle school students? etc.
> "I taught my kid" doesn't count. It's easy to get locked into a
> professional-programmer, hacker-from-birth perspective and lose sight of
> the fact that it's a big world out there.

I am a beginner in the Scala programming field, so at least I can see some difficulties
from this point of view. Although I am quite experienced in programming, in Java and in
other programming languages, so my view is indeed biased.

I answer lot of questions from total newbies to more experienced programmers in the
Processing forum . There, lot of people start programming with this
environment, so at least I get an idea of the most common errors and questions newbies have.

Of course, it is not as valuable as people in direct contact with "real" students... :-)

Seth Tisue
Joined: 2008-12-16,
User offline. Last seen 34 weeks 3 days ago.
Re: Re: Re: Scripting profiles for Scala.

>>>>> "Philippe" == Philippe Lhoste writes:

>> I think the big problem is the error messages. The Racket/PLT
>> people have written a lot about this.

Philippe> Sure, but it is rather a problem with the compiler. Not
Philippe> throwing a stone here, as I know that writing sensible error
Philippe> messages (ie. understandable by the newbie, being on the
Philippe> right line, one the exact problem, etc.) is very difficult.

It becomes a lot easier to emit beginner-friendly error messages if you
subset the language. It's one of the big motivations for subsetting.

jibal
Joined: 2010-12-01,
User offline. Last seen 1 year 45 weeks ago.
Re: Scripting profiles for Scala.
On Mon, Apr 4, 2011 at 6:44 AM, Peter C. Chapin <PChapin [at] vtc [dot] vsc [dot] edu> wrote:
On Sun, 3 Apr 2011, Lex wrote:

Please prove me wrong and give some reason WHY you think having Scala profiles is a bad idea. I understand that some of you hate it. The question is WHY. All I am looking for is for you to elaborate your position. For my part I have done plenty of elaboration without going out of the way to insult anyone.

Although I don't have a problem with the idea of subsetting Scala, I can think of one potential difficulty: it might be very hard to do coherently.

Actually by some measures Scala is a small language. It has a large "learning load" (as I call it) but because it is so regular the number of raw features is not large.

You mentioned in one of your earlier postings, for example, disabling operator overloading in the subset. Yet Scala doesn't really have operator overloading. What it does have is a flexible way of naming methods and a flexible syntax for using calling them. I suppose you could restrict the way methods can be named, but that seems a little unnatural.

It also would be completely ineffective. It's not like newbies are accidentally overloading operators and then being baffled by the consequences -- the baffling consequences of operator overloading all come from API design.

I'm not saying it's impossible, but it's a potential issue to consider. Scala feels large, but it really isn't. That contrast might (or might not) make the creation of subsets harder than in other languages.

Indeed. PLT Scheme/Racket was designed as  a pedagogical tool, and so the ability to subset it -- which is done in the DrScheme/DrRacket development environment -- was part of its design. And Python is based on ABC, both of which were intended from the beginning to be usable by "non-programmers" (and indeed Python has since has been used by professional programmers to do some fairly impressive things, but no one ever denied that and it has absolutely nothing to do with what we're discussing, duh). There are lessons to be had from these efforts, but the lesson is not that someone can just knock off a ScalaScript subset and be done with it. One lesson from DrScheme is to put the effort into the tools -- thus, I think Kevin Wright's idea of a static analysis tool, built into an IDE, is along the right lines. That IDE should have documentation features that are keyed to the level of the user. But this is a lot of work, the sort the requires grant funding (PLT Scheme received lots of it, from multiple sources).

-- Jim
jibal
Joined: 2010-12-01,
User offline. Last seen 1 year 45 weeks ago.
Re: Re: Re: Scripting profiles for Scala.
On Mon, Apr 4, 2011 at 7:10 AM, Seth Tisue <seth [at] tisue [dot] net> wrote:
>>>>> "Philippe" == Philippe Lhoste <PhiLho [at] GMX [dot] net> writes:

(replying on scala-debate instead. please, could others still discussing
this on scala-user do the same?)

 Philippe> I was wondering when someone will mention Kojo... If not, I
 Philippe> would have pointed to it.  It is a friendly environment
 Philippe> (based on NetBeans platform, with auto-completion, variable
 Philippe> inspection and such) aimed at kids. Yet, it leaves full
 Philippe> access to Scala.

I think the big problem is the error messages.  The Racket/PLT people
have written a lot about this.

 Philippe> If a student hears of folderLeft (one can surf...) and wants
 Philippe> to try it, why forbid access to the feature?

It doesn't need to be "forbid".  It could alert you that you used
something that isn't in your current subset, and ask if you want to move
to the larger subset.

 Philippe> Yes, they can misuse a feature, make errors, forget one dot
 Philippe> where it is needed, try things. But it won't break anything,
 Philippe> they will get error messages, will learn and progress from
 Philippe> mistakes. That's the essence of education, no?

Well, you can't just sweep real teaching difficulties under the rug by
saying that anytime something goes wrong, "that's the essence of
education."  Problems and barriers multiply and accumulate, and the more
they pile up, the more students you start to lose.

An honest question (this is not directed at Philippe specifically):

Y'all who seem opposed (and some of you downright enraged and
belligerent; can't you see it's self-defeating?) to this idea of
subsetting

Only one person in this discussion has expressed anything close to "enraged and belligerent" opposition to subsetting, and that's Randall, but then he's like that -- he also considers auto-indenting tools to be evil. What is self-defeating is someone who wants to see subsetting achieved but then throws around blanket accusations of "blind faith" and "being a hater" and dismisses all counter-arguments as not being "reasonable" and says that suggestions of using another language are "insulting" -- I'm pretty sure that Josh, who suggest using "merrah", did not mean to be insulting with that suggestion. All my "belligerence" is aimed at *that* attitude, not at subsetting. On subsetting, my position, from my first comment in this thread, is that it takes a lot of work to get it right, and there are numerous reasons why just writing a "ScalaScript" plugin is not a very good idea.

-- Jim
 
, how much time have you spent teaching programming to college
students?  high school students?  middle school students?  etc.
"I taught my kid" doesn't count.  It's easy to get locked into a
professional-programmer, hacker-from-birth perspective and lose sight of
the fact that it's a big world out there.

--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/

Russ P.
Joined: 2009-01-31,
User offline. Last seen 1 year 26 weeks ago.
Re: Scripting profiles for Scala.


On Mon, Apr 4, 2011 at 2:27 PM, Jim Balter <Jim [at] balter [dot] name> wrote:


Indeed. PLT Scheme/Racket was designed as  a pedagogical tool, and so the ability to subset it -- which is done in the DrScheme/DrRacket development environment -- was part of its design. And Python is based on ABC, both of which were intended from the beginning to be usable by "non-programmers" (and indeed Python has since has been used by professional programmers to do some fairly impressive things, but no one ever denied that and it has absolutely nothing to do with what we're discussing, duh).

We were discussing the value of Python as a pedagogical language for teaching and learning programming. And the fact that "Python has since has been used by professional programmers to do some fairly impressive things" has absolutely nothing to do with that? Yeah, right. Whatever you say.

Folks, I realize that I should not be wasting my time on this. Lord knows I have nothing like the kind of free time that this guy apparently has to spend on this stuff. A little earlier in this thread, after I pointed out that some very useful software has been written in Python, he fired back as if I had insulted his mother -- something about "stunningly stupid strawmen." Rather than burden the list with a reply, I sent him a personal message suggesting that he grow up. The obscenity-laced reply I got back from him suggests strongly that he probably won't do that any time soon.

--Russ P.

--
http://RussP.us
jibal
Joined: 2010-12-01,
User offline. Last seen 1 year 45 weeks ago.
Re: Scripting profiles for Scala.
On Mon, Apr 4, 2011 at 3:08 PM, Russ Paielli <russ [dot] paielli [at] gmail [dot] com> wrote:


On Mon, Apr 4, 2011 at 2:27 PM, Jim Balter <Jim [at] balter [dot] name> wrote:


Indeed. PLT Scheme/Racket was designed as  a pedagogical tool, and so the ability to subset it -- which is done in the DrScheme/DrRacket development environment -- was part of its design. And Python is based on ABC, both of which were intended from the beginning to be usable by "non-programmers" (and indeed Python has since has been used by professional programmers to do some fairly impressive things, but no one ever denied that and it has absolutely nothing to do with what we're discussing, duh).

We were discussing the value of Python as a pedagogical language for teaching and learning programming. And the fact that "Python has since has been used by professional programmers to do some fairly impressive things" has absolutely nothing to do with that? Yeah, right. Whatever you say.


Indeed it does not, especially since no one ever said anything to the contrary (yet you wrote "you can't deny"). But I don't expect logic or reason to have any effect on an evolution- and global warming- denier such as yourself. Now let's not annoy the list readers with out personal squabble any further, eh?
-- Jim
Russ P.
Joined: 2009-01-31,
User offline. Last seen 1 year 26 weeks ago.
Re: Scripting profiles for Scala.
OK, so what we apparently have here is a misunderstanding of a common figure of speech. When someone says, "you can't deny ...", they don't necessarily mean to imply that you personally did or will deny the statement. It's just a figure of speech, as in "you can't deny that Bill Gates has had a major influence on software." I thought that was widely understood, but maybe I was wrong.

But wait ... now I am "an evolution- and global warming- denier." Yes, I see the problem now. But don't take Jim's word for it, please see my personal website (http://RussP.us) if you want to find out how ignorant I really am!

--Russ P.


On Mon, Apr 4, 2011 at 3:14 PM, Jim Balter <Jim [at] balter [dot] name> wrote:
On Mon, Apr 4, 2011 at 3:08 PM, Russ Paielli <russ [dot] paielli [at] gmail [dot] com> wrote:


On Mon, Apr 4, 2011 at 2:27 PM, Jim Balter <Jim [at] balter [dot] name> wrote:


Indeed. PLT Scheme/Racket was designed as  a pedagogical tool, and so the ability to subset it -- which is done in the DrScheme/DrRacket development environment -- was part of its design. And Python is based on ABC, both of which were intended from the beginning to be usable by "non-programmers" (and indeed Python has since has been used by professional programmers to do some fairly impressive things, but no one ever denied that and it has absolutely nothing to do with what we're discussing, duh).

We were discussing the value of Python as a pedagogical language for teaching and learning programming. And the fact that "Python has since has been used by professional programmers to do some fairly impressive things" has absolutely nothing to do with that? Yeah, right. Whatever you say.


Indeed it does not, especially since no one ever said anything to the contrary (yet you wrote "you can't deny"). But I don't expect logic or reason to have any effect on an evolution- and global warming- denier such as yourself. Now let's not annoy the list readers with out personal squabble any further, eh?
-- Jim



--
http://RussP.us
jibal
Joined: 2010-12-01,
User offline. Last seen 1 year 45 weeks ago.
Re: Scripting profiles for Scala.
On Mon, Apr 4, 2011 at 3:30 PM, Russ Paielli <russ [dot] paielli [at] gmail [dot] com> wrote:
OK, so what we apparently have here is a misunderstanding of a common figure of speech. When someone says, "you can't deny ...", they don't necessarily mean to imply that you personally did or will deny the statement. It's just a figure of speech, as in "you can't deny that Bill Gates has had a major influence on software." I thought that was widely understood, but maybe I was wrong.

The misunderstanding is all yours. If no one was arguing to the contrary, then it's a strawman, as in this case and in your example.
  
But wait ... now I am "an evolution- and global warming- denier." Yes, I see the problem now. But don't take Jim's word for it, please see my personal website (http://RussP.us) if you want to find out how ignorant I really am!

Indeed.

Now, back to Scala ....
Philippe Lhoste
Joined: 2010-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Scripting profiles for Scala.

On 04/04/2011 21:11, Seth Tisue wrote:
> It becomes a lot easier to emit beginner-friendly error messages if you
> subset the language. It's one of the big motivations for subsetting.

Then maybe extracting the simpler language from the existing Scala compiler (as I
understood what was the proposal) is an error.
It might be interesting to define precisely a language which would be a strict subset of
Scala and write it from scratch. Might be easier than throwing away some (lot of) parts
while keeping consistency and improving messages...

One difficulty is to define this subset. I don't think "operator overloading" (or "weird"
method names) is a major problem, if used wisely and scarcely. I have no issue with :: to
build lists, more with /: as synonym of foldLeft (it not even mentioned as such in the
ScalaDoc, we just have two identical definitions).
I don't see match as difficult, at least for the most common / simple cases.

I do see the type system as difficult...
Slightly less syntax sugar (the various ways of defining functions, for example) would
make a slightly more verbose language (not a problem in the education field) but a less
confusing one. I would force to declare functions' types rather than type-inference them
(make students to think more about their types), so to allow only two syntaxes for
functions (def f(x: Int): Int = { ... } and def f(x: Int) { ... } for Unit functions).
_ is cool too but reduce slightly the readability for a new comer (IMHO).
And so on.

So, I see a little brother of Scala as a viable solution, more than a full Scala with
artificial restrictions (which was my original objection).
Going to full Scala wouldn't be hard, then, but would need to change the compiler.

Ben Hutchison 3
Joined: 2009-11-02,
User offline. Last seen 42 years 45 weeks ago.
Re: Scripting profiles for Scala.

On Sun, Apr 3, 2011 at 4:58 AM, Lex wrote:
> I am perfectly comfortable. However I keep finding sentiments similar
> to this blogpost (not mine):
> http://alarmingdevelopment.org/?p=562#more-562
> Why not simply make a ScalaScript plugin that restricts the use of
> some features and be done with it?

The blog author's main problem with Scala is not the language but the
maturity of the tools. Not sure what can be done about that except
building better tools, which is being done all the time, but takes
alot of time and effort.

Generalizing a bit, we're all alot more attached to our tool comforts
than we like to admit. When I first tried Scala back in 2008 using the
Eclipse plugin, I was irrationally put off that Auto-Import didn't
work like it did in Java. No doubt Im not the only one too react that
way.

-Ben

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland