4 ms·
I think the problem with those languages is they're too different for a starting course. Scheme is obviously very powerful, but its syntax is wildly different t
by tdavis 18y ago
I think the problem with those languages is they're too different for a starting course. Scheme is obviously very powerful, but its syntax is wildly different than most popular programming languages used today. As for Ruby, don't even get me started. There's practically no syntax at all; merely reading it agitates me.
I think, in the beginning, people are most likely to understand concepts like Objects (Circle, Square, etc.) and how they relate to other stuff since it's so based off how we normally think. Also, since Java is statically typed, I think it makes things appear to contain less "voodoo". Then again, I could be completely wrong; I had been programming in other languages for years before taking my first Java course in college and only attended the class when there was a test.
- Xichekolas 18y agoRuby has quite a bit of syntax (parens, methods on objects, blocks, etc), whereas scheme has almost none (parens, special forms like lambda, #t, '()). Of course both have less obtrusive syntax than Java, which requires the famous public static void main... just to get started. That is the kind of stuff that I think confuses true beginners. They look at that stuff and think "holy crap memorize these voodoo incantations" and never really leave that mindset once they get there. Even if they eventually learn what static means, they will always treat it as such. I think once they get the hang of programming in something, it's easy to build up from there. I just think it causes people to focus on the wrong thing (syntax rather than semantics) when they are first starting out.
- talboito 18y agoOne of the things that complicates Scheme for many beginners is the prefix notation for arithmetic and such. It's just not a concept most Freshmen are acquainted with.
- khafra 18y agoI dunno--I started community college with an HP-48 instead of a TI calculator, and reverse polish notation wasn't a problem at all once the friend who'd convinced me to get one explained how the stack was like the way you do arithmetic on paper.
- mattmcknight 18y ago>>Also, since Java is statically typed, I think it makes >>things appear to contain less "voodoo". No way. It's better to learn other programming concepts without the distraction of having to maintain types. Duck typing makes a lot more sense to new people, in my experience. Most of the popular languages with non programmers (PHP, VB, JavaScript) fit this mold.
- jcromartie 18y agoForth, Factor, and Io are languages that come to mind that have "no syntax". Ruby is certainly at the "more syntax" end of the spectrum. puts(("foo #{bar} %s %s" % [bat, baz]) * 2.+(0b0010)) There are a huge number of syntax rules in that line.
- kragen 18y agoI count 23 in a PEG language without repetition. Here's an expanded version of your fragment that runs successfully: # from http://news.ycombinator.com/item?id=404609 bar = 3 bat = 4 baz = 5 puts(("foo #{bar} %s %s" % [bat, baz]) * 2.+(0b0010)) And here's a grammar for the subset of Ruby it uses: this <- 'A parsing expression grammar for a tiny subset of Ruby.'. copyright <- 'Written by Kragen Javier Sitaker 2008; in the public domain.'. program <- _ expr program / . noninfix <- inparens / call / constant / quasiquoted / list / name. expr <- infix / noninfix. inparens <- '('_ expr ')'_. call <- name '('_ commalist ')'_ / constant '.'_ methodname '('_ commalist ')'_. constant <- '0b' bits / digits. bits <- bit bits / bit _. bit <- '0' / '1'. digits <- digit digits / digit _. digit <- bit / '2' / '3' / '4' / '5' / '6' / '7' / '8' / '9'. quasiquoted <- '"' qqcontents '"'_. qqcontents <- !'#{' !'"' char qqcontents / interpolation qqcontents / . interpolation <- '#{' expr '}'. list <- '['_ commalist ']'_. commalist <- expr ','_ commalist / expr / . infix <- noninfix '%'_ expr / noninfix '*'_ expr / noninfix '='_ expr. _ <- sp _ / . sp <- ' ' / '\n' / comment. comment <- '#' commentchars '\n'. commentchars <- !'\n' char commentchars / . namechar <- 'b' / 'a' / 'r' / 't' / 'z' / 'p' / 'u' / 's'. name <- namechar name / namechar _. methodname <- '+'_ / name. I have tested it (in http://github.com/kragen/peg-bootstrap/tree/master/peg.md http://github.com/kragen/peg-bootstrap/tree/master/peg.md) and it seems to work for that fragment, although I haven't examined the parse tree to see if it's right. (Obviously the definition of namechar is wrong, and there's no $end token separating statements, and you can't call methods on things that aren't constants or self, etc.)