[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
What programming language has the best syntax? What makes good syntax?
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 84
Thread images: 10
File: 1431766054047.png (7 KB, 543x187) Image search: [Google]
1431766054047.png
7 KB, 543x187
What programming language has the best syntax?
What makes good syntax?
>>
>>51462859
Any lisp dialect. They are devoid of syntactic sugar, and do not obfuscate the realities of the underlying logic.
>>
>>51462859
c++ by far...
fuck c syntax
>>
>>51462900
APL
(~R∊R∘.×R)/R←1↓ιR
>>
>>51462900
the same could be said about stack based languages
>>
>>51462900
i agree (but some people dislike the (many) parentheses (but not me (except sometimes)))).

FUCK
>>
File: cowsay_big.png (9 KB, 320x264) Image search: [Google]
cowsay_big.png
9 KB, 320x264
Don't know about best, but piet has the most beautiful.

http://www.dangermouse.net/esoteric/piet.html


http://www.dangermouse.net/esoteric/piet/samples.html

Pic related is the sourcecode for a cowsay implementation.

Haskell has hands down the best list comprehensions, and it's dead easy for implementing many algorithms, but it's syntax falls down into horrible at times. But if you're doing heavy list comprehensions, it's clearly the best.

Python is an inconsistent joke when it comes to syntax,which is pathetic considering it was designed as an anti perl, and takes this as a motto: "There should be one-- and preferably only one --obvious way to do it"

C is still glorious after all these years, but it lacks some of the elegance you come to expect after working with modern languages. I've heard go is a good balance, but never tried it.
>>
>>51462940
Great. And now find a keyboard that supports those without typing ctrl-u-<codepoint> constantly :P
>>
>>51462859
If you want something that's easy and makes sense with natural language, I'd say c#. VB, haskel, F#, and ruby's syntax sux. Python's good and easy to read, but I like C++ and Java
>>
To me, perfect syntax would be PHP without $ and a dot as the object operator

Also some strictly typed concepts except for objects

int myInt = 4;
str myString = "Hello world";
obj myObject = new Object(myInt, myString); // instead of Classname variable = new Classname()
myObject.method();
>>
>>51462900
(Yeah, (I) (agree(with(your(opinion()))))
>>
>>51463045
That pretty much looks like Java.
>>
>>51463045
So basically Scala or something?
>>
Ruby, obviously.
Possibly the prettiest thing on this planet.
>>
>>51462859
Lisp.
A lack of inconsistency.
>>
>>51462934
>c++ by far
>fuck c syntax
Wtf nigger
>>
>>51462859
>What programming language has the best syntax?
Lisps
>What makes good syntax?
The lack thereof.
>>
Python, Ruby and LUA have clean and aesthetically pleasing syntax.
>>
>>51462859
Bring on the /g/ hate, but I think C#'s syntax is easy to read, organized, and succinct.
>>
>>51462948
Syntax Error!
>>
>>51463091
)
>>
>>51462859
>make sure i is prime to be more efficient

Fuck I am mad
>>
>>51462859
Lisp for simplicity. Haskell subjectively; curly braces and semicolons aren't mandatory, forced indentation of the code, gets rid of excess parens with $, function and arguments are just separated by spaces.
>>
common lisp has the best syntax
Good syntax is the easiest to read code.
>>
>>51464363
If lisp has the best syntax, why aren't more people using it?
>>
C/C++/C#. Everything else is hideous.
>>
>>51463952
This.
/thread
>>
Haskell and other MLish languages. Lisp is elegant in theory but ugly in practice, especially with type annotations.
>>
File: 1430632107272.gif (1 MB, 320x240) Image search: [Google]
1430632107272.gif
1 MB, 320x240
>>51464094
>>
Lua, with the exception of a few minor annoyances (like no increment operator)
>>
File: 1429487464755.jpg (13 KB, 338x394) Image search: [Google]
1429487464755.jpg
13 KB, 338x394
>>51464164
This. What the fuck were they thinking?
>>
>>51464717
You have +=, don't really need the special case of incrementing/decrementing by 1
>>
easy.

pic related. it's beautiful.
>>
>>51462859
assembly w/ at&t syntax
>>
>>51464994
?

Lua 5.3.1  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> var=1
> var+=1
stdin:1: syntax error near '+'
>>
>>51465032
He probably was confused since a lot of modified versions of Lua are used for special purposes/game modding, which include non-standard features like +=.
>>
>>51464094

Underrated post.
>>
>>51465073
Oops yeah, my bad.
>>
Icon is pretty sexy imo
procedure main()
every i := 1 to 100 do
write(case 0 of {
i % 15 : "FizzBuzz"
i % 5 : "Buzz"
i % 3 : "Fizz"
default: i
})
end
>>
>>51462900
In scheme
(define (square x) (* x x)) is syntactic sugar for
(define square (lambda(x) (* x x)))
>>
Powershell
>>
>>51465322
let is syntactic sugar too.
>>
>>51462859
LUA desu.
>>
>>51465953
I like lua, but "do" "then" "end" and "~" are pretty dumb.
>>
>>51462859
>what programming language has the best syntax?
Ada.
>what makes good syntax?
Maintainability. Plebs will disagree, but a lot more time is spent modifying and updating software than initially writing it. Lisp fails on this metric due to excessive parens usage, by the way.
>>
Haskell has the prettiest.

