Live data from Hacker News

Why Go? Use Racket

cxwangyi.wordpress.com

51–59 of 59 posts

Re: Why Go? Use Racket

#51
post #5

I'm sorry you lost me after your outrageous claim that one must learn everything about the standard types of Go before one can program effectively. You should know about how your types are passed around if you are using any language. The example given was arrays in Go. Arrays are passed by value, but slices (pointers to arrays) are passed by reference. This is very simply described in the Effective Go reading. It's n…

I think slices are actually passed by value. From "Effective Go": "We must return the slice afterwards because, although Append can modify the elements of slice, the slice itself (the run-time data structure holding the pointer, length, and capacity) is passed by value."

You are absolutely correct. To borrow form another's comment, https://play.golang.org/p/VOUJI88PNj

The slice, however, is a small structure to pass to a function in that you are not performing a copy of each individual element in the slice.

Re: Why Go? Use Racket

#52
post #31
post #19

Earlier quoted context omitted.

If using dynamic typing like Python's is being drunk, then at least Go is like being tipsy - not quite sober, but quite functioning.

Tipsy is probably the most dangerous mode. People feel like they can probably still drive when they're just tipsy.

No. Drunk driving is much worse. (Yes, people do that -- I mean they actually understand that they are "drunk" and not just "tipsy"... and unfortunately still drive :/.)

Re: Why Go? Use Racket

#53
post #25

I like crosscompilation and being able to deploy a stand alone executable without the whole sdk needed.Does racket do that?

Yes, that's possible: http://docs.racket-lang.org/raco/exe.html http://docs.racket-lang.org/raco/exe-dist.html

I may have missed in those docs any mention of cross-compilation. The first result for 'cross compile racket' is [1]. Of course that's from 2013, so maybe it changed since then.

[1] https://groups.google.com/forum/m/#!topic/racket-users/LLB6o...

Re: Why Go? Use Racket

#54

I'll come right out and say that I despise Go. It's a terrible language that ignores decades of language research and brings nothing new to the field, but has become popular due to Google hype. That said, Go -> Racket is a pretty big jump. Even though I think Go is terrible, I can at least take the time to see the problems it's solving and offer comparable languages. I suggest Rust as a Go replacement. Don't get me w…

Rust's and Go's strengths are very dissimilar, there's no reason to consider one as the replacement for the other without considering a dozen other worthy languages in between.

Re: Why Go? Use Racket

#55

Earlier quoted context omitted.

Yes, that's possible: http://docs.racket-lang.org/raco/exe.html http://docs.racket-lang.org/raco/exe-dist.html

I may have missed in those docs any mention of cross-compilation. The first result for 'cross compile racket' is [1]. Of course that's from 2013, so maybe it changed since then. [1] https://groups.google.com/forum/m/#!topic/racket-users/LLB6o...

You're right – I keyed in on "stand-alone executable" and not the "crosscompilation" part of the question.

Re: Why Go? Use Racket

#56
post #21
post #20

Racket's website ( http://racket-lang.org/ ) has an "explain" button by the code snippet. Is the existence of such a button perhaps a statement about the quality of the syntax?

No, it's a statement that the developers of Racket care about explaining how things work.

Perhaps because they need to? Or do you find Racket as clear as other languages? Even other Lispy ones?

Without trying to be insulting, I find Racket aesthetically unappealing.

Re: Why Go? Use Racket

#57
post #31

Earlier quoted context omitted.

Tipsy is probably the most dangerous mode. People feel like they can probably still drive when they're just tipsy.

No. Drunk driving is much worse. (Yes, people do that -- I mean they actually understand that they are "drunk" and not just "tipsy"... and unfortunately still drive :/.)

Ah, yeah, I wouldn't want to claim that tipsy driving is worse than flat out drunk driving. I only wanted to suggest that there's higher net risk when it's less dangerous but is perceived to be not dangerous at all.

Re: Why Go? Use Racket

#58
post #43
post #7

The OP's complaint about Go's type system seems to mainly be that memory allocation is explicit. Go is always "pass by value", and it's true that I've watched developers struggle to grasp the full ramifications of what that means regarding memory usage. But not understanding the subtlety of memory allocation usually means your programs will simply run slower and consume more memory. It does not usually mean that your…

In Go you can pass a pointer, and a pointer to a pointer. I understand both cases are usually called "pass-by-reference". If you call "pass-by-value" to passing a pointer, then the notion of "pass-by-value" and "pass-by-ref" are not very useful.

If what you are passing is a pointer, then the value of the pointer (an integer) is copied. So pointers are passed by value.

"Pass by reference" means that the runtime will convert what looks like an instruction to copy a value (such as a data structure) into an instruction to copy only the address. Go has no such concept. You cannot make a new value that is a "reference" to another value. If you make a new variable that takes a value, that variable allocates a new block of memory the size of that value. Assigning a value to the variable (or passing a value to a function) makes a copy of the value into the new memory address. You can make a "reference" only by explicitly making a pointer and copying the address of another object.

"Pass by reference" languages treat everything as a pointer by default, forcing you to make a copy operation when you do not want this behavior. This may seem like an equivalent programming model, and possibly simpler because this pointer business if confusing at first. However, basic concepts such as a call stack or an array of values can no longer be expressed easily, because with "pass by reference" languages you have removed the concept of a value from the language. So pass-by-reference languages can lead to confusion in large programs, even if they seem simpler at first.

Basically, go is "pass by value" because the language forces you to always be explicit about when you are copying an entire value, and when you are only copying a pointer.

Re: Why Go? Use Racket

#59
post #54

I'll come right out and say that I despise Go. It's a terrible language that ignores decades of language research and brings nothing new to the field, but has become popular due to Google hype. That said, Go -> Racket is a pretty big jump. Even though I think Go is terrible, I can at least take the time to see the problems it's solving and offer comparable languages. I suggest Rust as a Go replacement. Don't get me w…

Rust's and Go's strengths are very dissimilar, there's no reason to consider one as the replacement for the other without considering a dozen other worthy languages in between.

Sure, if you make vague enough statements, they're hard to disprove, which might lead you to believe that what you said is correct even though you haven't made a provable or disprovable claim.

There are plenty of problems where one might consider using Go or Rust. The same cannot be said of Go and Racket, or Rust and Racket. I wouldn't consider using Racket for a situation where I need high performance or low memory usage--the numbers just don't work. Likewise I wouldn't look at Go or Rust for building a data-presentation type webapp.

Post reply on HN