repl?

90 views
Skip to first unread message

Raoul Duke

unread,
Oct 21, 2018, 2:51:53 PM10/21/18
to ats-lan...@googlegroups.com
random aside, languages with really good repl / interpreter features are extra attractive.

if ATS3 had a goal of implementing a repl from the ground up that would be extra exciting.

(is the luajit trick something that has become an automagic out-of-the-box exoerience? or any other approaches?)

Vanessa McHale

unread,
Oct 21, 2018, 3:05:39 PM10/21/18
to ats-lan...@googlegroups.com

I'm not sure how well that would work. Are there any other heavily-ML-style languages with a REPL? I know Haskell has one but its syntax lends itself to such things.

Having a JIT would be wonderful (especially if ATS3 is to be a compilation target) but it's outside of my area of expertise.

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAJ7XQb4JSH9ehKeLLD5vUP%2B2iOxRiDdhYkFMRrfKAyhFVxUoBg%40mail.gmail.com.
signature.asc

gmhwxi

unread,
Oct 21, 2018, 3:47:56 PM10/21/18
to ats-lang-users

Yes, I have a plan to implement an REPL for ATS3. I expect it to be
used primarily for the purpose of learning and debugging.

I actually use ATS as a scripting language regularly. Here is an example
I put up a while ago:


I certainly can see the value of REPL for beginners. But if one wants to give
ATS a serious try, please go for types and templates. This is what the slogan
for ATS says:

Unleashing the Potentials of Types and Templates!

:)

Raoul Duke

unread,
Oct 21, 2018, 4:02:17 PM10/21/18
to ats-lan...@googlegroups.com
as i naive day job programmer, i hope that repl/interpreter doesnt have to imply any lack of feature support, so one could still do types & templates & bears oh my.

gmhwxi

unread,
Oct 21, 2018, 4:17:14 PM10/21/18
to ats-lang-users

Supporting the use of external functions (e.g. those defined in C)
in the REPL would be limited if at all. But there are pluses as well.
The REPL I have in mind should support various forms of inspection,
playing a big role in facilitating meta-programming with ATS.

Vanessa McHale

unread,
Oct 21, 2018, 8:34:17 PM10/21/18
to ats-lan...@googlegroups.com

FWIW, I have written ATS2 code that compiles to C which is then wrapped with a Haskell library that GHCi is able to interact with.

Have a look here: https://github.com/vmchale/hs-ats/tree/master/fast-arithmetic.

You can run cabal new-repl and then

λ:> import Numeric.Combinatorics

λ:> 400 `choose` 20

2788360983670896737872851072994080

It's not the same as native support, but it does allow a certain type of development to go on.

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
signature.asc

Hongwei Xi

unread,
Oct 21, 2018, 10:19:33 PM10/21/18
to ats-lan...@googlegroups.com
A few years back, I looked into to the possibility of using CINT
build an REPL for ATS2. Now Cling seems to be under active development:


If one wants something performant, this route seems to be promising.


Julian Fondren

unread,
Oct 21, 2018, 11:18:22 PM10/21/18
to ats-lang-users
On Sunday, October 21, 2018 at 2:05:39 PM UTC-5, Vanessa McHale wrote:

I'm not sure how well that would work. Are there any other heavily-ML-style languages with a REPL?


Standard ML.
OCaml.

Vanessa McHale

unread,
Oct 22, 2018, 3:18:40 AM10/22/18
to ats-lan...@googlegroups.com

That would probably give much better code reloading :)

signature.asc

Chris Double

unread,
Oct 22, 2018, 3:34:29 AM10/22/18
to ats-lan...@googlegroups.com
On Mon, Oct 22, 2018 at 3:19 PM Hongwei Xi <gmh...@gmail.com> wrote:
>
> A few years back, I looked into to the possibility of using CINT
> build an REPL for ATS2. Now Cling seems to be under active development:

Can TCC compile ATS code? https://bellard.org/tcc/

It can be used as a dynamic code generator as well which would suit a REPL:

https://bellard.org/tcc/tcc-doc.html#Libtcc
https://github.com/TinyCC/tinycc/blob/mob/libtcc.h
https://github.com/TinyCC/tinycc/blob/mob/tests/libtcc_test.c

--
http://bluishcoder.co.nz

Julian Fondren