Best would probably be Python and maybe Scala, though Scala has some weirdness and very rarely used syntax.
>>
File: hahahahhaha.jpg (34 KB, 413x395) Image search: [Google]
hahahahhaha.jpg
34 KB, 413x395
>>51462948
>>
>>51466092
I agree. Ada is sexy in a mature way.
>>
>>51466999
much like Ada Lovelace herself
>>
>>51465164
>
 every i := 1 to 100 do

Trying too hard to be NotPascal.
>>
>>51462859
well, python definitely has the worst

i like java
>>
Ruby desu
>>
>>51462859
syntax should be easy... so python

there is no reason for complicated syntax like in c++
>>
I really like the syntax of C# and Haskell.
I've been using C++ exclusively for more than a year and while it's alright, I loathe the syntax.
And while the newer C++ standards try to improve it and somewhat succeed, I really fucking hate typing out std::unique_ptr<...> every time and it makes everything so annoyingly verbose, as compared to just Type*
>>
>>51468204
>python definitely has the worst
there are arguments here that it has the best syntax, so whatever you want to say it wouldn't be "definite".
>i like java
oh you're trolling
>>
>>51462859
>What programming language has the best syntax?
There are a lot of things I dislike about Python, but the syntax is GOAT.
>What makes good syntax?
Being simple, non-bloated (unlike C++) and yet making it immediately clear what you are looking at (unlike LISP)
>>
>>51462859
>What programming language has the best syntax?
Forth.
>What makes good syntax?
There shouldn't be any, just the bare minimal of something that separates words from each other (i.e whitespace).
>>
>>51470472
>unlike LISP[sic]
>despite the fact lisp is literally the only language that does that
>thinking python syntax is good
>despite these objectives
Hello world master detected.
>>
>>51470568
How the fuck is LISP clear? It's all fucking nested parentheses, on and on and on. You have to count how many of those fuckers you have open before you can even start to comprehend what the code is doing. Making everything a list may be nice for metaprogramming and stuff, but when everything looks the same it is not good syntax.
>>
Scheme, Forth, Io
>>
>>51470649
b7/8. Try a bit harder.
>>
>>51462859
swift
>>
>>51464386
Because C created a near-monopoly and was in the perfect spot of being human-readable while still being as close to the metal as it gets without devolving to assembly instructions.
>>
>>51471540
Except forth and fortran were both faster, more readable, and a fuckload safer, among many other options. The truth is that it was shilled to hell and back, and as the World requires, only shit can become popular so it won.
>>
I think Ruby's syntax looks nicer than Python's
>>
>>51462859
I like languages that have syntax similar to c++, c#, java etc.It just makes sense. You open something you close it.
>>
>>51463001
>makes sense with natural language, I'd say c#. VB,

Come on, Visual Basic is much closer to natural language than C#. Comically so.
>>
File: php-elephant.png (86 KB, 960x670) Image search: [Google]
php-elephant.png
86 KB, 960x670
>>
I'm surprised no one suggested html
Otherwise, java 's syntax is pretty good imo.
>>
File: pragmatapro_agda.png (39 KB, 410x313) Image search: [Google]
pragmatapro_agda.png
39 KB, 410x313
Agda
>>
>>51471715

How do you write device drivers in Forth or Fortran?
>>
>>51472446
I sure hope you're joking because forth and fortran are pretty much the definition of ideal for that.
>>
>>51462859
>how to turn a O(n) algorithm into a O(n^n) algorithm
>>
>>51472446
Forth is still widely used in embedded applications.
>>
For all the hate it gets I seriously think that Java is pretty sexy
>>
>>51468500

Not him, but I do prefer Java's syntax:

Syntax only really becomes important when you'll have multiple people maintaining over the lifecycle of the code. Java wins out because the syntax pretty much forces you to write easily maintainable code.

If you're judging syntax by the metric of 'how much do I have to type to have a given statement executed', then you get the nonsense arguments about verbosity.

In actual practice, the extra keystrokes are nothing compared to the advantages of being able to maintain it.

Hell - even when it is your *own* code: That feeling when you look at something you wrote three years ago but failed to adequately comment and you're trying to decipher what in the hell is going on? That's when syntax becomes important.
>>
>>51475091
but comments are a code smell
>>
Perl, because more syntax is better.
>>
No mention of javascript?

It's simple but still has the traditional vibe. Unlike python which I dislike
>>
>>51475346
eh its better than jquery
>>
>>51472385
I like it more than Coq, but even with agda-mode it's still a pain to write it. Proof assistants need a space-cadet-like keyboard to make them comfortable to use.
>>
>>51465021
While AT&T makes more logical sense, Intel is far cleaner in appearance.
>>
>>51475346
This. Despite what the memers on this board might say, javascript's syntax is extremely good at not getting in the way of whatever you're trying to do. It's so flexible that it just bends to your will.
>>
File: 1447984628614.jpg (40 KB, 500x375) Image search: [Google]
1447984628614.jpg
40 KB, 500x375
>>51471715
>Forth
>more readable
I love Forth, but come on. You're just taking the piss, son.
Thread replies: 84
Thread images: 10

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.