{ "date": "November 10, 2014", "text": "A language is B&D to the extent that its defenders exhibit AuthoritarianPersonality symptoms.\n\n----\nNote that this page has been the battleground for more than one WikiWarrior.\n\nAuthors of BondageAndDisciplineLanguage''''''s believe their concepts of the Higher Principles of Computer Science should apply to how you say \"Hello World\".\n\nextreme, uncontestworthy examples: Hypercard, Lotus Notes, http://www2.latech.edu/~acm/helloworld/Intercal.html C-INTERCAL (home of ComeFrom), ADA, or a functional language containing only lambdas expressed by either an apostrophe or the letter L. \n\nClarification: BondageAndDiscipline is externally imposed, even if you're the one that begged for it to happen. Some of the discussion below still assumes \"discipline\" means \"self-discipline\", which confuses things.\n\n Bondage == \"I'm not allowed to...\" (restraint of behavior)\n Discipline = \"I am forced to...\" (forced behavior)\n Self-Discipline == \"I better be careful to...\" (abandon all hope, ye who enter here)\nI'm sure many WikiZens will be able to think of languages that tie you up and beat you much worse than the ones listed below.\n\nWhat about a WikiWeightedVote? 9 = completely BnD, 0 = not BnD at all. Of course, you don't need to vote if you don't know the language in question. \n\nBallot box emptiers, please note: If you empty the ballot box, you must record both the average and the number of votes -- otherwise you will not be able to recompute a valid average when new votes come in.\n\n* [](8.1 13) AdaLanguage\n* [(10)] AtlasLanguage\n* [](3.7 10) AssemblyLanguage\n* [](5.6 25) CeePlusPlus\n* [](7.6 9) CobolLanguage\n* [](1.2 20) CommonLisp\n* [](4.6 5) DelphiLanguage\n* [](8.9 10) EiffelLanguage\n* [](.13 8) ForthLanguage \n* [](6.3 10) FortranLanguage\n* [](4.7 10) HaskellLanguage\n* [](7.1 22) JavaLanguage\n* [](6.8 5) ModulaTwo\n* [](7.4 19) PascalLanguage\n* [](2.7 16) PerlLanguage \n* [](3.0 21) PythonLanguage\n* [](1.0 14) RubyLanguage\n* [](2.2 13) SchemeLanguage\n* [](2.2 12) SmalltalkLanguage\n* [](8.6 7) StructuredQueryLanguage\n* [](6.2 12) VisualBasic\n\nI'm still wondering if it is OK to vote with negative numbers. Supposedly, the votes should be of type 'unsigned int'.\n\n''What do you mean 'unsigned int'? Didn't you say the range was 0 to 9? The proper declaration is 'type Disciplined is range 0 .. 9.' ''\n\nThen again, perhaps your favourite language doesn't have such constraining types...\n\n''I don't think it is. It defeats the purpose of a scale, and just leaves strange comparisons like the Perl vs. Scheme silliness above. So I changed them to 0's''\n\nFrom the ballots, BondageAndDisciplineLanguage seems to be strongly connected to the use of natural language keywords. Is this just a coincidence or is there more to it?\n\n''I think the Forth numbers are not so ridiculous. If you know forth then you should agree that it is 1 or 0''\n\n----\nFor comments supporting the above rankings, by language:\n\n''A lot of these don't seem like traits of bondage or discipline. For instance, how is it that having all arrays indexed from 1 is any more restrictive than having them all indexed from 0? How is it that not having a built-in threading library is any more constraining than not having a built-in quaternion library? Come on, people, not all negative traits qualify.''\n\n'''''AdaLanguage'''''\n\nis Bondage and Discipline because...\n* you must declare all variables.\n* you must manage memory like a grown-up person.\n* you must handle exceptions lest your program crash at the first violation of run-time checks.\n* you must be a Software Engineer, not just a coder, to take advantage of the many, many features.\n* you can say precisely, not vaguely, what you mean (\"unsigned int\" is vague, \"range 0 .. 9\" is precise.).\n* you can hide (encapsulate) things.\n* you cannot obfuscate your code.\n* you can write \"not overriding procedure P (T : in out Thing) is null;\"\n* you can write \"type T is abstract tagged limited null record;\"\n* you must get the order of the keywords exactly right in the above declaration.\n* all the Light & Freedom features below require you to Say What You Mean. Explicitly.\n\nis Light & Freedom because...\n* you don't have to declare your own types; make everything an Integer, Float or Boolean and you're back to C.\n* you can access the hardware directly with representation clauses.\n* you can access the hardware directly with machine code insertions.\n* you can mess up memory all you like with address arithmetic and dangling pointers.\n* corollary: you can reveal things (variables, subprograms etc.) that were previously hidden and break encapsulation.\n* Built-in multitasking (not a library).\n* Built-in generic programming.\n* Built-in object-oriented programming.\n* Operator overloading.\n* Closures.\n* Built-in framework for object serialization.\n* Built-in interfaces to other languages (see Annex C: Interfaces to Other Languages).\n* Built-in facilities for hard-real-time systems (see Annex D: Real-Time Systems).\n* Built-in framework for distributed (multi-machine) programming (see Annex E: Distributed Systems).\n* Built-in framework for mathematical computations with guarantees on precision (see Annex G: Numerics).\n* Built-in support for certification of life-critical programs (see Annex H: High integrity Systems).\n\n'''''AssemblyLanguage'''''\n\nis Discipline / Bondage because...\n* Discipline: Slip a pointer and the program crashes.\n* Discipline: very verbose.\n* Bondage: Only works for one particular CPU. (stuff written to take advantage of the Pentium probably won't work on a 486).\n\nis Light & Freedom because...\n* No type checking at compile time.\n* There's nothing the library writers / OS writers can do that you ''can't'' do. If you can dream it (and are sufficiently skilled), you can do it.\n* Macro language lets you dream up LittleLanguage''''''s. \n* You can coerce any types you want. ''...even if it's a very bad idea to do so sometimes.''\n* Any application that can be produced in any other language (speed, size, etc.) can (in theory) be done in AssemblyLanguage.\n* You can repair brain-damaged core libraries sometimes.\n\n'''''CobolLanguage'''''\n\nis Discipline / Bondage because...\n* It's easy to do those things that the language designers think you should do.\n* No user defined types or dynamic memory management (in COBOL-85).\n* \"Area A\" and \"Area B\" indentation.\n* Recursion-challenged memory model. \n\nis Light & Freedom because...\n* You can ''program in sentences and paragraphs'' -- readable by pointy-haired managers.\n* The magic \"EXEC\" command allows you to embed CICS, SQL, et al, even if most supported languages aren't much fun either.\n* The \"ALTER\" statement that allows you to write self-modifying code.\n\n'''''CommonLisp'''''\n\nis Discipline / Bondage because...\n* You need to remember all the accumulated naming inconsistencies which occur throughout the language\n* It's biased towards lists.\n* It is a Lisp-2 (Depending on context, you have to identify a function as such. Contrast with SingleNamespaceLisp.)\n\nis Light & Freedom because...\n* GarbageCollection.\n* DynamicTyping.\n* Source code and data are of the same structure, and you can define/redefine functions at run time.)\n* LispMacro''''''s.\n* You can create your own control structures, which are on equal terms with those which the language provides\n* Multi-paradigm: You can write iterative, recursive, functional, and rule based styles.\n* You can define new classes and types at run time\n* If you don't like the way the object system works, you can change it via the MetaObjectProtocol\n* Full spectrum of numeric types: integers, floats, rationals, complex numbers, BigNum''''''s.\n* It is a Lisp-2 (Depending on context, you have to identify a function as such. Contrast with SingleNamespaceLisp.) :)\n\n'''''CeePlusPlus'''''\n\nis Discipline / Bondage because...\n\n* Manual memory management.\n** Try shared_ptr, now in TR1\n* Discipline: Slip a pointer and the program crashes.\n* Discipline: Strict type checking at compile time.\n** But easily avoided with typecasts\n* Has lots of insane syntax (the (*p)++ vs *(p++) issue)\n* You can't invent your own control structures.\n* It forces you to manage all those horrible include files\n* It's not smart enough to disambiguate the same method in two separate superclasses\n* Forces you to tell it the same stuff (class layout, function prototypes) again and again.\n* Forces you to track which method calls are to be statically resolved and which are dynamically resolved, rather than handling this automatically.\n** Huh? Just type virtual, that's it.\n** That's his point: typing \"virtual\" means you have now '''specified''' that it's to be handled dynamically, not statically, and thus the choice is made manually, not automatically. (I'm unsure which favorite language of his does this automatically, but some of the ones with dynamic emphasis will optimize by choosing statically when possible.)\n** Compiler difficulties on this issue eventually come down to the problem that PointerAliasing is, in the worst case, unsolvable due to the HaltingProblem, so compilers are limited to solving it in the easier cases. This applies to Java and Smalltalk, too, but C++ pointers make this more difficult than some of the non-pointer languages.\n* Icky Static/Dynamic member interface.\n* Enforces const-ness and private/protected. (This might be a GoodThing, but it is still B&D.)\n* Sublanguages (precompiler, templates).\n* Neverending learning curve.\n\nis Light & Freedom because...\n* There's nothing the library writers / OS writers can do that you ''can't'' do. If you can dream it (and are sufficiently skilled), you can do it.\n** I can say that about any language out there. If you want it to do something you need only to be skilled enough to do it.\n* You can coerce any types you want. ''...even if it's a very bad idea to do so sometimes.''\n* Pointers allow you to use \"railroad switching\" rather than long, painful conditional structures (nested ''if'' and ''case'' cascades).\n* With templates and operator overloading you can build amazing parallel universes where C++ is clean, safe and simple.\n'''''DeeLanguage'''''\n\nis Discipline / Bondage because...\n* Contracts\n* Strict compile time type checking\n* Slip a pointer and the program crashes\n\nis Light & Freedon because...\n* Garbage Collection\n* You can escape the type system with a cast.\n* Templates and compile-time evaluation on steroids.\n\n'''''DelphiLanguage'''''\n\nis Discipline / Bondage because...\n* Very strict type checking at compile time.\n* All objects have dynamic scope, lots of try finallys required\n* no generic container classes, must create TObjectList descendents\n* Published (visible at design time) is a scope, one looser than public, should be a directive instead, so you can have something protected at run time, but visible at design time\n* Restricted to windows platform, unless you port it to Linux with KylixLanguage\n* Weird implementation of static, methods are declared \"class\", but fields are declared \"const\" \n\nis Light & Freedom because...\n* Delphi is written in Delphi, unlike say VisualBasic\n** The IDE was, but the compiler is built with C/C++. FPC is however built with FPC.\n* Good class library (compared to MFC), classes are consistent with each other\n* Fast, often instantaneous, compilation, almost as good feedback as you get with interpreted languages\n* Dynamic Arrays and open array parameters\n* You can break the strict typing with variants and interfaces if you need to\n* constructors are just like any other class method, can have multiple constructors, which can be VirtualConstructors, making class factories much easier to implement than in say CeePlusPlus\n* Properties rather than Get Set method pairs\n** Really convenient when using CodeCompletion and the property editor in the IDE\n* Meta classes, which can be virtual\n* Really nice and easy to use built-in strings, unlike CeePlusPlus.\n* If you do make a few mistakes, the compiler checks you. Humans do make mistakes. If you are a bit tired, at least your program will not compile, instead of crashing at run-time.\n\t\n'''''EiffelLanguage'''''\n\nis Discipline / Bondage because...\n* Contracts.\n* Strong typing, typed \"templates\" (i.e. classes like List[Foo])\n* General tendency towards an Ada-like syntax may betray its intent (!)\n* ObjectOrientedSoftwareConstruction (the \"why?\" book) advocates complicated language features (e.g. renaming) over simple coding conventions and patterns used in other OO languages.\n\t\t:\tIronically, of course, Eiffel proponents argue the opposite: that renaming members is simpler than the complicated aliasing and delegation other languages need, especially when it comes to solving ''accidental'' name clashes.\n* It's an explicit design goal to only provide one way to do most things.\n* You have to explicitly state which methods of a base class are redefined in a subclass in the 'inherits' clause as well as then redefining them in the body of the class.\n\nis Light & Freedom because..\n* You can learn the entire language in a couple of hours.\n* The language is \"transparent\": you never have to fight the compiler to achieve some result and are never surprised that the compiler interprets your code in a different way than you expected.\n* Multiple inheritance ''works'': you never get name clash; you don't have to worry about diamond inheritance structures, you never have to use virtual inheritance near the root of the inheritance hierarchy because of the implementation of classes further down the inheritance hierarchy.\n* Explicitly stating which methods of a base class are redefined by a derived class catches loads of stupid errors at compile time.\n* \"Anchored types\" automatically redefine methods in derived classes to use more concrete type information.\n* GarbageCollection\n\n'''''FortranLanguage'''''\n\nis Discipline / Bondage because...\n* Bondage: No dynamic memory allocation. Often, procedures take as argument \"work arrays\" to overcome this problem. Yuck!\n** ''You're thinking about Fortran77... allocatables and (almost)pointers do exist \"now\"!''\n* Discipline: Begin statement in column 7 or later and don't go beyond column 72 (in older Fortrans, anyway).\n** ''What about free-form modern compilers allow? You're always thinking about that Fortran that was one of the older computer language!''\n\nis Light & Freedom because...\n* Complex numbers are just there!\n* Matrix/vectors manipulation is very easy and so they are operations over \"arrays\" (vectors) or slices of them \n\n'''''HaskellLanguage'''''\n\nis Discipline / Bondage because...\n* Strongly, statically typed -- no way to coerce types or otherwise escape the type system\n** According to [http://cvs.haskell.org/Hugs/pages/libraries/base/System-IO-Unsafe.html], ''unsafePerformIO'' can be used to evade the type system.\n* Is biased toward lists and tuples, with generally poor support for arrays.\n* Purely functional, making some obvious optimizations impossible and some algorithms difficult to implement in the most straightforward way (for example, an in-place Quicksort).\n\nis Light & Freedom because...\n* GarbageCollection\n* LazyEvaluation.\n* TypeInference means that you don't have to explicitly state types for all functions: the compiler infers them at compile time from their definition and usage.\n* Extremely powerful generic type system, probably the best in any commonly used language.\n* Purely functional, making possible some optimizations that are not safe in languages which permit side effects.\n\n'''''JavaLanguage'''''\n\nis Discipline / Bondage because...\n* Strict type checking at compile time.\n* Strict type checking at compile time in combination with non-generic containers. ''Corrected in version 1.5.''\n* Cannot redefine a method in derived classes to return a covariant type rguments of contravariant types! ''Corrected in version 1.5.''\n* Required to declare thrown exceptions. ''And to throw declared exceptions.''\n* Fine-grained standard library that requires you to remember the location of various functions (as opposed to the handful of standard library includes in C, for example). \n* EnterpriseJavaBeans.\n* Has no native support for ZeroTurnaround\n\nis Light & Freedom because...\n* Reflection.\n* Run-time download of code.\n* Often runs on completely different CPUs without recompiling.\n* GarbageCollection.\n* You can buy support for ZeroTurnaround\n* You use frameworks like OSGi to get ZeroTurnaround\n\n'''''PascalLanguage'''''\n\nis Discipline / Bondage because...\n* '''Very''' strict compile-time type checking.\n\t\t :\t''(See Also: BrianKernighan's hilarious \"WhyPascalIsNotMyFavoriteProgrammingLanguage\". This is very outdated and untrue nowadays, though.)''\n* Arrays have a fixed size. This wart alone ensures that you end up re-implementing linked lists again and again (and of course there's no generosity [''presumably what is lacking is \"genericity\", but maybe Pascal is deficient in generosity as well...'']). ''DelphiLanguage has dynamic arrays.''\n\nis Light & Freedom because...\n* one word: TurboPascal\n* second word: DelphiLanguage\n* Heap based dynamic arrays and strings are memory managed automatically (in DelphiLanguage, anyway) - BevanArps\n\n''Interesting that all of the Light & Freedom stuff refers to Borland's bastardization of it.''\n\n'''''PerlLanguage'''''\n\nis Discipline / Bondage because...\n* Insistence on use of characters $ % @ in variable names, like simple \"first-generation\" scripting languages but like few other true high-level languages.\n* Discipline: Ever look at someone else's Perl code? ''BadCodeCanBeWrittenInAnyLanguage''\n* I/O is mostly line-oriented [''What? I do very powerful binary I/O with Perl!'']\n* no ''easy'' way to do nested lists (yes I know about references)\n\nis Light & Freedom because...\n* ThereIsMoreThanOneWayToDoIt\n\t :\t''TIMTOWTDI in the PerlLanguage sense should put it firmly under PainfulLanguage, more than BondageAndDisciplineLanguage.''\n* It'll do what you hope for and expect, with little effort.\n* 2 mins and 5 lines of Perl == 30 mins and 50 lines of C++ or other.\n* RegularExpression''''''s on steroids\n\n'''''PythonLanguage'''''\n\nis Discipline / Bondage because...\n* Everything's an object\n* SyntacticallySignificantWhitespace (You cannot be sloppy ''or creative'' with indentation, you cannot rely much on automatic reformatting, and you can't embed Python inside a template language with the {%%} escapers like all other LAMP languages use!)\n* Meager supply of familiar control structures and operators\n* Statement oriented. ''if x = foo()'' does not work because \"someone once caused a bug doing that\"\n* The standard libraries, and extensions, do not allow you to turn off the \"SamuraiPrinciple\". int('whatever') will throw an error. The programmer must always work extra to bypass these false conveniences, instead of simply chosing between statements that throw and statements that return a sentinel.\n* ''lambda''s have only one line\n* the self.language permits self.expressions self.that self.are as clear and self.readable as self.English\n\nis Light & Freedom because...\n* Emulation of any operator interaction with an object via __methods__()\n* List comprehensions, generator expressions and the lambda, the ultimate control structure.\n* Module-oriented standard library allows wholesale namespace import, selective import or encapsulation, your choice.\n* Everything's an object\n* Freedom to choose between a OOP, functional or procedural approach to you program\n* Easy to throw together programs.\n* Mostly simple and orthogonal semantics \n* Freedom from the block. (begin/end of pascal; {...} of C/C++)\n* Dynamically typed\n* Interactive usage, both as standalone and inside editors such as Emacs\n* IntroSpection\n* Predictable GarbageCollection\n* Allows to modify program behaviour at run-time (reload, exec)\n* Great implementation of namespaces (so you don't have to worry about name conflicts)\n* You can actually ''read'' someone else's code with its SyntacticallySignificantWhitespace.\n* Dangling semicolon problems eliminated (''in languages that derive their syntax from ALGOL/Simula [e.g. C, C++, Perl] a semicolon [;] terminates statements - causing hard to locate bugs if left out; in Python the statement terminator is newline - eliminating this whole class of errors'').\n\n'''''RubyLanguage'''''\n\nis Discipline / Bondage because...\n* you are never a stray introspective call away from turning that polished factory floor of perfectly tuned duck typing into a sea of bit-damaged mud.\n* Everything's an object\n\nis Light & Freedom because...\n* Everything's an object\n* Dynamically typed\n* You can ignore the fact that everything's an object if you want to.\n* If you don't like the way an object or class works, you can change it -- even standard ones\n* It has most of KeyLanguageFeature''''''s (and some more)\n* Reflection.\n* It's really easy to learn.\n* RegularExpression matching is built in.\n\n'''''SchemeLanguage'''''\n\nis Discipline / Bondage because...\n* No standard module system. Keep your NameSpace tidy!\n* R5RS standard procedures have \"unspecified\" behaviour when called with invalid arguments. So depending on the situation, you might to have to check all arguments before calling a procedure, rather than just be prepared to handle an exception.\n* R5RS macro system is more restrictive than Common Lisp's macro system.\n\nis Light & Freedom because...\n* GarbageCollection\n* DynamicTyping\n* TailCallOptimization\n* CallWithCurrentContinuation\n* R5RS macro system allows mere mortals to write correct macros\n\n'''''SmalltalkLanguage'''''\n\nis Discipline / Bondage because...\n* Single inheritance.\n* EverythingIsa''''''n object.\n* Polluted global namespace means avoiding class name collisions is YOUR job. No modules/namespaces [''As far as I know GnuSmalltalk has namespaces''].\n\nis Light & Freedom because...\n* GarbageCollection\n* DynamicTyping\n* EverythingIsa''''''n object, even integers, strings, and nil.\n* Strong development environment: Browsers. Fix DoesNotUnderstand errors in debugger while running, and continue.\n* Reflection.\n* Easy to extend, to add, e.g. MultipleInheritance.\n\n'''''StructuredQueryLanguage'''''\nis Discipline / Bondage because...\n* Everything must conform a verbose standard, which is by convention in CAPS. SELECT docu_sec FROM docu WHERE ...\n** SQL does not force you to use caps. It's just a convention. If you can suggest a better convention, please do at SqlCodingStyle.\n** What is an example of it being verbose? Sometimes it is verbose, but it depends on what you are doing and what else you use it with. \n* Its companion PL/SQL is just BrainDead.\n\n'''''VisualBasic'''''\n\nis Discipline / Bondage because...\n* You're always waiting for \"version N+1\" to give you all the features you really need.\n* Influencing a \"typical\" team of VB developers to do quality OO work can be difficult. (VbClassicLanguageIssues, WhatsMissingInVbClassic, VbTeachesBadHabits, VbIsGoodForCrapProgrammers, VbIsBadForNewbies) \n* The platform. Don't wait for VB on Linux.\n\nis Light & Freedom because...\n* 3rd party extensions.\n* Lots of skilled developers available.\n* Can throw together typical business applications (screens and database) very quickly.\n\n----\n'''Discussion'''\n\nI love the title this page,, because so many languages feel like that. But I'm going to make an outrageous claim that I'm not sure I can defend, just to see where it leads. Tell me what you think of this: ''All languages tie you up and beat you. However, if an environment suits your particular kink, then it feels good to you. You may not even notice that there's anything kinky going on. It's only someone else's kinky languages that makes you say \"do '''what?'''\"'' -- WayneConrad ('Python suits my particular kink perfectly well -- WayneWerner')\n\n''Sure. There's nothing you can think of, however bizzare (or boring) it may seem to you, that isn't someone somewhere's idea of a thrill. Or maybe not: honestly, who has ever'' enjoyed'' COBOL?''\n\nI've enjoyed COBOL. It's really a pretty cool language; I think people object to it primarily because it's not a *fun* language, like C or LISP. COBOL is designed to help you do work - not the cool kind, like writing a fantastic new utility or application that will undoubtedly make you filthy rich, but the mind-numbingly boring kind where you have to add up lots of numbers and print a report. If you're looking for a hobby, that's one thing, but some of us have had jobs where we added up lots of numbers and printed reports all day long... which is precisely when COBOL is awfully nice to have. \n\n''Building robots to do the mind-numbingly boring kind of work is the fun kind of work, at least for a while. Once building robots becomes boring, build robots that build robots.''\n\n----\nIn sufficiently reflective and dynamic languages, you can implement another language inside of the first language that can interact with the first language's objects. Like Java and JScheme or JPython. Then, you've effectively escaped the bondage like Houdini with a keyboard. -- SunirShah\n\nYou can use any TuringComplete ProgrammingLanguage to emulate any other and thus escape its bonds. I'll even go out on a limb and say that in practice you can allow the emulated language to talk to some of the underlying language's objects. So I don't think this is very interesting. WayneConrad is right; bondage is a point of view.\n\nSmalltalk is a bondage language because it tries to make everything an object. -- DaveHarris\n\n''To me Smalltalk is not bondage, since even if you can think of everything as an object, the language makes this rather natural, and if you prefer, Transcript show: 'Bye' is not an message sent to a class, it is rather Smalltalk syntax to say transcript_show('Bye') ... Indeed this can work for (almost?) every ObjectOrientedLanguage''''''s'' -- MauroPanigada\n\nThere's a difference between emulating another language and using that explicitly and using a separate language to manipulate the host language's objects. I would find it amazing to see a lambda inside ISO C++ that would close over even the primitive types seamlessly.\n\n''This would actually be quite easy to implement. The most difficult part is the unlimited extend of the lexical enclosing stack frames, for which you need GC. But since there are actually garbage collectors for C++, and since the ISO C++ standard is written in such a way that it is legal to have GC, this can be overcome.''\n\n\t :\t''If you read the comments re: GarbageCollection closely, they are related '''only''' to the heap and only to manage the heap data structure, not object management. This is because of the semantics of ''delete''. Also, you can't close around variables declared on the stack or as globals without going outside ISO C++. Remember, you have to close around the primitive declarations too, not just some fancy SmartPointer''''''''''''s.''\n\nRemember, there are different levels of emulation on a TuringMachine. In the extreme, the emulated machine is completely independent of the host. There are less extreme emulations that are integrated with the host machine. The latter here are more interesting for practical use. -- SunirShah\n\n----\n'''C++ Comments'''\n\nIt is surprising that C++ is being rated so highly. C++ is often criticized for not being truly object oriented. BjarneStroustrup is proud that it supports multiple paradigms. It seems that C++ does not insist on a certain way of programming, and should thus be rated lower for BnD. \n\n''It insists on every different supported way of programming with different nuisances.''\n\n''C++ is a very powerful language, but there are styles of programming that it doesn't support at all well. It has no LexicalClosure''''''s, no GarbageCollection, no RealMacros (though templates go some of the way), no MultipleDispatch. Almost anything '''can''' be done in C++, but often only if you don't mind it being horribly verbose and rather inefficient.''\n\nI'd say C++ is very high Discipline -- you need it or your programs crash.\nBut, in a sense, it's low Bondage -- you can do >anything you want< (if only you know how -- JeffGrigg)\n\n----\n'''A really long C++ comment'''\n\nRichard B. Johnson concluded a discussion on the Linux Kernel mailing list, about whether or not to allow C++ in the Linux Kernel, with this message. Quoted from Kernel Traffic #66 (http://kt.linuxcare.com/kernel-traffic/kt20000507_66.epl):\n\n\t :\tIt's interesting to observe the advocates of a specific computer language. Most often a discussion about a particular compiler of similar tool results from the failure of persons to understand the basic nature of any computer language. \n\n\t :\tComputers don't communicate very well, even with other computers. When humans try to communicate with them, they have to use certain tools. These tools may range from devices such as keyboards to software tools such as compilers and editors. \n\n\t :\tSince computers don't understand the human languages very well, although there is continual work in this area, humans have to learn computers' languages. Since the computers' internal languages do not interface well with human languages, we have created tools to translate. There are called assemblers, compilers, and interpreters. \n\n\t :\tEvery one of these tools, and probably those to be created in the future, pose major communications and control limitations. It becomes necessary, for programmers using these tools, to provide work-arounds for the limitations of these tools. \n\n\t :\tAn expert in a particular computer language is really an expert in the work-arounds necessary to use this language to perform useful work. An ideal computer language would do exactly what it was told simply from reading a specification. In the absence of a specification, it would ask enough questions to produce such a specification, then it would generate the code necessary to perform the specified functions. \n\n\t :\tSo a programmer becomes a captive of the tools used to communicate with the computer. With experience, the programmer starts to identify with its captors and starts to believe that the language mastered, is in fact, the only true language. Once captured, the programmer becomes an advocate. Psychology teaches the name of this effect as the \"Stockholm Syndrome\". It was first recognized during the detention of World-Games competitors in Stockholm, Sweden. This effectively creates the CodeKing pattern.\n\n\t :\tYou see this problem mostly with programmers who have mastered only one language. If you have been around computers since 4-bit nibbles on paper-tape, you have long ago abandoned the notion that there is only one true language. But the first language you truly mastered still seems to have been the best. The StockholmSyndrome affects us all to some extent. \n\n\t :\tI advise to not get trapped into the notion of the \"correct\" tool for a particular use. Just because you have become expert in C++, don't presume that it is the \"correct\" language for the kernel. \n\n\t :\tEven C has its shortcomings which have to be handled with assembly language extensions. A Master Carpenter has many tools and is expert with most of them. If you only know how to use a hammer, every problem begins to look like a nail. Stay away from that trap. It bytes (sic). \n\n''Of course, this long and mildly condescending ramble doesn't say a single word about the possible advantages or disadvantages that C++ might have for kernel programming. The bias of the author is apparent in the last paragraph: \"even C has its shortcomings\". Better than your average newsgroup flame, but only in appearance.''\n\nI don't think that bias is intended. When the author says \"even C...\", he is referring to the fact that the Linux kernel (which is the kernel being discussed) is written in C, but that even C (as the chosen language of the Linux kernel) has its issues. Were the Linux kernel coded in Eiffel, then that language would have been used in the statement, rather than C.\n\n----\nI find it deliciously amusing that Eiffel has the highest average above, because I remember reading a section in ''EiffelTheLanguage'' by Bertrand Meyer wherein he expresses shock that anyone could possibly apply the \"B&D\" label to Eiffel, when its philosophy is exactly the opposite. Boy, is it ever funny. -- GlennVanderburg\n\n(By the way, don't ever type \"Eiffel bondage domination\" into Google ...)\n\n''Maybe the idea of Eiffel is enabling the programmer to impose his own taste of bondage and dominance on the code (and indirectly on himself)''\n\n''Bertie probably wrote it after ... someone ... called Eiffel a B&D language on news:comp.object . I wonder who could have done such a thing! -- PhlIp''\n\n\"Eiffel programmers can have fun, too, thank you. Of course, someone whose idea of fun is to spend his or her nights debugging will have less of it. But then such a person wouldn't need a chastity belt anyway.\"\n-- BertrandMeyer\n\nfrom http://groups.google.com/groups?q=%22Eiffel+programmers+can+have+fun,+too,+%22&hl=en&lr=&ie=UTF-8&oe=UTF-8&simplewebscoff=1&safe=off&selm=166%40eiffel.UUCP&rnum=1\n\n----\n''Authors of BnD languages believe their concepts of the Higher Principles of Computer Science should apply to how you say \"Hello World\".''\n\nIt's not quite that, surely? Look at the high ranking languages: Pascal, Eiffel, certainly; COBOL...computer science!? Then again, Scheme is explicitly about one particular Principle of Computer Science and scores a resounding '0' (on 16 Aug '00). Smalltalk, too (currently riding low at 1+2/3) is all about a particular view of programming, but is seen as a flower-child amongst languages.\n\nWhat is it the BnD guys are looking for in a language? What are the programming equivalents of spike heels and riding crops?\n\n''PascalLanguage. You can't just jump to a label, you have to \"declare\" it first. This is not because the parser can't just find the labels, it's because \"goto is bad\". >ptch!<''\n\nIs it though? Pascal ''has'' a goto, Wirth can't have thought it was so evil. A lot of Pascal's oddities come from the original performance/space constraints on the compiler: it had to parse a source file in one pass. Hence Pascal programs tend to look upside down and inside out.\n\n''A lot of this is taste. For me, it comes down to this: when programming in a language, how constrained do I feel?''\n\nActually, it ''is'' because the parser can't just find the labels. NiklausWirth's Pascal was designed so that it can be compiled in one pass, with one-symbol lookahead, with immediate notification of compile errors. This makes it an ideal language for a recursive descent compiler, and in fact one of Wirth's books (Data Structures + Algorithms = Program, I think...) features a recursive descent compiler for a tiny Pascal. Unfortunately, if you want gotos with one pass, one-symbol lookahead and immediate error messages, you have to declare your goto labels. \n\nBy the way, the compiler in Wirth's book used ''goto''.\n\n''It's not really the parser, it's the one pass code generator. Given nested procedures, a goto statement that jumps from one nesting level to another has to unwind the stack to the target level before doing the jump. Without label declarations, you couldn't generate the stack-unwinding code in one pass.''\n\nLarryWall said \"there's more than one way to do it\". BertrandMeyer was probably thinking \"It's my way or the highway.\" ... clearly explaining modern highway congestion. \n\n----\nBondage == \"I can't...\"\nDiscipline == \"I have to...\"\n\nA translation of PythonLanguage's entry, for example, is:\n\n'''''PythonLanguage'''''\n\nis Discipline / Bondage because...\n* I have to keep careful track of whitespace because it's meaningful.\n* I have to keep track of case-sensitive variable names (and there isn't a standard of capitalization as in RubyLanguage or SmalltalkLanguage).\n* I can't use 'case', 'unless', '++'/'--', '?:' like I can in C++.\n\nTherefore, shall we agree that a language is a Bondage and Discipline Language if you find yourself saying \"can't\" or \"have to\" more often than in another language?\n\n''No, it's more like a language is a B&D language if the requirements of the language lead to a loss (rather than gain) of productivity. I doubt you'll find anyone proficient in Python that believes this to be the case with Python. -- AndyPierce'' Hey, just because some people *like* B&D, doesn't mean it isn't B&D.\n\nWell, I picked PythonLanguage because its B&D list was so short. If I'd picked C++, I'd still be copying the list. ''Under that logic, why didn't you pick CommonLisp?''\n\n----\nThe MythicalManMonth's first chapter has a nice chart with four quadrants -- the ordinary program, the program product, the program system, and the program system product. FredBrooks wrote that a program product (which is like a program but includes enough documentation that anybody can use and extend it) is three times harder to produce than an ordinary program, a program system (which, IIRC, is designed to run under tight constraints and fit in with other programs in a system) is three times harder to produce than an ordinary program, and a program system product (which has both characteristics) is nine times harder to produce than an ordinary program.\n\nNow, I think that modern BondageAndDisciplineLanguage''''''s are those that try to force you to write ''only'' program system products. I think this has become the trend in language design. What are objects if not little program system products? These languages try to force you to add all those additional characteristics, making it take much longer to write the program, but then making it fit into a system and making it possible for people to understand and modify it (think inheritance) without having to reverse-engineer the thing. At least in theory -- it's possible to flub all that extra stuff and write an ordinary program with extra garbage to shut up the compiler, but you still have to go to the extra effort of flubbing it.\n\nLanguage designers are lured into doing this because program system products are much better than ordinary hacked-together programs. But the languages they design become almost incapable of producing the old-style ordinary program. It is surprising how often an ordinary program will do -- and yet we, the people annoyed by BondageAndDisciplineLanguage''''''s, find that we cannot write ordinary programs any more; it's as if it is not allowed...\n\n-- EdwardKiser\n\n----\nFreedom in a language demands more discipline from programmers.\nDiscipline is inversely proportional to bondage.\n\n''You're confusing discipline with '''self'''-discipline. The more something disciplines you, the less self-discipline you need -- but the more bondage you are under.''\n\n''Unfortunately, no. Freedom does demand self-discipline, but too many languages require high self-discipline while giving back very little freedom.''\n\n----\nConstraints on the writer are guarantees for the readers. Freedoms for the writer are uncertainties for the readers.\n\n''Are you sure? Try comparing Ocaml code to C++ code.''\n\n----\n'''Anti-Pavlov Force Stronger than Pavlov Force'''\n\nI have a theory based on MostHolyWarsTiedToPsychology. The larger the organization, the more that preventing problems is rewarded over finding solutions. One is \"called to the floor\" more often for things that go wrong than for things that go right. A BondageAndDisciplineLanguage caters to such corporate philosophy, for good or bad. For example, the kudos for being way ahead of schedule are less than the anti-kudoes for being way behind schedule.\n\n----\nNone of these languages are very Safe, Sane or Consensual. Where are the damn Safe Words?\n\n----\nThis page appears to have been victimized to the point of lacking useful information.\n\nThe vote counts above are obviously bogus.\n\nRoughly half of the listed languages are diametric opposites of B&D.\n\nI think this page could use a good scrubbing.\n\nAs a start, the following languages are simply not B&D:\n\n* AssemblyLanguage\n* CeePlusPlus\n* CommonLisp\n* ForthLanguage\n* PerlLanguage\n* PythonLanguage\n* RubyLanguage \n* SchemeLanguage\n* SmalltalkLanguage\n\nThere may be more, those are simply the languages I'm familiar with.\n\n''Nonsense. Python requires extremely disciplined tab indentation.''\n\nMost editors can auto-indent, just like most editors can balance parentheses.\n\n''But Python is different from C-based syntax because it actually uses the indentation you give it to determine nesting. It cannot be calculated by analyzing something equivalent to curly braces. An editor cannot read minds.''\n\nAn editor follows your instructions and facilitates code composition. Without certain editor features certain languages become more difficult to compose. I wouldn't want to write SQL without a swap case command, for example. I wouldn't want to write Lisp without parenthesis matching.\n\nWriting python in an editor that cannot massively indent or unindent selected blocks of text, or that won't display whitespace, is very difficult. This should not be confused with the difficulty of writing python itself. It would make as much sense to decry case sensitivity.\n\n''I simply hate Python for that; if you lose white spaces (e.g. when posting in places that \"tend\" to eat spaces), your program won't work; it would be nice if Python's author would add a more \"visible\" way of identifying blocks of code.'' -- MauroPanigada\n\n----\nAgreed. People seem to confuse \"bondage and discipline\" with \"bad\" in a generic sense (not saying the above are good or bad)--any language that is disliked by anyone is proposed as a BDL. A true B&DL is, in my mind, one where the language forces you to jump through numerous hoops to get everything done. Of course, everything is relative (proponents of languages with dynamic typing or type inference may claim that '''any''' language which requires type annotations is a B&DL), others may disagree.\n\nSome features that a B&D language might have are:\n\n* Poor, inflexible type system--one which makes tasks that ought be trivial difficult or impossible (ie PascalLanguage), or one which requires a rats-nest of typecasts everywhere to get anything useful done (ie JavaLanguage, pre JavaFive). \n\n?\n\n----\nWell, first you write \"People seem to confuse bondage and discipline with bad in a generic sense\" and then\n\"Some features that a B&D language might have are: Poor, inflexible type system ...\".\nTo me it looks like the same confusion or inability to explain without a valuation.\n\nWell, as long as the meaning of B&D is not really explained on this page the whole discussion about the languages\nis meaningless. It's like color blinds trying to separate the world into red and green objects.\n\nAs long as you can read about a single language: \"it's light and freedom because it has pointers\" and\n\"it's bound and discipline because your program will crash if you use pointer the wrong way\", this page missed\nthe whole point.\n\n----\nI think of B&D languages as systems that impede productivity through constraints that made sense in 1960, but are less useful in a world of fast systems, large storage and memory, HPC clusters, and an ever spiraling complexity (due to disparate and changing information repositories, convergent networks, and demanding users). B&D languages don't lend themselves to a changing environment - and tend to lead to long overbudget projects when attempting to address modern problems. In this regard B&D languages are synonymous with CardWalloperLanguages. -- MalcolmCampbell\n\n----\nIf you are stuck with unmotivated, sloppy, and unskilled developers; then B&D languages prevent fools from doing too much damage. However, they also impede productivity of those who want to move forward and have a good-but-lean system. Larger businesses are risk-aversive and would rather be safe and slow than lean and fast but risky, such as depending on a select few coders. There are ways to use productive languages in such environments, but the skills and processes to manage such projects properly are harder to come by and harder to keep.\n\n[Safety can be achieved, and principles enforced, without resorting to BondageAndDiscipline. Features such as GarbageCollection, SoftwareTransactionalMemory, PersistentLanguage & language-provided serialization, TypeInference, structural typing (NominativeAndStructuralTyping) or static duck-typing, effect-typing (i.e. separating pure functions from IO procedures), ResumableException, ObjectCapabilityModel, ExplicitManagementOfImplicitContext, JustInTimeCompilation, modular solutions to the ExpressionProblem (like horizontal subclassing or open functions & datatypes), etc. don't much interfere with productivity (and often can aide it) while simultaneously increasing safety, performance, and security.] \n\n[Not everything in LanguageDesign needs be a tradeoff unless we're already working with \"ideal\" systems ('''global''' maxima and minima for certain features) - which we, quite frankly, aren't anywhere close to doing.] \n\nWell, I'm skeptical. Most systems end up with at least some organic-ness (LimpVersusDie) because otherwise all the potential contradictions in long-lost or poorly-documented business rules would end up making compile-time take forever as one plays whack-a-mole with all the reported exceptions. Your tool stack makes for a TechniqueWithManyPrerequisites such that a very-unlikely mass cultural overhaul is needed. Plus, it is poorly documented for those not familiar with your background material, and thus many will simply roll their eyes.\n\nAnd, we keep having this debate. Let's factor it out somehow to a named topic. Otherwise, it looks as if you are just trying to troll-sell your favorite tool-set by re-listing them over and over. (Some accuse me of that also, I would note. I am not outright accusing you of consciously doing that, only saying it may appear that way.) -t\n\n[How is \"some organic-ness\" a contradiction to anything I said? Many features I mentioned - JustInTimeCompilation, structural typing, TypeInference, GarbageCollection, ObjectCapabilityModel, EMIC, modular approaches to the ExpressionProblem - support a great deal of \"organic-ness\". HaskellLanguage and ObjectiveCaml and MlLanguage and MercuryLanguage - statically typed languages all - provide ReadEvalPrintLoop''''''s, powerful modularity constructs, etc. New languages push the envelope further; ScalaLanguage is a fine example that is seeing widespread use. PersistentLanguage is already seeing considerable use today, via frameworks that embed themselves into CLR or JVM. Indeed, all the features I name above are in use today if you include frameworks.] \n\n[You're an idealist, TopMind. Your \"ideal\" - your simplified world-view - is that ''everything'' involves tradeoffs, ''everything'' is relative. In your ideal world, you have no need for logic, thought, and analysis as to whether a ''particular case'' involves tradeoffs or is relative. You above imply that 'organic-ness' must be a 'tradeoff' as justification for skepticism, but your claim ''assumes'' - without the slightest bit of analysis or consideration of the features I clearly listed - that the system I described mustn't possess organic features. I find that insulting and disrespectful since it means to me that you did not bother thinking about what I wrote before you attacked.]\n\nI'm not dismissing logic, thought, and analysis; only saying they approach an asymptote such that managing trade-offs becomes a more productive use of time (investment) than trying to find the magic abstraction, tool, or formula. It can be really difficult to know up-front whether \"heavy engineering\" will result in a better result or an idealistic mess. (Related: IdealisticMessVersusLazyMess). -t\n\n----\n''What is the opposite? LoneCowboyLanguage?''\n\nThe opposite of BondageAndDiscipline is not SelfDiscipline, LoneCowboyLanguage, TimTowTdi, or DynamicTyping. The opposite of BondageAndDiscipline is FreedomAndLight ('''freedom''' ''minus'' '''eternal vigilance''') - the ability to make changes, to try new things, to play, to perform ExploratoryProgramming with the knowledge that you're not going to ''accidentally'' shoot yourself in the foot or hang yourself later, and even '''freedom''' to let others join you without fearing they're going to break things in ways you won't notice.\n\nThe ExtremeProgramming methodology uses UnitTest''''''s to achieve some of this freedom. But it may also be achieved by language analysis techniques such as typing, or by carefully designed syntax that doesn't allow certain errors to be expressed (and allows the IDE to help user catch them with syntax highlighting), or by secure language designs like object-capability that allow sandboxes to be easy to build and impervious to breach, etc. TypeInference and flexible subtyping rules go a long way - i.e. favor lattice-subtypes rather than hierarchical-subtypes. \n\nFeatures associated with freedom:\n* An incompletely specified program, i.e. where you left a function only half-written, should still parse, compile, and execute unless that function is critical to the execution. This suggests:\n** The syntax or code-layout must be designed such that syntactic errors are localized (do not corrupt the rest of the program).\n** If the language is compiled, then the compiler will either intelligently handle an incomplete function - e.g. issue a warning then transform it into a routine that simply throws an exception - or at least will notice that a particular function is unused and so drop it rather than complain about it.\n\n* Errors are noticed right away rather than lingering for a long time. This lets others play in your code and protects you from spooky action at a distance (a change here broke some code way over there) such that you can lay your superstitions and fears aside and have fun.\n** Static language analysis techniques are useful here, including typing.\n** A language-design for ZeroButtonTesting can also help here; it would be very nice if the IDE keeps you continuously informed about which edits broke which tests.\n** Beyond UnitTest''''''s, avoiding spooky action-at-a-distance concerns requires integration testing also be auotmated.\n\n* A malign program, written intentionally or otherwise, can be localized and controlled. This allows you to run other people's malign programs, and to mess up in a big way without getting feds on your trail or something similar.\n** This requires both security and ProcessAccounting/Administration features either in the language or as part of its platform (OperatingSystem/VirtualMachine/etc.)\n** ObjectCapabilityModel is a good example for security.\n\n* Information isn't lost. If you mess up, you can roll back the changes. Undo and Versioning utilities don't need to be part of the language syntax, but really should be part of the IDE. So should be automatic, distributed backups such that you have no fears that your code is going to break.\n\n* Interactive. For example, a ReadEvalPrintLoop or LiveProgramming can go a long way towards the \"play\" aspect. OpenCroquet and SqueakSmalltalk are fine examples of LiveProgramming environments for general-purpose, but many more exist (especially for music, image, and video composition). (This aspect, more than others, tends to suggest 'dynamic', but there are other strategies to achieve this feature if the IDE cooperates and just 'parts' of programs can be discarded, rebuilt, and re-inserted.)\n\n* No boiler-plate code. The need to write boiler-plate is the very essence of BondageAndDiscipline. Boiler-plate code tends to exist when the language is working with: FrameWork''''''s, PolicyInjection, DependencyInjection, ErrorHandling, etc. Keeping a language light and free requires either abstracting these TuringTarpit problems as primitive language features (e.g. throwing/catching/resuming exceptions), or supporting macros and syntactic extensions and necessary generic semantics (e.g. CallWithCurrentContinuation) such that smart programmers can hide these repeated boiler-plate patterns behind a library-exported syntax. \n\n----\n\nWhile it is undeniable that purely functional languages impose some B&D, the given example for Haskell is ridiculous: ''an in-place Quicksort''. Functional language == no variable reassignment == no in-place ''anything''.\n\n----\nSee Also: BondageAndDisciplineVersionControl, SafetyGoldPlating, StaffingEconomicsVersusTheoreticalElegance" }