News for hackers. Stuff that matters.
Re:Pyret – A language exploring scripting and functional pro... by lmm on Thursday December 15, 2016 @01:09PM (#13186668)
"def" is an abbreviation non-programmers are more likely to understand than "fun".
Re:Pyret – A language exploring scripting and functional pro... by makmanalp on Thursday December 15, 2016 @01:26PM (#13186834)
OK: opinion time. Some folks in this thread don't understand how pedagogy works.

When these people talk about easy-to-learn, they don't mean what a lot of people in this thread mean. Def / fun is such an easy thing that it's a non-issue. Anyone can learn programming language syntax pretty quickly.

It's the semantics that's hard. When you first start learning, the things that actually trip you up and that you can't just look up in a cheatsheet in two seconds are things like: Unexpected behavior, bad error messages, hidden rules, hidden complexity, complicated control flow, code that doesn't do much but must be there anyway, arcane things that you must do to make the compiler happy.

In that way, you don't have to assume that beginners are stupid. A lot of these things happen because languages are badly designed, or because they evolve to have too much cruft over time in an effort to be general purpose and catch up with the times. For learning, this just gets in the way. With better tools, learners can tackle much more complex concepts much quicker. Once those take place, you can introduce the arcane weirdness of other programming languages, and it makes a lot more sense.

Re:Pyret – A language exploring scripting and functional pro... by skrishnamurthi on Thursday December 15, 2016 @06:24PM (#13189662)
You're right! To DEFine a FUNction, you should naturally type `def`, not `fun`. By the way, I tried to define a variable and got

  >>> def x = 3
    File "<stdin>", line 1
      def x = 3
            ^
  SyntaxError: invalid syntax
What's up with that? Is that not also a DEFinition?
Re:Pyret – A language exploring scripting and functional pro... by lmm on Friday December 16, 2016 @02:01AM (#13191590)
Yeah, that should work (well, "def x: 3" should work). In my preferred language it does work.
Re:Pyret – A language exploring scripting and functional pro... by AstralStorm on Thursday December 15, 2016 @01:21PM (#13186783)
But that's no fun. ;-)

Seriously, fun is obvious for function to anyone. (also, defun in some other languages fits the bill) In contrast, def doesn't explain what is defined. (See Groovy where it is a real problem or JavaScript where you can use var for everything.)

Re:Pyret – A language exploring scripting and functional pro... by vorg on Thursday December 15, 2016 @05:07PM (#13188949)
I remember Apache Groovy's use of the verb def to match the verbs and adverbs of the other statement-level keywords (e.g. switch, if, while, return) instead of a noun like any to match the type names it stands in for (e.g. int, bool, String, null) was, er, discussed at length on their mailing list back around 2005-06. The Nabble interface to those discussions has since been obfuscated by being redirected and embedded within a page from the groovy-lang.org website so I can't easily find a link to those discussions.
Re:Pyret – A language exploring scripting and functional pro... by lmm on Thursday December 15, 2016 @04:25PM (#13188560)
> In contrast, def doesn't explain what is defined. (See Groovy where it is a real problem or JavaScript where you can use var for everything.)

Does that matter? I'm used to Scala where `def x = 4` is just as good as `val x = 4` as far as a beginner's concerned.

Re:Pyret – A language exploring scripting and functional pro... by nercht12 on Thursday December 15, 2016 @01:26PM (#13186831)
How dare you suggest non-programmers can't understand fun! XD (I'm only teasing of course.)