unread,
Oct 22, 2018, 6:14:03 AM10/22/18
to ats-lang-users
On Monday, October 22, 2018 at 2:34:29 AM UTC-5, Chris Double wrote:
On Mon, Oct 22, 2018 at 3:19 PM Hongwei Xi <gmh...@gmail.com> wrote:
>
> A few years back, I looked into to the possibility of using CINT
> build an REPL for ATS2. Now Cling seems to be under active development:

Can TCC compile ATS code? https://bellard.org/tcc/ 

Yes. There are some uses of it to create ATS scripts in https://groups.google.com/d/msg/ats-lang-users/mU4Lp4GkH18/zpzFjaR_AAAJ 

gmhwxi

unread,
Oct 22, 2018, 1:51:20 PM10/22/18
to ats-lang-users

Yes. Please use v0.9.26. TCC v0.9.25 is buggy and should be
avoided.

I like TCC a lot. It is a pity that it does not get maintained these days.

With TCC, I often use ATS for scripting. Once adequate lib support is
put into place, I feel that ATS can work very well for the need of shell scripting
and beyond.

On Monday, October 22, 2018 at 3:34:29 AM UTC-4, Chris Double wrote:

Brandon Barker

unread,
Oct 22, 2018, 5:05:15 PM10/22/18
to ats-lang-users
Seems to be on of the big arguments for using Go. Of course ATS will (rightly) never match the simplicity criteria that they strive for.

Though I imagine for more "complicated" scripts typechecking/constraint solving may become the predominant portion of time spent among compiling and running code (at least in some cases). Though in this case, it probably is less likely to qualify as a script ;-).

Raoul Duke

unread,
Oct 22, 2018, 5:18:04 PM10/22/18
to ats-lan...@googlegroups.com
so just to be a pedantic defender of real UX, please everybody note that (at least according to me) scripting != repl, and repl does not guarantee good ux. an actually useful, helpful, repl bestows new super powers on those who can get their hands on such magical, enchanted, tools. it likely requires ground-up work not top-down hacks, shoe-horning. thus i am never hopeful any language will get a really good repl unless it grew up with it all along.

so at the moment i am guessing that at least for ATS < 3 there's not really a super repl to be had; however there are existence proofs of being able to use it "in the small", even if there's not any turn-key out-of-the-box (docker?) hard proofs i can get using with 15 minutes of effort?

Vanessa McHale

unread,
Oct 22, 2018, 6:42:46 PM10/22/18
to ats-lan...@googlegroups.com

This is an aside, but perhaps caching constraint solving and the like would be a good idea? I know Agda will not re-typecheck a module dependency unless it is touched.

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
signature.asc

Chris Double

unread,
Oct 22, 2018, 8:05:27 PM10/22/18
to ats-lan...@googlegroups.com
On Tue, Oct 23, 2018 at 10:05 AM Brandon Barker
<brandon...@gmail.com> wrote:
> Though I imagine for more "complicated" scripts typechecking/constraint solving may become the predominant portion of time spent among compiling and running code (at least in some cases). Though in this case, it probably is less likely to qualify as a script ;-).

From a thread that Julian linked to, it looks like constraint checking
can be turned off for scripts:

-------------8<--------------
In case one wants to use ATS as a scripting language,
please include the following comment in the file containing
scripting code written in ATS:

(*
##myatsccdef=\
patsopt --constraint-ignore --dynamic $1 | \
tcc -run -DATS_MEMALLOC_LIBC -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
- $arglst(2)
*)
-------------8<--------------

I'd imagine leaving it on when writing it, but deploying it with
turned off for speed.

--
http://bluishcoder.co.nz

Hongwei Xi

unread,
Oct 22, 2018, 8:34:24 PM10/22/18
to ats-lan...@googlegroups.com

>>Of course ATS will (rightly) never match the simplicity criteria that they strive for.

I won't give up so quickly :)

Go is a fine language. But Go lacks what I call "high mechanism" that can greatly increase
one's programming productivity.

With enhanced type inference and embeddable templates, I feel that ATS3 has a very good chance
to be competitive when compared with Go (and others) regarding those simplicity criteria.


--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.

Hongwei Xi

unread,
Oct 22, 2018, 8:38:55 PM10/22/18
to ats-lan...@googlegroups.com

>>perhaps caching constraint solving and the like would be a good idea?

Definitely. Right now, patsopt typechecks the prelude files every time when
it is called.

Reply all
Reply to author
Forward
0 new messages