[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
How can other languages hope to compete?
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: 180
Thread images: 5
File: 73991-fig.gif (61 KB, 587x357) Image search: [Google]
73991-fig.gif
61 KB, 587x357
How can other languages hope to compete?
>>
>>55533426
By not having an awfully retarded syntax
>>
>>55533727
How is it retarded?
>>
>>55533877
the verbosity is just vomit inducer
>>
>>55533426
>Vector ( 1..Max_Length );
I can see at least 3 problems only in this
>>
>>55533426
>having to specify which block to end
jesus christ.
>>
>>55534721
It's so you can specify your index ranges. In Ada you traditionally start indexes at 1. If you were interfacing with C you might start at 0.
>>
>>55533426
what language is that?
>>
>>55534721
I would love if you listed all three.
>>
>>55535002
>Defining range
>Not starting from 0
>() and not []
>>
>>55535282
>complaining about options
>You could do that if you are mentally troubled
>kek
>>
>>55533426
Since apparently no one seemed to get the important part. You can define pre and post condition tests to verify your functions are working properly.
>>
>>55533426
is that haskell?
>>
>>55535598
Fucking this. This thread shows how the majority of /g/ is just uneducated mindless underage plebs who spout stale memes to try to fit in with their new friends after they've been jettisoned from their Reddit.
>>
>>55533426
>>55535598
>>55535658
If you do not give us some context, how am I supposed to know what the fuck is going on in your code? I know about 7 programming languages, but I do not know haskell/ada/whatever that shit is.
>>
>>55535708
It was just to see if anyone knew what I would be talking about. It's Ada btw.
>>
>>55535627
No.
>>
Compete with what? That unreadable mess? hahaha
>>
>not glorious APL

life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}
>>
>>55535880
>>55535911
Oh, well...
http://c2.com/cgi/wiki?AdaLanguage
http://bit.csc.lsu.edu/~gb/csc4101/Reading/gigo-1997-04.html
Sorry about that :^)
>>
>>55534695
That's just your opinion man
>>
>>55535911
>>55535880
>>55535984
The dysfunctionality of Ada exceeded all expectations. A company called Rational was formed to build a programming environment for Ada, which itself was programmed in Ada. The Rational machine could never manage its own storage and had to be rebooted every few hours. Another Ada company's compiler was written in Ada, with multiple tasks for multiple compilations. Neither could it manage its own storage, and also had to be constantly rebooted. If applications with minimal real-time response requirements could not be programmed in Ada, what hope would Ivan have with real-time avionics systems?

>falling for the ruse
>>
>>55534695
>>55533727
>mimimi muh curly braces
>>
>>55536114
Do you have sources on that?
>>
>>55536114
It sounds like it was their fault
>>
>>55536146
read >>55535984
>>
>>55533426
Who the hell implements a stack in a fixed-width array?
>>
>>55536479
It's just a baby example to show Pre/Postconditions and Predicates.

There are proper containers (vector, trees, maps) etc. in the Ada standard library which you could use instead.
>>
>>55536177
That was a fun read.

>(Sung to the tune "If I only had a Brain" from the movie "The Wizard of Oz.")

>I could discriminate records,
>deriving by the hoards, constraining the data.
>Your packages, I'd be using,
>while my names I'd be losing,
>If I only had Ada.

>I could loop away the days,
>Suspending with delays, accepting every port.
>And my coffee, I'd be perking,
>While my tasks were busy working,
>If I only had abort.

>I could NEW to good effect,
>without dealloc'd unchecked, sizing in ecstasy.
>And my nerves would not be jangling,
>when my pointers were left adangling,
>If I only had GC.

>I would meet every deadline, for each missile and each mine,
>By land and by the sea.
>And my storage would be pooling,
>While my tasks were busy dueling,
>If I only had GC.
kek

However, it's mostly a rant that doesn't even point out any concrete problems with the Ada language (apart from the year type, which really is stupid and goes up to 2399 in Ada2012).
>>
>>55533426
By having a non-GNU free implementation.
>muh glorious invariants
>>
>>55536557
If I understood right, you write a function, and then put condition before and after it to ensure if it works correctly, right?
If that's the case, then you should know that almost all of the functional languages have pattern matching, which executes a certain portion of code based on the kind of the parameters received. This gives you absolute control over the function's flow, in a switch-case kind of way. Which, by its nature, eliminates the need of putting conditions before or after the function's execution.
>>
>>55536836
>If I understood right, you write a function, and then put condition before and after it to ensure if it works correctly, right?
It's more about clearly documenting and automatically checking your assumptions and guarantees.
It's part of the interface of your package.
It's executable documentation.

You can use that to express that you can't write to a file you already closed.
Or that you can only send stuff over a sockets iff it has connected peers.

These are things that are hard to put into your types.
It's possible, but you quickly end up with something like dependent types, which are pretty much subject to current research.

You use Pre/Postconditions to express complex invariants which are difficult to express in the type system.
And those often have something to do with side effects.

>then you should know that almost all of the functional languages have pattern matching,
Pattern matching has little to do with that.
Ada has variant records which kinda let you do something similar.
Basically records ~ product types and variant records ~ sum types.
And you can "destruct" variant records in a switch.
But as soon as you want recursive pattern matching, which you do, it breaks down.

>Which, by its nature, eliminates the need of putting conditions before or after the function's execution.
That's only when
a) Your function is total (think about head from the Haskell prelude),
b) and has no side effects (follows from a)
c) You modeled all the behavior you care about in the type system
d) You actually handle all cases in your patterns (no pattern match failures) and the compiler is able to verify totality.
IIRC GHC can't verify GADT pattern matches. And you pretty much need GADTs to model anything interesting.

Especially c) is a problem.
You end up with really complex types just to model something that you can express trivially with Pre and Postconditions.
>>
>>55537362
I'm not a haskell programmer - more of a lisper. I fluently speak lisp and clojure.
On clojure you can do something like:
taken from the github page on clojure.core:
(match [x y z]
[_ false true] 1
[false true _ ] 2
[_ _ false] 3
[_ _ true] 4
:else 5)

