On Thursday, July 18, 2019 at 3:47:51 PM UTC-4, Justin Zamora wrote: > > > (string (string-ref (person-first john) 0) > (string-ref (person-middle john) 0) > (string-ref (person-last john) 0)) > > There's a load of cognitive and syntactic overhead compared to something > like: > > john.first[0] + john.middle[0] + john.last[0] >
The issue there is imo, insufficient abstraction. There is a tendency (this happens often in JS) to code at a very low level when you are given neat tricks like this. Alternatively, (not that I'm saying structs are perfect or this is the best way to go), given your example, I would do something like this: (define (get-initial str) (string-ref str 0)) (define (first-initial person) (get-initial (person-first person))) (define (middle-initial person) (get-initial (person-middle person))) (define (last-initial person) (get-initial (person-last person))) (define (get-initials person) (string (first-initial person) (middle-initial person) (last-initial person))) Then you are just looking at (get-initials john), which is the simplest to read. As a relatively new programmer myself (1 year experience so far) I admit that my first thought on hearing about the syntax change was disappointment. Although getting through HtDP wasn't easy (I read it 3 times!), it was love at first sight for me. Rather than memorizing precedence rules, or parens wrapping out of caution, everything was immediately clear for me. I think that many people are trained to believe "this is the way to program", based on whatever they were taught in school or what they encountered first, leading to a familiarity bias. (I am self-taught + a bootcamp graduate) Many people wanted to stay with assembly (because that's what they knew) when higher level languages like C came about, and the same thing happened again with the newer dynamic languages. Many systems programmers still refer to languages like JavaScript as "scripting" languages in a rather dismissive way, because they are very different from what they are used to. (not as strongly typed for one) On the plus side, we've seen lots of higher level features filter down too, like pattern matching in Rust, and first class or nameless functions becoming a standard expected by programmers. Maybe the change to lisp is just too different from what most people are taught, but I'm not sure a syntax change will improve the situation. One obvious question I have would be, if Racket is changed to resemble something closer to, say, Python, why would people want to switch? They already have a familiar syntax and lots of libraries, and the draw of a "programmable programming language" is not high for people looking at just getting a project done. (I think those types are the ones unsatisfied with existing tools, and are looking for something better) I think a much bigger factor in adoption of a language has to do with industry applicability, just plain practical need, and some kind of compatibility with what is already available. Clojure is a good example imo. Although on the other hand, sometimes surprises can be good, so there is no criticism from me. I will certainly miss it if the change does go through. One last point I wanted to add is that while leaving the current Racket around for compatibility is nice, it is no comfort for people who enjoy the style. The default choice is the one that people tend to use, which is why when I found out about class syntax for JavaScript, I was completely opposed. It seems like a nice sugar for Java/C developers, but JS is a different beast and doesn't actually have them, leading to all sorts of problems. Since it is a very familiar style though, and officially blessed by the standards people, it is the dominant form, as opposed to the superior (imo) and truer direct object linking (Object.create() or simple object literal returns from a "constructor"). Anyway I'm rambling now. I'd certainly like to see what ideas people come up with. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/8936d71f-6856-4453-82cb-3fcf0d247d6b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.