5 ms·
It says you like typing BEGIN and END over and over and over ...
by WalterBright 5y ago
It says you like typing BEGIN and END over and over and over ...
- caslon 5y agoIs there a single-word descriptor for languages that depend on so much syntax just to get going? Pascal, C, ALGOL, D, etc. Verbose, maybe, but that's not as fun as some of the catchy words there are to insult languages that aren't.
- jakear 5y agoBoilermaker language. As in: you make a bunch of boilerplate. And also you get your beer but you’re liable to get a shot in the foot with it. (This is all off the top of my head)
- zelphirkalt 5y agoMaybe ad-hoc, as in "not planned ahead well at the time of designing and thus needing lots of fixes for edge cases" or perhaps inelegant as in "requiring many concepts as opposed to something like Smalltalk, which fits on a post card".
- deleted 5y ago[deleted]
- pjmlp 5y agoWhat about endless typing attributes that the language should infer for itself and instead forces everyone to write templates to work around such matters?
- deleted 5y ago[deleted]
- mikewarot 5y agoIt would be interesting if you could have a hybrid somewhere between Pascal and Python, where you could start just naming variables, and the compiler could fill the types in once the code was complete, then you could iterate and tweak. You'd end up with fast greenfield code to get your prototype working, but then could tighten it up to run faster, and clear out bad type assumptions as the discipline level goes up.
- goodpoint 5y agoYou are looking for Nim
- pjmlp 5y agoNot quite what you mean, but still, you might find interesting the talks on how to approach coding in languages like Idris, where the compiler is able to support the editor in type suggestions. https://www.youtube.com/watch?v=DRq2NgeFcO0 https://www.youtube.com/watch?v=DRq2NgeFcO0
- rz2k 5y agoSomething like OCaml?
- Zababa 5y agoTo expand a bit on the sibling post, this is basically OCaml's niche. The type inference is great, so you usually don't have to write any types (not even in functions signatures like Rust). The language has support for functional, modular, imperative and object-oriented programming. Usually you start with functional code, that's plenty fast (especially compared to Python) since it compiles to binaries, but still optimized for readability. You also have a fast bytecode compiler for a faster development loop. When needed, you can switch over to imperative code and mutable variable for performance, OO for GUI work for example, and modules when defining interfaces between parts of your program. You can also do the opposite of what you suggest: start by writing the interface file (which has the functions and types that you will expose), and then write the implementation the way you want. This allows you to cleanly separates the API from the implementation, and also gives you fast compilation times. There may be a slight difference compared to what you suggest, as everything is statically typed, but you can start a program with permissive types and gradually move on to stricted typed. For example, replace a string that can be anything with an enum (called variant types in OCaml). If you don't need the native compilation/want the C# ecosystem, F# is a close cousin. Scala is a different beast, but shares some origins. It relies more on objects.
- dmitriid 5y ago> The type inference is great, so you usually don't have to write any types Does OCaml still have the infuriating "Provided A but elsewhere wanted B" error with no indication what this elsewhere is? I was running into it surprisingly often when I last tried OCaml.
- badsectoracula 5y agoEDIT: i assume here you mean explicitly typing out type names, like in Pascal's "var name: type" or C's "type name" and not something else. I am not a fan of this because the type attributes also act as documentation for that the variables, parameters, etc are supposed to be and that clearly typed out text is much easier and faster to read than some IDE's tooltip at a mouse hover or whatever (assuming you even have that in the context you see the code - even if your primary IDE supports this, you may still need to read the code outside of the IDE and sometimes outside of the surrounding code like, e.g. reading a diff). And yes, for that reason C++'s "auto" is one of my least favorite additions to the language. Even when i have to use the language, i avoid using "auto". (if anything sometimes feel that readability benefits when having to be explicit not only about types but also the parameter names in function calls ala Smalltalk... e.g. in Pascal i sometimes wonder what that "True" or "1" really means in a call. In recent versions of Free Pascal that have added scoped enum support - like class enums in C++ - i try to use those instead of booleans as they document the API even when it is used but this is only a small case)
- pjmlp 5y agoThat was actually a kind of jab how D nowadays has a jungggle of attributes, and the workaround taken by most on the community. https://dlang.org/spec/attribute.html https://dlang.org/spec/attribute.html Most likely you are aware of this already, but even Delphi has type inference via inline variables. Personally I enjoy using type inference everywhere on my own code. At work, I take the rule of only using it when the type is clear, e.g. auto mySomething = new Something();
- badsectoracula 5y ago> That was actually a kind of jab how D nowadays has a jungggle of attributes, and the workaround taken by most on the community. Ah yeah, this is why i added that EDIT but you replied before i did :-P. I agree about that part, i remember D being a bit attribute trigger happy :-P but i guess the alternative would be to break backwards compatibility which is IMO worse. Though perhaps something similar to Free Pascal's "modeswitch" directive would help (FP devs use it to introduce new syntax without breaking backwards compatibility). > Delphi has type inference via inline variables I know it is there but i don't really like it myself for the reasons i mentioned above (also i prefer sticking all variables together even in C++, too much code is usually a sign i need to break the functions into subfunctions and Pascal allowing nested functions is a feature i use very often). It is also one of the very very few case where Free Pascal developers have explicitly decided to not implement something because they feel it doesn't fit the language :-P.
- Tozen 5y agoBut, not everybody likes the eye strain of overly symbolic almost hieroglyphics and unreadable chicken scratch code. A lot is to be said for readability and maintainability. And any repetitive words can be handled by IDEs, editors, and macros.
- wruza 5y agoYou trade questionable readability with readability window size though (also questionable).
- lmm 5y ago> And any repetitive words can be handled by IDEs, editors, and macros. An IDE or editor may be able to write code for you but it can't read or understand it for you, and that's what takes most of the time on nontrivial projects. Macros undermine your tooling and mean the reader has to learn your dialect before understanding your code - they work best when you have a few common ones that are used across every codebase and supported in your tools, but at that point you're better off having them included in the language itself.
- MarcusE1W 5y agoI always wonder how developers work where it makes a difference if I type } or END. I appreciate with regards to readability it comes a lot down to what you are used to, but I never understood the argument that you safe something by typing a bit less. From my experience the design planning and just thinking about programs takes so much more time than the typing in that I sometimes wonder if I do something wrong. What is the advantage of a less verbose language if let’s say the language capabilities are similar?
- WalterBright 5y agoI also never liked BEGIN and END and other Pascal keywords BEING in ALL CAPS. It JUST made it ANNOYING to read THE code, like BEGIN and END were the MOST IMPORTANT things in THE code.
- badsectoracula 5y agoFWIW in Lazarus i rarely type begin or end, i type b and press ctrl+j with the IDE adding "begin", "end" and placing the cursor right between them at the proper indentation. Similarly i rarely update the var section manually, i just press F9 to compile, the IDE moves the cursor right at the missing variable (the compiler is fast enough to make this almost instant), i press Ctrl+Shift+C and the IDE adds the variable. Same for the interface and implementation sections (think header and source files in C but at the same source code): i write the declaration for the classes, procedures functions, etc, press Ctrl+Shift+C and the IDE creates the bodies for their definitions automatically. Using Ctrl+Shift+Up/Down arrow i can move quickly between the declaration (in interface section) and definition (in implementation section) for each entry, allowing for quick filling in the code. There are other shortcut keys, etc in Lazarus and i never really feel like having to type boilerplate code myself - but i still get the benefit of the more readable Pascal code (i have decades of active C and Pascal experience and i always find Pascal to be the more readable of the two, especially when looking at other people's code).