So, you get to check any of the pre- and post-conditions appearing around your function. You also can destructure your args in the conditions, here. (so, it's not limited to values - you also can distinguish between the arguments having different structure - like an array of numbers starting with 1000, or a hashmap having a determinate key).
What's the substantial difference between this and the error handling in ada like the one you posted?
The fact that my function has no side-effects is almost always true - that is, if I follow more or less strictly the basic guidelines of functional programming, which I should do anyways. If you're letting side-effects happen in a haskell/clojure/lisp - then, maybe, you shouldn't use them.
Also, for the post-condition: you always can write a wrapper to your function, and then check shit there - before and after its invocation, especially if you need to check shit that is not among the variables you're passing. But why would you want to do that?
>You modeled all the behavior you care about in the type system
clojure and sbcl do not have one
>>
>>55538518
Not the same guy. I think the purpose in Ada is to run the variables through tests to verify that they are what you're expecting. The ultimate goal is to actually turn off the checks for release in most cases. This is useful for when the person that does the specification is not the same person that does the body, since the spec provides and easy to read and executable definition of the function.

I don't know anything about clojure, so if this is what closure is offering than great.
>>
>>55536146
Some (((Lispnik)))'s April Fools joke.

Even when joking, they still slander the goyim.

>>55538518
>I'm not a haskell programmer - more of a lisper. I fluently speak lisp and clojure.
(((Lispniks))) have been trying to wipe out the accomplishments of goyim for generations. Your knowledge is based on lies.
>>
>>55539403
Goyim as in non-jews?
>>
>>55533426
by not being unreadable mess
>>
>>55539309
it's not only clojure - pattern matching is a basic functinal programming technique. Yeah btw, it's a real blessing.
Speaking strictly clojure this time - clojure.spec is coming in the version 1.9. It specifies the structure of data, validates or destructures it, and can generate data based on the spec. It's so powerful it can almost do the job of an inferred type system.
>>
>>55539403
>(((Lispniks)))

I somewhat like lisp, but 99% of lispers should be gassed.
>>
>>55539732
I'm a lisp programmer, but never been in a lisp community, somehow. Maybe because I'm more of a clojurist... but whatever.
What's up with the lispers? All of the clojure communities I know are of the excellent quality. Have even been addressed by the language creator once. Nicest people ever.
>>
>>55539789
>All of the clojure communities I know are of the excellent quality.

Clojurians seem to be the exception among lispers. In fact a lot of lispers don't consider Clojure a "true" lisp (the definition of true lisp resides only in their minds, I guess).
Lisp is a wonderfully simple and powerful language, but it seems to attract a lot of autistic assholes, my $0.02.
>>
>>55539789
>>55539856
Hickey pls go and stay go.
Nobody likes you.
>>
>>55539732
If they said it was a better designed JavaScript or Python, I wouldn't care, but they say everything should be written in Lisp and everyone is less intelligent because their software doesn't use Lisp.
>>
File: Screenshot_2016-07-12_17-10-56.png (9 KB, 539x135) Image search: [Google]
Screenshot_2016-07-12_17-10-56.png
9 KB, 539x135
>>55539895
kek>>55539895
>>
>>55539895
>Hickey pls go and stay go.

>Found the CL neckbeard.

The Symbolics workstation broke again and you are out of spare parts, right pal?
>>
>>55539924
Not a (((Lispnik))) (as y'all like to call them), but I'd really like to see a lot of modern software written in lisp instead of other languages. I'm tired of seeing Stack/Integer/Memory other retarded bugs everywhere due to the manual memory management and uncontrolled type system. A lot of non-high-performance software should be written in lisp. But that's only my opinion.
>The Symbolics workstation
Their resurrection is one of my forbidden dreams.

Well, maybe I'm a lispnik then...
>>
>>55540073
>Well, maybe I'm a lispnik then...

You don't seem condescending enough.
>>
>>55540073
>I'm tired of seeing Stack/Integer/Memory other retarded bugs
These bugs are practically limited to C (a language commonly preferred and promoted by Lispers). Stack overflow comes from deeply nested recursion and there is no way to avoid it (not even in Scheme and Haskell), but it can raise an exception instead of crashing.

>A lot of non-high-performance software should be written in lisp.
There's nothing that makes Lisp better than any other dynamically typed language for these same things. Everyone who uses JS, Python, Ruby, PHP, Perl, etc. is programming the "Lisp way".

>>The Symbolics workstation
Have you ever actually used one? Everything you hear about them is from people who made money from them. It's marketing.
>>
>>55536114
https://en.wikipedia.org/wiki/Rational_R1000
http://datamuseum.dk/wiki/Rational/R1000s400

If it's a (((Lisp))) machine, these features are good. If it's a goyim machine, they're bad.
>>
>>55540454
>There's nothing that makes Lisp better than any other dynamically typed language for these same things

M-macros?
>>
>>55540508
Lisp macros are an abomination. You have to run arbitrary code in order to tell if a program is valid.
>>
>>55540073
>>55540484
>(((...)))
What's with this meme?
>>
>>55535598
java has aspect oriented programming too.
>>
>>55540584
It means they're a Lisp programmer. You see it on Twitter sometimes.
>>
>>55540584

Lisp, lots of spurious parentheses. Both in the language and in the programmers.
>>
>>55540584
Some /pol/ podcasters started saying Jewish names using a comedic echo effect, so (((...))) was the way of representing it in text. Lisp is well known for using parentheses, so the joke cross-pollinated. It's an extremely dense meme.
>>
>>55538518
Whether you pattern match or not is just an implementation detail.
Pre/Postconditions are part of the interface, the type siganture, if you will.

>What's the substantial difference between this and the error handling in ada like the one you posted?
I posted 0 Ada code. I'm not the OP. I'm that guy >>55537362.
Pre/Postconditions are not error handling.
They are a specifications that users of your code have to obey (preconditions) and guarantees they can rely on (postconditions).

Rather than putting "This method only works on vectors and hashmaps" in the docstring, you write a Precondition
that checks for vectors and hashmaps.
Again, it's executable documentation, not really code.

>Also, for the post-condition: you always can write a wrapper to your function, and then check shit there - before and after its invocation, especially if you need to check shit that is not among the variables you're passing. But why would you want to do that?
It's not really about checking shit at run-time. Often you disable Pre/Postconditions in production.
They guide you into using APIs your rely on correctly, during testing and early development.

It's really orthogonal to the implementation.
>>
>>55540695
They are also used by Ada/SPARK, to prove correctness
>>
>>55540732
Jup. And that's really, really cool.
I just didn't mention it because I don't think anybody here cares.
Though pre and postcondition alone are not enough.
You quickly have to use more SPARK stuff specify data flow, data dependencies and loop invariants.
>>
>Have you ever actually used one
Well, I didn't. But it's architecture is simply unbeatably resilient. Especially if you give a superficial look in Linux kernel code.

>JS, Python, Ruby, PHP, Perl
Everyone knows that ruby, php and js are godawful languages. Especially due to their dynamic """"types"""" and boolean conversions. Perl is read only, and Python is the only one okayish, although it's slow and inconsistent as fuck.
All of these languages may be made production ready and everything - but a lot of magic has to be made in background. If you are working on an application, especially a large one, you aren't always completely aware of everything that's happening - with your libraries, linters, compilers, et similia.
Lisp is superior not only because it can be modified to your likes through macros, but also due to its minimal syntax (hint: never look to the closing parentheses - only at the opening ones. You will discover that it's surprisingly easier to read) and to the fact that it is so clean that it takes a minimal effort to parallelize a function or to refactor something. Paul Graham was fixing issues with his platform while on phone on his customers...
I like it also because it is really concise. In clojure you can simply (slurp namefile) to read one, or (spit "some shit") to write some shit in it.

>Stack overflow comes from deeply nested recursion
In scheme and haskell you don't avoid it - you use it

>These bugs are practically limited to C
Well, not always. Very often, you send in production shit you wrote in one language and compiled in C to gain performance... and that's where shit hits the fan.
Also, try to do math with JS/PHP/Python without the dedicated library (BigInteger in PHP is not even ready for PHP7). You'll be unpleasantly surprised with the bugs you believe to be limited to C/C++.
>>55540636
read the hint above
>>
>>55540843
>Very often, you send in production shit you wrote in one language and compiled in C to gain performance... and that's where shit hits the fan.
>Very often
I don't think so, Tim.
>>
>>55540843
>Also, try to do math with JS/PHP/Python without the dedicated library (BigInteger in PHP is not even ready for PHP7). You'll be unpleasantly surprised with the bugs you believe to be limited to C/C++.
Wow, many Lisps have big integers and rationals in the standard library, so fucking what?
You can still shoot your self in the foot with over and underflows in lisp.
>>
>>55536479
The linux kernel :^)
>>
>>55540876
Where?
>>
>>55540695
Oh, it's clearer to me. The core.spec that's incoming in the clojure 1.9 is more similar to this technique, then.
I wrote more about it here >>55539686
Don't trust the description - haven't tried it yet. 1.9 is unstable yet, and I don't feel like alpha/betatesting shit for free, yet.
>>
>>55540901
http://elinux.org/Kernel_Small_Stacks
"The default stack size for a process running in kernel space is 8K"
>>
>>55540909
>>55540695 here
Yeah, I'm reading the docs right now.
I'm quite fond of clojure too :3
>>
>>55540875
How? Never experienced an under/overflow in SBCL yet. Care to share an example?
Even then, it's harder to shoot myself in the foot with lisp then in any other popular interpreted language. In JS it's as easy as writing a function closure in a retarded way. And in PHP... well, don't get me started. Having programmed in those godawful abominions I really shouldn't.
>>55540949
Mein neger
>>
if (people=fucked) then (stupid fucking people = death of us all)
end
>>
>>55540965
>How? Never experienced an under/overflow in SBCL yet. Care to share an example?
In Clojure, just use unchecked math "for performance".
Though you have to be explicit about it, which makes less bad than in JS etc.

There are some popular languages that check overflow by default, though.
Like C# and F#. I was pretty disappointing to see that Haskell doesn't.
>>
>>55539403
lol xD

now fuck off with your /pol/ shit
>>
>>55541141
Oh well, I knew about the thing in clojure. Unsurprisingly, JVM always founds the way to fuck the devs in the ass. It doesn't even have TCO - clojure devs had to make a special function to cop with this bullshit (Two actually - recur and
trampoline
).

Don't know about haskell, but it it truly doesn't - it's a real shame. Due to its performance and its functional pureness I was holding it in a really high regard. Was even thinking about learning it - well, maybe after I'll learn scala...
>>
>>55536114
another day on /g/, another meme language BTFO
>>
>>55540843
>But it's architecture is simply unbeatably resilient.
I would say the architecture of mainframes is lot more resilient than Lisp machines. Lisp machines were non-real-time and single-user. They were never exposed to hacking. MS-DOS would have the same problems (but DOS was better for real-time systems).

>Especially due to their dynamic """"types"""" and boolean conversions.
How is Common Lisp any different?

>the fact that it is so clean that it takes a minimal effort to parallelize a function
Have you heard of OpenMP?

>or to refactor something
Lisp macros make it almost impossible. Refactoring a statically typed language is a lot easier.

>Paul Graham was fixing issues with his platform while on phone on his customers...
Fixing issues how?

>In scheme and haskell you don't avoid it - you use it
Any runaway recursion will give you a stack overflow. Try the Ackermann function in Scheme and Haskell.

>Very often, you send in production shit you wrote in one language and compiled in C to gain performance... and that's where shit hits the fan.
I've never seen that. I have seen where someone wrote something in Lisp and converted it to interpreted Python to gain performance.

>You'll be unpleasantly surprised with the bugs you believe to be limited to C/C++.
Big integers can be done in any language, but most of the time you don't need them. Undetected overflow is a bigger problem.
>>
>>55541319
"In 1969, AT&&T had just terminated their work with the
GE/Honeywell/AT&&T Multics project. Brian and I had just started
working with an early release of Pascal from Professor Nichlaus Wirth's ETH
labs in Switzerland and we were impressed with its elegant simplicity and
power. Dennis had just finished reading 'Bored of the Rings', a
hilarious National Lampoon parody of the great Tolkien 'Lord of the
Rings' trilogy. As a lark, we decided to do parodies of the Multics
environment and Pascal. Dennis and I were responsible for the operating
environment. We looked at Multics and designed the new system to be as
complex and cryptic as possible to maximize casual users' frustration
levels, calling it Unix as a parody of Multics, as well as other more
risque allusions. Then Dennis and Brian worked on a truly warped
version of Pascal, called 'A'. When we found others were actually
trying to create real programs with A, we quickly added additional
cryptic features and evolved into B, BCPL and finally C. We stopped
when we got a clean compile on the following syntax:

for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);

