Arthur Peters | 1 Apr 01:56 2010

Re: hardcore DSL question :)

Isn't there a bit-rotted and incomplete compiler plugin that allows you to make some expressions to be given to the program at runtime as ASTs (or something similar) instead of compiling them into real code?

That seems like something that might be useful for you.  Though I bet it would need a lot of work.

-Arthur (sent from phone)

On Mar 31, 2010 4:32 PM, "Razvan Cojocaru" <razie-FS2fJD/S6ogAvxtiuMwx3w@public.gmane.org> wrote:


I see that I like multi-part posts...sorry.

I can do this:

wcase (expr) {
 case 1 =>   println("it's ")
 case 2 =>   println("true ")
 case 3 =>   println("...")
}

but can't do the version similar to the welse (above), which builds a
sequence of 3 activities.

This construct is of special interest to me, since I always liked Ada's
guarded entry points...trying to mimick them here...




Razvan Cojocaru wrote:
>
> I'm playing with a workflow DSL...I'm trying to closely follow a "nor...

View this message in context: http://old.nabble.com/hardcore-DSL-question-%3A%29-tp28101278p28101339.html

Sent from the Scala - User mailing list archive at Nabble.com.

Frank Teubler | 1 Apr 02:02 2010
Picon

Re: Special unicodes in method names and precedence


in maths postfix operators have a higher precedence than infix operators,
e.g. factorial 2!, degree 180°, power, matrix transpose.

postfix operators with higher precedence would allow more consise internal
dsl. ref  https://lampsvn.epfl.ch/trac/scala/ticket/3210
trac/scala/ticket/3210 
--

-- 
View this message in context: http://old.nabble.com/Special-unicodes-in-method-names-and-precedence-tp28099335p28103145.html
Sent from the Scala - User mailing list archive at Nabble.com.

Sciss | 1 Apr 02:05 2010
Picon

Re: Special unicodes in method names and precedence

a pity. i don't care so much which unicode range has which precedence, but it would be nice to _have_
different ones so that one could design DSLs nicer.....

Am 01.04.2010 um 01:02 schrieb Frank Teubler:

> 
> in maths postfix operators have a higher precedence than infix operators,
> e.g. factorial 2!, degree 180°, power, matrix transpose.
> 
> postfix operators with higher precedence would allow more consise internal
> dsl. ref  https://lampsvn.epfl.ch/trac/scala/ticket/3210
> trac/scala/ticket/3210 
> -- 
> View this message in context: http://old.nabble.com/Special-unicodes-in-method-names-and-precedence-tp28099335p28103145.html
> Sent from the Scala - User mailing list archive at Nabble.com.
> 

Tony Morris | 1 Apr 02:27 2010
Picon

Re: Special unicodes in method names and precedence

Scalaz has this problem and some operators are named specifically to
handle predicted likely use cases.

It is a great problem when "what most people would think is intuitive"
is in contention with "but then they'd need to add parens." There are
other problems too. User-defined precedence would be just grand, fixity too.

Sciss wrote:
> a pity. i don't care so much which unicode range has which precedence, but it would be nice to _have_
different ones so that one could design DSLs nicer.....
>
>
> Am 01.04.2010 um 01:02 schrieb Frank Teubler:
>
>   
>> in maths postfix operators have a higher precedence than infix operators,
>> e.g. factorial 2!, degree 180°, power, matrix transpose.
>>
>> postfix operators with higher precedence would allow more consise internal
>> dsl. ref  https://lampsvn.epfl.ch/trac/scala/ticket/3210
>> trac/scala/ticket/3210 
>> -- 
>> View this message in context: http://old.nabble.com/Special-unicodes-in-method-names-and-precedence-tp28099335p28103145.html
>> Sent from the Scala - User mailing list archive at Nabble.com.
>>
>>     
>
>
>   

--

-- 
Tony Morris
http://tmorris.net/

Nils Kilden-Pedersen | 1 Apr 02:32 2010
Picon

Re: Scala and templates?

On Wed, Mar 31, 2010 at 8:11 AM, James.Strachan <james.strachan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
I've been hacking lately on Scalate which is a Scala based template engine
which could be considered a pure Scala alternative to
Velocity/FreeMarker/JSP/Erb/HAML

http://scalate.fusesource.org/

I haven't spent too much time looking, but from all the examples it seems that templates can only be loaded from files and/or URI strings. Is that correct? If so I would urge you to add support for something more generic, say java.io.Reader, InputStream, or scala.io.Source. This is more flexible and you can always add an implicit conversion to turn a File into either one.
Dave Griffith | 1 Apr 03:10 2010
Picon

Re: Scala and templates?


Having spent much of the last six weeks porting a production JAX-RS web
service to use FreeMarker for output, I have to say that this looks
promising, but not quite there yet.  My darn-near-ideal web stack would look
something like Scala +JAX-RS+(hypothetical strongly-typed, Scala-aware
IBatis)+(hypothetical strongly-typed, Scala-aware FreeMarker)+JQuery. 
(Notice that neither Spring nor Hibernate makes the cut).   Scalate has two
different templating languages, each of which covers half of the use case
very well and leaves the rest hanging.    The first has both a new (and
somewhat ugly) syntax and only covers XHTML, and the second reprises all of
the well known failure modes of ASP/JSP/GSP, with minimal upside over them.   
I can understand the value of each of them, but I'm afraid they lose out to
FreeMarker for me, simply for its clarity and control.  Give me a templating
language where the code looks like the output (minimal to no escaping), can
enforce strong typing of its inputs,  allows unit testing (no *SP need
apply), and lets me create a controlled code vocabulary (no arbitrary code
insertion), and I'll be a very happy man indeed.  It's a tricky problem, but
there's no reason a solution shouldn't be possible given Scala's power.

