
Some thoughts on hylang (2017) - asimjalis
https://www.beatworm.co.uk/blog/lisp/thoughts-about-hylang#
======
JasonFruit
Hy feels all wrong to me, though I really wanted to like it, and I put some
time in when I tried it.

Part of it is that it compiles to Python bytecode, and took the simplest route
of adopting Python's not at all lisplike scope. With `let`, you have a visual
clue of variable scope; Hy had a broken `let`, and then got rid of it
completely. Now it looks like there's a new `let` that might make more sense.
I haven't used it in a couple years.

But that's not the only problem. It has the same feeling I get from Clojure
and the various lisps that compile to javascript; it just doesn't feel
divorced enough from its parent language to be satisfying in itself. I'd
rather write lisp than Python, sure, but except for a few libraries I'd like
to be able to use, I don't see much reason to prefer Hy over Racket or some
other similarly-mature Scheme, which would have somewhat fewer libraries, but
would feel like a consistent and self-contained language.

~~~
nicklaf
I wonder if you might like "Burgled-Batteries" [0], which gives you access to
Python objects from Common Lisp. I have not tried it myself, and it does not
yet support CLOS integration, but it looks pretty interesting.

[0] [https://www.cliki.net/burgled-batteries](https://www.cliki.net/burgled-
batteries)

------
coldtea
> _It 's a lisp that compiles? (transpiles? I never get the difference)_

I've seen others make the same claim. How's the difference difficult to get.
It might not be 100% clear-cut and have some edge cases, but in common
parlance:

Compile -> compiles to executable machine code (or executable bytecode for
your VM).

Transpile -> produces code in another language (which is then compiled or
interpreted or whatever).

------
foobar_
I make no shame of it. I am an imperative programmer at heart. Hy is
beautifully imperative.

return/if/while/break/continue actually work in Hylang. Common Lisp doesn't
have these. Scheme purists won't let you have them. Clojure obviously doesn't
have them.

Let that sink in.

The fight against imperative programming has come so far that we banned not
just goto but every commonly used control flow primitive. We have banned
global variables too and FP purists want to go even further and remove the
assignment operator. What is a monad exactly if not the ";" ? What is the end
result except more confusing code ?

Hylang is a completely distinct lisp and breaks the tradition of all lisps
before it. Sibilant is another lisp which does the same but for javascript.

What does Hylang do ? It translates almost 1-1 the features of Python onto
itself and its a transpiler if I am not mistaken. So you get all the features
and libraries of Python without much fanfare. This is such a good idea that we
need a C++ version of Hylang.

Now if we could get rid of the parens and have begin and end or something like
"if .. fi" like civilised folks, that would just be perfect.

~~~
zeveb
> return/if/while/break/continue actually work in Hylang. Common Lisp doesn't
> have these.

It has all of them!

Return:

    
    
        CL-USER> (defun foo () (return-from foo 1) 2)
        → FOO
        CL-USER> (foo)
        → 1
    

If:

    
    
        CL-USER> (if t 1 2)
        → 1
        CL-USER> (if nil 1 2)
        → 2
    

While:

    
    
        CL-USER> (let ((x t))
                   (loop for j from 1 to 10
                         while x
                         do (when (= j 3)
                              (setf x nil))
                         collect j))
        → (1 2 3)
    

Break:

    
    
        CL-USER> (loop for i from 1 to 10 do (format t "~&i: ~a~%" i) when (> i 4) do (return) do (format t "~& -~%"))
        i: 1
        -
        i: 2
        -
        i: 3
        -
        i: 4
        -
        i: 5
        → NIL
    

Continue:

    
    
        CL-USER> (do ((i 1 (1+ i))) 
                     ((> i 10))
                   (format t "~&i: ~a~%" i)
                   (when (= i 4) (go end))
                   (format t "~& -~%")
                   end)
        i: 1
        -
        i: 2
        -
        i: 3
        -
        i: 4
        i: 5
        -
        i: 6
        -
        i: 7
        -
        i: 8
        -
        i: 9
        -
        i: 10
        -
        → NIL
    

Common Lisp has goto, has traditional control structures and can be as
imperative as you like.

~~~
foobar_
I made a mistake of mentioning Common Lisp in the same line. Common Lisp has
pointers (cons) as well.

Hylang doesn't have goto, as Python doesn't have it.

Well you can always implement a goto by having

1\. A list made of lambdas. List gives numeric addresses. Dict will give you
named addresses.

2\. Pass the above list itself to each of the lambda or make it a global
variable called ADDRESSES.

No one talks about the cool imperative features of Common Lisp right ? The was
the point I was trying to make.

Scripting is imperative.

Python is a scripting language .. right ? That makes Hylang a scripting
language too. Hylang is (Python).

------
ebg13
"posted by cms on 2017-12-31". Has anything significant changed since then?

~~~
kristianp
So: (2017)

------
jessaustin
_Missing some olde lisp things like car /cdr/lambda_

A quick perusal of hylang.org didn't reveal how a Lisp works without cdr. I'm
envisioning something awful with a colon...

~~~
shaunxcode
more likely car = first and cdr = rest.

~~~
snazz
Correct:
[http://docs.hylang.org/en/stable/language/api.html#rest](http://docs.hylang.org/en/stable/language/api.html#rest)
[http://docs.hylang.org/en/stable/language/api.html#first](http://docs.hylang.org/en/stable/language/api.html#first)