To think that modern programmers would try to use a language that
allowed such a statement was beyond our comprehension! We actually
thought of selling this to the Soviets to set their computer science
progress back 20 or more years. Imagine our surprise when AT&&T and
other US corporations actually began trying to use Unix and C! It has
taken them 20 years to develop enough expertise to generate even
marginally useful applications using this 1960's technological parody,
but we are impressed with the tenacity (if not common sense) of the
general Unix and C programmer. In any event, Brian, Dennis and I have
been working exclusively in Pascal on the Apple Macintosh for the past
few years and feel really guilty about the chaos, confusion and truly
bad programming that have resulted from our silly prank so long ago."
>>
>>55535598
>What are assertions?
>>
>>55539924
Lisp came before JavaScript and Python. JavaScript and Python are dumbed down versions of Lisp, for better or worse (I wouldn't trust the average programmer with multimethods, macros, and continuations).
>>
>>55540454
>Stack overflow comes from deeply nested recursion and there is no way to avoid it (not even in Scheme and Haskell)
Other than TCO, of course, or CPS.
>>
>>55541549
Have you tried the Ackermann function in Haskell and Scheme yet?
>>
>>55540554
That's called the halting problem.

There's a difference between semantically valid and syntactically valid. Lisp validation is superior to other languages syntactically and just equal semantically
>>
>>55541276
Haskell does have a built-in big int type.
But it does not check for overflow for Int, and Word types.
It neither does "expansion" like clojure.

>Was even thinking about learning it - well, maybe after I'll learn scala...
Learn Haskell. It's quite fun and very very different than clojure.
It's definitely worth it.
Type wizardry and dicking around with Monads, Functors and what not is a lot of fun.
Rejecting Haskell just because of the missing overflow checking is nit-picky.
There are way better reasons to not like Haskell.

I had to use Scala briefly (in university) and the experience was very frustrating.
Type inference breaks down when you need it most, in Haskell it just fucking works.
Just building something simple resulted in 2 (!) versions of the fucking humongous scala compiler to be build
by sbt (scalas lein).
The type system is bananas.
Implicits make me nervous.
It has a very complex syntax.
You can very easily program Scala in a Java style , Clojure at least resists somewhat.
Quite a lot of code I saw looked like transliterated Java.
It's a really bad choice to learn (statically typed) FP in it.
Go for Haskell or OCaml.

Btw, Scala doesn't do overflow checking either.
>>
>>55541564
That's not primitively recursive, so what's the point?
You can implement it using iteration without some form of explicit stack.
>>
>>55541627
Should have been "You can't implement it ..."
>>
>>55540875
>You can still shoot your self in the foot with over and underflows in lisp.
Overflow in sbcl throws exception.
>>
>>55541568
>That's called the halting problem.
Language syntax should always be decidable.

>There's a difference between semantically valid and syntactically valid. Lisp validation is superior to other languages syntactically and just equal semantically
"Validation" in Lisp is undecidable.
>>
>>55541490
They're harder to use and aren't done when you specify the function.
>>
File: 1468182590328.png (814 KB, 720x540) Image search: [Google]
1468182590328.png
814 KB, 720x540
>>55535658
This. Ever since I migrated here last year it has become apparent that 4chan users are overwhelmingly underaged. We really need to implement some kind of rating system for replies/users in order to allow those of us that actually know what we are talking about to rise above the memeing masses. Just my 2 cents.
>>
>>55541577
Well, I had this book, "Functional Programming in Scala", that was praised a lot, thought it would be a good idea starting to read it... Naturally, I wasn't discarding Haskell only because one issue, but, you know; I thought that staying within the JVM would give me more opportunity to be employed and learn while working. Probably will learn both at some point
>>55541354
Lisp machines were built with the purpose to be single-user workstations, and were slow as fuck due to their underpowered hardware. So slow they would sometimes stop to collect garbage.
Nevertheless, it was literally impossible seeing any lisp machine to die without the possibility to recover the computation in execution, - it would halt and let the user decide. Things as "crash" did not exist. That's one of the countless reasons I'd love to see them again.
>How is CL different?
It's different because it has none of this bullshit:
https://github.com/puffnfresh/wat-collection/blob/master/wat.php
http://www.loomcom.com/blog/2015/06/29/the-wats-of-javascript/
>OpenMP
everyone has heard about OpenMP. Have you heard about Erlang? this tiny, functional language, slow as fuck (not as python though) obliterates every single example of multithreading/processing in every other language. The point is: the architecture. You don't always know that your application has to be parallel. The requirements come while you're implementing shit. Some things are foreseeable, some are not. And you don't want to start setting up OpenMP when your customer expects you to ship IMMEDIATELY.
>lisp macros
lisp macros is the reason lisp is superior. You can program your own programming language. Care to explain how do they make your refactoring impossible?
>Ackermann function
It's double fucking recursion that grows faster than the fucking bamboo - of course it's gonna blow shit up. In every single language. That's more of a compiler's test, not the language's. You don't do that in production, obviously. (cont.)
>>
>>55533426
looks like another memelang
>>
>>55543687
Maybe you've heard of some of these things.
https://www.seas.gwu.edu/~mfeldman/ada-project-summary.html
>>
>>55533426
>How can other languages hope to compete?+ 0 post omitted.
Better tooling.

Go doesn't have a fancy type system. It doesn't have inheritance (so no polymorphism), it doesn't have templates or a macro system, it doesn't have complicated stuff like range types or subtypes of any kind, it doesn't reject programs that """might be unsafe""", it doesn't have any of the latest fads in academic buzzwords. It just has superior tooling to everything else on the market (except arguably C/C++). That makes it the best language for doing actual work, and the best language to invest in if you expect to have a job in 5 or 10 or 20 years.
>>
>>55541354
>lisp2python
What the living fucking abomination of code have you seen? I've never seen lisp code slower then python's. SBCL performance does not match Java, but it comes pretty close. Python is orders of magnitude slower.
Speaking of python, I've seen things sent in production compiled with CPython, rewritten in other languages, used in PyPy, but almost never on default VM - at least, in production.
OTOH, lisp is always production ready. It may have less libraries than it should, but they do work well. Clojure, in particular, may use the entire Java ecosystem.
>>55541534
So much this.
Maybe, except the fact that Python's paradigm is the exact opposite of lisp from the paradigmatic point of view. Nonetheless, I share your point of view when it comes to the macros and continuations, but not multimethods. I believe that, probably, they would make the usual spaghetti a small bit more readable.
But that's only my opinion.
>>55540554
care to explain why?
>>
>>55533426
By not forcing you to write mountains of code for very little gain.

Ada code still has bugs, except they are harder to see at a glance because you usually need to look at ten screenfulls to fully understand one problem.

It's the exact opposite extreme of golfed Perl.
>>
>>55543809
Does anyone have that quote that says Go was designed for stupid people?
>>
>>55543934
>Go was designed for stupid people
>>
>>55543934
I't right here: >>55543967
>>
>>55543967
"The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt."
>>
>>55543907
>you usually need to look at ten screenfulls to fully understand one problem.
Not in my experience. Ada has nested subprograms and packages to break up code into understandable parts.
>>
>>55544078
...And I thought that google hired only the most brilliant programmers they could possibly find. Shame on me.
I hate all the overly verbose languages. The only reason I like python is the fact that it's one of the best pseudocode-like imperative languages available. And it's really, really readable.
>>55544118
Even the assembly has those. I wonder when will people understand that the verbosity is not making any language more readable.
>>
>>55544146
Ada is trivial to read if you know it.
>>
>>55544118
Well, that's hyperbole...but I don't find verbosity and redundancy really helps make readable, reliable, or maintainable code. That is all up to the skill of the programmer.

But when you do get problems, I find it far easier if the problem only requires you to look at some small snippet rather than take in all of the needless context that Ada gives to you.

It's not that it's hard, it's that it's a signal to noise ratio.

Then again I am biased, I like Clojure.
>>
>>55544227
Most things do what they say on the tin.
Except for formals parameters of generic, the syntax for them is really cryptic.
>>
>>55544285
I will agree that generics are complicated, but that isn't a verbosity issue.
>>
>>55544266
When I write Haskell or Clojure code I tend to simplify things to the point that they're hard to read much later (like in +6 months).
The Code is neat, clever, short and basically reads like pure math.
It's like the language pushes me to find the most terse and elegant formulation for something.
I want everything to be a small, clean and as pure as possible.

In Ada, however, my Code tends to solve the problem at hand in the most obvious and direct fashion I can get away with.
It's a bit long and unrefined, but it's straight forward.
Because I need more functions, variables and stuff in the Ada code, I get to name much more things.
The language itself is already rather verbose, so the lengthy but conceptually simple solution doesn't bother me at all.
The code is mechanical rather than mathematical.

I find that looking back on code that I wrote 6 months ago and picking out some part of the program and understanding
what it does is easier in Ada.
>>
>>55544784
Interesting. I have the exact opposite experience, particularly when dealing with collections in some way.

For example, this is a (slightly nasty) function I wrote in JavaScript a while back that makes a JSON string out of a set of custom user fields, basically a piece of HTML that will work consistently across any page as long as the elements exist:
function getCustomFieldJSON(){
return JSON.stringify($('#userFields li').filter(function(i, targ){
return targ.children[0].value;
}).map(function(i, targ){
return {
"name": targ.children[0].value,
"value": targ.children[1].value
};
}).toArray());
}


This code is super-obvious if you know .filter() and .map(), and even though it uses the hell that is indexes, it fails in incredibly obvious ways that are easy to fix if you write your HTML wrong.

Now, if this were written in a more strict language, we would need either a lot of boilerplate, or an enclosing type to grab things like this in a dynamic way. There would also be a loop with a conditional inside (In Ada, at least), which, while ok, is less readable than .filter()... Also, the generation of each element would need yet another type, or reuse one. (Though that's a bad idea because that makes readability worse.)

All in all, it would still be OK to read, but it is less readable than the terse and dynamic approach. Also, the dynamic approach is something that you can look at months down the line and still know exactly what it does.
>>
>>55545587
what is this hot meme garbage?
>>
>>55545587
That's genuinely disgusting
>>
I almost fell for the functional meme. Then I saw the light. I am now working to become a full-time Ada programmer.
>>
>>55524249
>>
>>55546653
You can read the reference manual :^)
>>
>>55546653
Read this learnadanow.com
The wiki book and Ada Distilled are really useful.
If you come from c++ or Java, there is the "Ada fro the c++ or java dev" pdf, just look around.
>>
File: tao.png (39 KB, 979x580) Image search: [Google]
tao.png
39 KB, 979x580
Ada isn't sexy or cool by any stretch, but it works well for its intended purpose.
Lisp and C fulfill other purposes entirely.
I guess even Java and COBOL have a purpose, but for those the master remains silent.
>>
with Ada.Text_IO;
use Ada.Text_IO;

procedure Test is

subtype Fizz_Buzz is Integer with
Dynamic_Predicate=>Fizz_Buzz mod 15 = 0;
subtype Buzz is Integer with
Dynamic_Predicate=>Buzz mod 5 = 0;
subtype Fizz is Integer with
Dynamic_Predicate=>Fizz mod 3 = 0;

begin

for I in 1..100 loop
if I in Fizz_Buzz then
Put_Line("Fizz_Buzz");
elsif I in Buzz then
Put_Line("Buzz");
elsif I in Fizz then
Put_Line("Fizz");
else
Put_Line(Integer'Image(I));
end if;
end loop;

end Test;
>>
>>55534695
I bet you think java is good.
>>
>>55536479
every fucking one whom learned data structure + algorithm and suck?
>>
>>55537362
sound like Elixir/erlang
>>
>>55545587
give names to your anonymous function and add comments, little shit
function getCustomFieldJSON(){
var getChildValue = function(_index, item){
return item.children[0].value;
};

var extractValue = function(i, targ){
return {
"name": targ.children[0].value,
"value": targ.children[1].value
};
}

return JSON.stringify($('#userFields li').filter(getChildValue ).map(extractValue).toArray());
}
>>
>>55533877
You're just retarded.
>>
>>55542880
Yeah, they are done at tests, where they belong. Are these post condition tests your only tests? Do you put more complex test code there too?
>>
>>55551785
The tests can be as complicated as you need them to be. They aren't supposed to replace unit tests, but they help ensure your unit tests are actually successful and hopefully resolve any issues before you get to final testing in the first place.
>>
>>55551891
Well, that's not that much of a killer feature, isn't it?
>>
>>55551904
Yet it's better than everyone else's implementation.
>>
>>55551981
It's not, since it's doable in any language without that much of an effort. It may be a little bit more idiomatic in Ada, but that's all.
>>
>>55552030
Could say that for any feature of any language
>>
>>55552119
Well, you may test a function by inserting a pre- and post- call even in the fucking C. You can't easily do metaprogramming like in nemerle or lisp in Ada, for instance.
>>
>>55535970

fuck, i just discovered that like amonth ago, blew my mind,

still is a meme though
>>
>>55540843

>Everyone knows that ruby, php and js are godawful languages.

How can you even compare those? Because they are "internet languages"?

It's like comparing C, Clojure and Cobol - well, they all start with a "C", right?

If only we could live in a world were people talked about experience, and not about memes..

>http://www.randomhacks.net/2005/12/03/why-ruby-is-an-acceptable-lisp/

>https://blog.jacius.info/2012/04/04/a-rubyists-impressions-of-common-lisp/
>>
>>55552419
Except that's not the same thing, and you know it. PHP was very strong because of the fact that it was the first one to have inbuilt templating, and allowed the developers to churn write-only spaghetti in brief times. Ruby - because of rails and strong push from its SJW evangelists, but then it kinda stopped. JS is browser's lingua franca. They may have a different paradigm, but they share a common trait: they're all practically oriented, but lack a strong theoretical base. As a result, you see all of the type conversions going to fuck themselves because of it (as stated in the links in the post you quoted).
>ruby is an acceptable lisp
You may say that it's an acceptable functional language, but, as long as it's not homoiconic, every single statement to support that is bullshit.
also:
>Ruby's libraries, community, and momentum are good
>ruby's community
>good
A not terminal cancer is still cancer
>>
>>55552650

I agree with the PHP part. And if it wasn't for it's big frameworks (Wordpress, Laravel and so on) PHP would probably dead by now. PHP is nice for what it does, but.. well, it's ugly.


Ruby however is a completely differnt beast. It's a very well-thought langauge. True, if it wasn't for Rails, Ruby would probably be an insider Joke on japanese faculties. But Ruby is not only Rails. It's rather the other way arround: somethings as magical as Rails couldn't have been made with any language, since you need the "Ruby magic" for it.

The creator of Ruby once said:
"Some may say Ruby is a bad rip-off of Lisp or Smalltalk, and I admit that. But it is nicer to ordinary people."

And while he was of course joking, you can cearly see the those langauges (as well as Perl) in Ruby.


>because of rails and strong push from its SJW evangelists, but then it kinda stopped.

Actually it had a big comeback this year.


>as long as it's not homoiconic

Homoiconicity is overrated. Other langauges like Haskell are also not homoiconic and still incredibly powerfull and complex.
And if you really want a homoiconic langauge, you can learn Elixir. It is homoiconic and very functional, while having on a lot of good stuff from Ruby (the develloper is a former Rails guy).
>>
>>55533426
By being DeviousYarn.
>>
>>55553080
I didn't say that it's shit if it's not homoiconic. But it's not lisp. Which, per se, does not mean that it's not a nice language.
>elixir
https://news.ycombinator.com/item?id=7623991
"elixir is not homoiconic, it never was, and they no longer make that claim" - creator of lfe.
I know elixir however, and was planning on learning it some day - not before erlang, anyways. I like both for their incredible distribution capabilities.
One of the things I hate about some dynamic languages is the inconsistency of the type conversion. Sadly, the languages I mentioned suffer a lot from it. Especially PHP. If you believe that PHP is nice for what it does - then you haven't used it long enough. It's literally a hellish spawn of the perverted demon who hates all the logic and programmers in the world.
>>
>>55553170

AFAIK it is:

>https://en.wikipedia.org/wiki/Homoiconicity#Examples

>http://devintorr.es/blog/2013/06/11/elixir-its-not-about-syntax/

>http://www.enchanters-arts.net/2015/10/21/elixirconf-us-2015-conference-report/


Well, for the rest:

>One of the things I hate about some dynamic languages is the inconsistency of the type conversion.

This is a point at JS, but I feel like Ruby is very consistent. You can't even output something like: ' "hi " + 3 '
Because a number isn't a string (as in most langauges).And I think this is a good design decision.

> If you believe that PHP is nice for what it does - then you haven't used it long enough

It's good for quick and ugly fixes like "oh shit, I need some input here.. OK, fuck it, I put a line of PHPH down".

Apart from that, Laravel is the only reason I would use PHP again..
>>
>>55552419
>>55552650
>>55553080
I unironically prefer PHP to just about any other scripting language for general-purpose scripting (I'm not talking web dev). The C-like syntax is a matter of personal taste (and the reason why I also used to like Perl), but the real reasons I'll take it over Python, Ruby, JS etc. are: sane fucking scoping rules, proper type hinting, proper encapsulation, and real multithreading (unlike CPython's GIL implementation). Plus it's usually faster than the rest.

People seem to bash PHP mainly because of legions of clueless Pajeets churning out fuckloads of absolutely terrifying spaghetti code (which, BTW, is soon going to be the case with Python, now that it seems to be babby's first language of choice) and some ancient abominations like Wordpress refusing to fucking die already. The language itself, however, is more mature than people give it credit for.
>>
>>55553356
Multithreading in php is awful. Tried it with about every single library in existence. The only one who worked half-decently had a long set-up time. It's hard compared to other languages. When I tried to use the CSP implementation in clojure, core.async, I went from 0 to a half-working application real fucking quick. Also, it offers parallelization with pmap out of the box, included in the standard library. The only downside is the JVM, - but it's relative, since it also offers a fuckload of libraries inherited from java.
If I had to choose any scripting general-purpose language, I'd probably choose racket, ruby or even python over the rest. Also because you don't need multithreading in something that has to be done quickly. Python is usually the prototyping language per definition...
>>55553264
Sorry, but I have to disagree about PHP. I spent a year developing in it, and I literally prefer bash over it. Used phalcon to organize everything, which as framework is pretty nice (even if it had too much setup time), but it couldn't cleanse the horror of the language.
>>
>>55553356

Once again I'm with the founder of Ruby who said:
"I didn't work hard to make Ruby perfect for everyone, because you feel differently from me. No language can be perfect for everyone. I tried to make Ruby perfect for me, but maybe it's not perfect for you. The perfect language for Guido van Rossum is probably Python."

That's it.

I develloped a lot of stuff in VBA, and while many people have to vomit at the sheer mention of VBA, I'm just damn fast in it because I know it inside out.

So probably the same goes for you and PHP.

Nevertheless, let me answer specifically for Ruby:

>sane fucking scoping rules
You have Class variables (@@a_variable), Instance variables (@a_variable), Local variables (a_variable) and even Global variables ($a_variable) if you feel like it.


>proper type hinting

You can either use Duck typing or just implement type hinting in Ruby, if you really feel like it:

class Person
def initialize(*args)

args.size == 2 or raise ArgumentError

raise "Argument error blah blah" unless args[1].kind_of?(MyClass)

name = args[0].to_s
birthday = (args[1] || DEFAULT_DATE).to_date

end
end



>proper encapsulation

You have access modifiers:
private :my_private_method, :my_other_private_method


> real multithreading

Ahh, this is difficult topic..

Maybe read this:

>http://www.jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil


>Plus it's usually faster than the rest.

A tad.
>>
>>55535708
You are some special kind of retarded. Get off /g/ and kys family member.
>>
>>55554360

I also find the code hard do read, tbqh..

-What's a "pragma"?
-Sometimes a ";" at the end of the line, sometimes not, why?
-What does "Positive range <>" mean?
-What the hell is the meaning of: "(S : in out Stack; E : in Integer)", are there two stacks?
-What does "S'Old.Enties" mean? Is it the same as "S.Old.Enties"? I dont get it..


Nah, this is far from good syntax..
>>
>>55554517
I bet you don't know more than one language.
>>
>>55554540

Yes I do.

But none of them has such a wierd and unreadable syntax..
>>
>>55554700
The most common ones, then?
Because if this seems weird to you, I wonder about your reaction when you'll see some, say, haskell or erlang code...
>>
>>55554725
why would you expect anyone to intuitively understand haskell/erlang code coming from popular/conventional languages u smug retard?

t. someone who actually uses haskell but isn't a dipshit about it
>>
>>55554817
no no, it's the other way - I expect people to understand less haskell/erlang than ada - the latter has more english words in its syntax
>>
>>55554517
>I can't read code in a language I haven't learned yet
>mimimi syntax is shit
Protip: You couldn't read C before learning it either.

>-What's a "pragma"?
Basically, it's for instructing your compiler to do certain things.
Here, pragma Assertion_Policy(Check) means that all assertion should be checked at runtime
and throw exception when they fail.

>-Sometimes a ";" at the end of the line, sometimes not, why?
Because the delimit declarations, not lines.

>-What does "Positive range <>" mean?
It's inside an array declaration and refers to the "key type" of the array.
In Ada you can index n array by different kinds of intergers and enums.
Positive is a signed integer which is between 1 and MAX_INT.
This means it's a 1 indexed (as in the first element is at 1).
You could define an array with Positive range 2 .. 5.
Which is a 3 element array, where the first element is at index 2.

>-What the hell is the meaning of: "(S : in out Stack; E : in Integer)",
It's the parameter list of a function/procedure
>S : in out Stack
means S is a parameter that can be read (in) and changed (out).
effectively it's passed by reference, though the compiler is free to do something else.
The 'in out' part specifies how this parameter is passed/accessed.
>E : in Integer
Means the second parameter named E is a read-only integer.
Usually passed by value, but again the compiler can do what it wants.

>-What does "S'Old.Enties" mean? Is it the same as "S.Old.Enties"?
Ada uses ' to access so called attributes. They are different from members "." .
Attributes usually refer to things that require special compiler knowledge/intervention,
like what MAX_INT is (Int'Last) or how wide a type T is (T'Size).
You can even ask for the alignment of stack variables and all kinds of other stuff.
Ada give you really fine grained control over memory layout and so on.

In this case S is a parameter name.
S'Old denotes S before the call, whereas S is S right after the call.
>>
>>55554873
I forgot something.

>-What does "Positive range <>" mean?
Also means that the length is not specified, hence it's variable.
Vector is a VLA.
>>
>>55554873

>Protip: You couldn't read C before learning it either.

Yes, but langauges are readable or not readable. Just like Spanish and Vietnamese are both langauges, but one of them takes 10 times longer to learn.

>pragma Assertion_Policy(Check) means that all assertion should be checked

So basically you could change this whole "prestate/ poststate" stuff into simple assertions? That seems more readable to me.

>S : in out Stack

Why would I want to read a stack when I push something onto it? Since "Push" is not a method of the stack itself you are only using it for it's side effects, so why do I need to specify that?

>S'Old denotes S before the call, whereas S is S right after the call.

That's the first thing I actually like.

Even though I prefer Perl's usage as "backticks".

>length is not specified, hence it's variable.

Makes sense, but "range <>" doesn't look like a good keyword to me.


After all, I don't find Ada very appealing, sorry.
>>
>>55555249
>Yes, but langauges are readable or not readable.
C and languages based on C syntax are some of the least readable >>55541369
>>
>>55555758
That's subjective. If you're vietnamese and are being taught vietnamese from birth, and then, when you're already a full-grown man, discover english - you deem it extremely unreadable.
Daily reminder that the majority of people learn C/Java as their first language, which ties forever their concept of "readable" to that ugly shit that's C-like syntax.
>>
>>55555758
no its not.
Okay, c++ takes some getting used to, but the rest is easy to read.
>>
>Ada
GO DIE IN A FIRE YOU STUPID FUCKING LANGUAGE, I love your runtime safety checks but goddamn the syntax is all verbose, I'm trying to write a big program, not A Midsummer's Night Dream.
>>
>>55541369

>for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);


Hurr, I write everything in one line
Hurr, I don't use whitespace
Hurr, I use upppercase for control variables

for(  ;  p("\n"), r--  ;  p("|")) {
for(e=c ; e-- ; p( "_" + (*u++/8) % 2)) {
p( "| " + (*u/4) % 2);
}
}
>>
>>55556166
Programs are read more times than they are written.
>>
>>55556754
Any verbose stuff tends to put me off as well, even if it's just long variable names in C-like language. It's like reading through legalese instead of normal text.
>>
Oh look, it's a meme language of the month thread.
>>
File: 1434893868534.jpg (62 KB, 640x702) Image search: [Google]
1434893868534.jpg
62 KB, 640x702
>>55556982
>Ada is a meme language
>>
>>55556982
>everything I don't like/know/have an idea about is a meme
>>
>>55556982
See >>55543761
>>
>>55556982
At least everyone forgot about Rust.
>>
>>55555249
>Yes, but langauges are readable or not readable. Just like Spanish and Vietnamese are both langauges, but one of them takes 10 times longer to learn.
Depends whether you are Asian or European.
How easy another language is to learn, only depends on your previous knowledge of languages.
Whether you like them or not depends on your taste.

>Why would I want to read a stack when I push something onto it? Since "Push" is not a method of the stack itself you are only using it for it's side effects, so why do I need to specify that?
Depends on your implementation.
If you truly get by with only writing to it, by all means, specify it purely as an 'out' parameter as opposed to 'in out'.

>So basically you could change this whole "prestate/ poststate" stuff into simple assertions? That seems more readable to me.
The point is that those assertions will be placed at all call sites.
And you'd have to write it yourself.
Putting it inside the implementation as assertions is different.
Assertion are for expressing *internal* invariants.
Pre/Postconditions express *external* invariants.
They are part of the interface.

Again, it's not really about the checking, it's about specification.
Like I described here >>55540695.

For normal Assertions you would use pragma Assert (Expression, Message), much like the assert function in C.

>Makes sense, but "range <>" doesn't look like a good keyword to me.
"range <>" is not a keyword. only range is.
<> is used throughout the language to mean "use the default" or "specified somewhere else".
They are to separate things.

>After all, I don't find Ada very appealing, sorry.
I'm not trying to convince you of anything.
You asked what that stuff meant and I answered.
If you don't like it, you don't like it.
>>
>>55556528
That's not all that much better.
>>
>>55556166
I just don't get why people are so obsessed about their damn curly braces.
>>
>>55557819
They like occasionally losing them
>>
>>55556528
Looks equally shit
>>
>>55557704

>How easy another language is to learn, only depends on your previous knowledge of languages.
>Whether you like them or not depends on your taste.

Both statements are true, but I was talking about readability, not if have problems to learn a language or wether I like it or not..

I can read a Programm in Java, C, Python, Ruby.. Even Clojure, Perl or Haskell (if I have to) and will more or less get a idea what it does, unless it's hacky shit or some nasty math.

The example in the OP is pretty hard to read, the keywords that are not simiar to any other language I've heard from. Those line breaks make it difficult to know where something ends and something begins, for example:

I read from
>type stack ( Max_Length : Natural)
to
>Entries : natural ;

Because in the line above the ";" was the end of declaration of "Type vector".

But what is that?
No, this time it's not the end of the declaration of "Stack", this goes on and on. Instead there is a subdeclaration of "record" which is easy to miss - and why doesn't "record" need a "type" statement like "Vector" and "Stack"? Looks pretty inconsistent to me.

Of course you can explain that, but it's a lot of "WTF?"' I had at first sight.

>If you truly get by with only writing to it, by all means, specify it purely as an 'out' parameter as opposed to 'in out'.

I'm sorry, I don't get that.
A "push" operation should recieve the and the value and then add the value to the stack. I have no clue what you mean with this in/out..

>"use the default" or "specified somewhere else"

OK, so this is actually easy to understand. Still a placeholder could be more intuitive with something like "_" or "." or a simple "default"..
Or why not just leaving it away? "(Positive Range)" would be more readable.

>If you don't like it, you don't like it.

I'd like to like it. But "How can other languages hope to compete?" are big words for a langauge that difficult to read.

The "pre/post state" is nice, but the rest..
>>
>>55559847
From pajeet overflow
> An in parameter can be read but not written by the subprogram. in is the default. Prior to Ada 2012, functions were only allowed to have in parameters. The actual parameter is an expression.

>An out parameter implies that the previous value is of no interest. The subprogram is expected to write to the parameter. After writing to the parameter, the subprogram can read back what it has written. On exit the actual parameter receives the value written to it (there are complications in this area!). The actual parameter must be a variable.

>An in out parameter is like an out parameter except that the previous value is of interest and can be read by the subprogram before assignment.
>>
>>55559847
>Instead there is a subdeclaration of "record" which is easy to miss - and why doesn't "record" need a "type" statement like "Vector" and "Stack"? Looks pretty inconsistent to me.
Ada is a free-form language.

type Vector is array ...

type Stack is record ...

How is that inconsistent?
>>
>>55559847
>I'd like to like it. But "How can other languages hope to compete?" are big words for a langauge that difficult to read.
I'm >>55557704 and >>55554873 but not OP. The OP Post is silly.

>A "push" operation should recieve the and the value and then add the value to the stack. I have no clue what you mean with this in/out..
You can declare parameters as 'in' (read-only), 'out' (write-only) or 'in out' (read-write).
So yeah, it should/could be an out parameter. The declaration in the OP is too liberal.

>Looks pretty inconsistent to me.
It's not. ; Still delimits declarations. Inside the record it delimits member declarations.
Inside a parameter list it delimits parameter declarations.
Also this >>55561030.

>Of course you can explain that, but it's a lot of "WTF?"' I had at first sight.
It literally says
type Stack ... is record
... members ...
end record;

Ok, I get that it can be confusing that a type has an "parameter" like that.
That type parameter is called a discriminant and is actually a member of that type.
It's singled out syntactically like that for a good reason, but I don't want to go into that.

>Still a placeholder could be more intuitive with something like "_" or "." or a simple "default"..
Apart from the 'default' proposal I don't see why _ or . are any better.
It's just as cryptic.
Also picking 'default' as a keyword seems like a bad idea.

>The example in the OP is pretty hard to read, the keywords that are not simiar to any other language I've heard from.
Have you ever heard of Pascal?
>>
>>55559847
>Java, C, Python, Ruby.. Even Clojure, Perl or Haskell
Ada is older than any of those (yes even C if look at standards).
So of course it's looking different.

Complaining that it's shit because it has a different style of syntax is Like complaining about parentheses in Lisp.

Btw. If you haven't taken the time to learn Haskell, you may think you can read it, but you really can't.
>>
>>55549951
wait, is subtype a set of answers where the given equation is true? for those elements

if so, then the implications are that it must compare all values in the set against the given one, and then return a bool
this seems...inefficient, yes?
>>
>>55556982
t. tranny poster
>>
>>55533426
what does it do?
>>
>>55562711
No.
 subtype Fizz_Buzz is Integer with
Dynamic_Predicate=>Fizz_Buzz mod 15 = 0;

Fizz_Buzz has the same representation as Integer (Fizz_Buzz is Integer) and is compatible to integer (subtype).
Where "being compatable" means you can assign Fizz_Buzz to Integer and vice versa.

...
is
X : Fizz_Buzz := 30;
Y : Integer := 12;
begin
Y := X; -- no error, because of subtype
-- if you replace subtype with type in the declaration
-- the above statement would be illegal, you'd need an explicit conversion
end;


The 'with Dynamic_Predicate => ...' part where ... is a boolean valued expression, means that
every time you write/init a Fizz_Buzz value ... is checked. If it's False -> exception.
'if X in FIzz_Buzz' checks the ... condition for X.
So it's equivalent to 'if X mod 15 = 0'.
>>
>>55563005
I see, it was confusing because it said "if X in Fizzbuzz", implying that Fizzbuzz is an array
>>
>>55563175
The 'in' keyword is not for checking if items are in an array.
Originally it was for checking if X is in a statically known set of values.
Like
if X in 1 | 2 | 5 |7 then ...

The key restriction here is that this list has to be known at compile time.
It's equivalent to
if X = 1 or X =2 or X = 5 ...

In Ada2012 they extended the meaning to include checking predicates of types.

You can even use that construct in switch statements, which is the more common usage.
>>
>>55563175
Ada is very mathematical in this sense. Fizz_Buzz is a subset of the Integer set that consists of all Integers divisible by 15.
>>
>>55553356
Why did you decide you prefer PHP over Perl? To me, Perl is pretty much the ultimate scripting language, and I would default to it for most any general-purpose task.
>>
>>55563299
so then what could I do with such subtype
could I enumerate it, for example

also, Is it possible to borrow from more than one superset (they don't necessarily have the same properties)

tell me about its typing system

I'm considering learning Ada btw
>>
>>55563628
>could I enumerate it, for example
No.

>so then what could I do with such subtype
You refine the base type (here Integer).
And postulate that any Fizz_Buzz shall be divisible by 15.
The compiler does automatic checks that guarantee that you do not break that postulation.

The standard library defines a subtype of Integer named Positive, which can only contain values >1.
The advantage of using Positive over Integer is that you are more precise in what your procedure expects.
Violating that assumption fails fast rather than the code doing stupid things.
You can also use a subtype without constraint to rename types.

>also, Is it possible to borrow from more than one superset (they don't necessarily have the same properties)
You could do
subtype Buzz is Integer with
Dynamic_Predicate=> Buzz mod 5 = 0;

subtype Fizz is Integer with
Dynamic_Predicate=> Fizz mod 3 = 0;

subtype Fizz_Buzz is Integer with
Dynamic_Predicate => Fizz_Buzz in Fizz and Fizz_Buzz in Buzz;

You can put an arbitrary boolean valued expression in a Dynamic_Predicate.
Ada does have OOP inheritance, which you can use borrow operation from another type.

>tell me about its typing system
I'd love too. But it's quite late here.
I can write up something tomorrow.
>>
>>55563628
Here's an enumeration example
subtype Capital_Letter is Character range 'A' .. 'Z';
subtype Lower_Letter is Character range 'a' .. 'z';

subtype Letter is Character with
Static_Predicate=>Letter in Capital_Letter or Letter in Lower_Letter;
>>
>>55563814
>>55563843
I see, I'll check this threat tomorrow, I have to sleep too.
I have more questions.
>>
is your array sorted my friend?
Function Is_Sorted  (A: in out Arr) return Boolean is 
(for all I in A'First..A'Last-1 => A(I) <= A(I+1));
Thread replies: 180
Thread images: 5

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.