News for hackers. Stuff that matters.
Re:Literals in Programming Languages by jmmcd on Thursday February 28, 2013 @06:03AM (#5298115)
This article is only about primitive literals, not compound ones. I think the list and dict literals in Python are the #1 reason I like it better than C. I think the regexp literals in Perl were one of the main reasons people liked Perl better than C.
Re:Literals in Programming Languages by mahmud on Thursday February 28, 2013 @08:12AM (#5298488)
That line blurs when you have homoiconic syntax, specially one with a programmable reader. Common Lisp uses the # for dispatch macro character, you can define your own literals, in whatever environment you want.

http://www.franz.com/support/documentation/6.2/ansicl/subsec...

Re:Literals in Programming Languages by arethuza on Thursday February 28, 2013 @08:40AM (#5298571)
Can't you set any dispatch character you like using make-dispatch-macro-character ?
Re:Literals in Programming Languages by mahmud on Thursday February 28, 2013 @09:11AM (#5298677)
Oh yes, you can set your own dispatch characters, but the # is the dispatch character for the CL standard syntax.
Re:Literals in Programming Languages by DerekL on Thursday February 28, 2013 @02:54PM (#5300560)
C99 has array and struct literals:

  (int []) { 1, 2, 3 }
  (struct Point) { 3, 5 }
  (struct Point) { .x = 3, .y = 5 }
Re:Literals in Programming Languages by masklinn on Thursday February 28, 2013 @02:20PM (#5300350)
> This article is only about primitive literals, not compound ones.

It mentions array literals: http://www.gavilan.edu/csis/languages/literals.html#_Toc7587...

Re:Literals in Programming Languages by pilgrim689 on Thursday February 28, 2013 @08:57AM (#5298624)
> I like [Python] better than C

Isn't it strange to compare Python/Perl to C and say that one is better than the other? It's apples to oranges. You wouldn't use Python or Perl to build an OS, and you wouldn't use C to prototype a web app.

Re:Literals in Programming Languages by jmmcd on Thursday February 28, 2013 @04:31PM (#5301163)
Sure, but I said "like", not "better". When I learned Python, I had that feeling described as weightlessness by xkcd [http://xkcd.com/353/], because I didn't have to write several lines and a loop to make a list. It made me happy. Fair comparisons don't really come into it.