Nils Kilden-Pedersen wrote:
> 
> On Wed, Mar 31, 2010 at 8:11 AM, James.Strachan
> <james.strachan@...>wrote:
> 
>> I've been hacking lately on Scalate which is a Scala based template
>> engine
>> which could be considered a pure Scala alternative to
>> Velocity/FreeMarker/JSP/Erb/HAML
>>
>> http://scalate.fusesource.org/
>>
> 
> I haven't spent too much time looking, but from all the examples it seems
> that templates can only be loaded from files and/or URI strings. Is that
> correct? If so I would urge you to add support for something more generic,
> say java.io.Reader, InputStream, or scala.io.Source. This is more flexible
> and you can always add an implicit conversion to turn a File into either
> one.
> 
> 

--

-- 
View this message in context: http://old.nabble.com/Scala-and-templates--tp26610699p28103539.html
Sent from the Scala - User mailing list archive at Nabble.com.

jonathan mawson | 1 Apr 04:10 2010
Picon

Re: TimeSeries


Daniel Sobral wrote:
> 
> When using Ordered, always write A <% Ordered[A] instead of A <:
> Ordered[A]. It means "there is an implicit conversion available that takes
> an A and returns an Ordered[A]". 
> 

That's nice and clear. But it would be good to know where to go for more
information on this side of the type system - a document, a link, etc.
Anyone have any suggestions?

--

-- 
View this message in context: http://old.nabble.com/TimeSeries-tp28079723p28103834.html
Sent from the Scala - User mailing list archive at Nabble.com.

Daniel Sobral | 1 Apr 04:46 2010
Picon

Re: Special unicodes in method names and precedence

That at least is easier. Since Scala's postfix notation sucks anyway, just type 2.!. It gives you precedence and avoids postfix notation problems. :-)


On Wed, Mar 31, 2010 at 9:02 PM, Frank Teubler <dft <at> onlinehome.de> wrote:

in maths postfix operators have a higher precedence than infix operators,
e.g. factorial 2!, degree 180°, power, matrix transpose.

postfix operators with higher precedence would allow more consise internal
dsl. ref  https://lampsvn.epfl.ch/trac/scala/ticket/3210
trac/scala/ticket/3210
--
View this message in context: http://old.nabble.com/Special-unicodes-in-method-names-and-precedence-tp28099335p28103145.html
Sent from the Scala - User mailing list archive at Nabble.com.




--
Daniel C. Sobral

I travel to the future all the time.
Daniel Sobral | 1 Apr 04:51 2010
Picon

Re: TimeSeries

There my recommendation is get one of the Scala books. I think all of them deal with this.

On Wed, Mar 31, 2010 at 11:10 PM, jonathan mawson <umptious-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:



Daniel Sobral wrote:
>
> When using Ordered, always write A <% Ordered[A] instead of A <:
> Ordered[A]. It means "there is an implicit conversion available that takes
> an A and returns an Ordered[A]".
>

That's nice and clear. But it would be good to know where to go for more
information on this side of the type system - a document, a link, etc.
Anyone have any suggestions?

--
View this message in context: http://old.nabble.com/TimeSeries-tp28079723p28103834.html
Sent from the Scala - User mailing list archive at Nabble.com.




--
Daniel C. Sobral

I travel to the future all the time.
Johannes Rudolph | 1 Apr 08:29 2010

Re: hardcore DSL question :)

On Thu, Apr 1, 2010 at 1:56 AM, Arthur Peters
<amp@...> wrote:
> Isn't there a bit-rotted and incomplete compiler plugin that allows you to
> make some expressions to be given to the program at runtime as ASTs (or
> something similar) instead of compiling them into real code?

Yes, there is, but it is limited in the type of ASTs supported and
there is no runtime compilation like in .NET, so you would have to do
that yourself.

>
> That seems like something that might be useful for you.  Though I bet it
> would need a lot of work.
>
> -Arthur (sent from phone)
>
> On Mar 31, 2010 4:32 PM, "Razvan Cojocaru" <razie@...> wrote:
>
>
> I see that I like multi-part posts...sorry.
>
> I can do this:
>
> wcase (expr) {
>  case 1 =>   println("it's ")
>  case 2 =>   println("true ")
>  case 3 =>   println("...")
> }
>
> but can't do the version similar to the welse (above), which builds a
> sequence of 3 activities.
>
> This construct is of special interest to me, since I always liked Ada's
> guarded entry points...trying to mimick them here...
>
>
>
> Razvan Cojocaru wrote:
>>
>> I'm playing with a workflow DSL...I'm trying to closely follow a "nor...
>
> View this message in context:
> http://old.nabble.com/hardcore-DSL-question-%3A%29-tp28101278p28101339.html
>
> Sent from the Scala - User mailing list archive at Nabble.com.
>

--

-- 
Johannes

-----------------------------------------------
Johannes Rudolph
http://virtual-void.net


Gmane