the intern function and the Shen type system

68 views
Skip to first unread message

Antti Ylikoski

unread,
Jul 16, 2017, 3:32:26 PM7/16/17
to Shen

Could it be possible to include the intern function in the Shen type
system?

I mean the below behavior:

------------------------------------------------------------

antti@antti-HP-Compaq-6715s-GR618ES-AK8:~/shen$ shen

Shen, copyright (C) 2010-2015 Mark Tarver
www.shenlanguage.org, Shen 20.0
running under Common Lisp, implementation: SBCL
port 2.0 ported by Mark Tarver


(0-) (intern "sym1")
sym1

(1-) (tc +)
true

(2+) (intern "sym2")
type error


(3+) (exit 0)
antti@antti-HP-Compaq-6715s-GR618ES-AK8:~/shen$

------------------------------------------------------------

yours, AJY
Finland, the EU


Mark Tarver

unread,
Jul 16, 2017, 3:42:28 PM7/16/17
to qil...@googlegroups.com
Not really; interning can generate a boolean as well as a symbol.

Mark

--
You received this message because you are subscribed to the Google Groups "Shen" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qilang+unsubscribe@googlegroups.com.
To post to this group, send email to qil...@googlegroups.com.
Visit this group at https://groups.google.com/group/qilang.
For more options, visit https://groups.google.com/d/optout.

Thomas Bartscher

unread,
Aug 1, 2017, 4:09:10 PM8/1/17
to Shen
Didn't try it out, but as a first step I'd go for an either type:

(deftype either
  A: T
  ____
  A: (either T _)

  A: T
  ____
  A: (either _ T))

I'm sure this is horribly inadequate, but I haven't used Shen for quite a while now.
With this, the type of intern would be
{ --> (either symbol boolean)}
This would require additional clauses in the above type definition to discern type based on where clauses somehow and using it in code would require using these where clauses, but I think saying that a type secure intern isn't possible is a bit early.
To unsubscribe from this group and stop receiving emails from it, send an email to qilang+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages