Author Topic: bosque - new experimental microcuck programming language  (Read 1246 times)

https://github.com/Microsoft/BosqueLanguage/blob/master/docs/language/overview.md

features: immutable values. unlike in c#, var is used to declare all number variables, atleast - and there are no side effects at all to this apparently, since literally everything is a const so issues are always verifiable

blocks. like in C# and java

and a whole lot of other nerd stuff which really only matters if you're one of those people who disliked C# and Java but like having to go to stackoverflow on nearly unknown languages which are not verbose and thus unreadable by new programmers

Code: [Select]
entity Baz { // What the forget is an entity? It's an object. Thanks, microsoft
    field f: Int;
    field g: Int;
    field k: Bool
} // Instead of making fields right next to the object, you have to do this now because everything is const. Thanks microsoft

var e = Baz@{ f=1, g=2, k=true };
// Below is a list of infuriating and computerishly non-verbose syntax detailing why you should use this language:
e.f         //1
e?.f        //1
e.h         //none
e@{g}       //@{g=2}
e@{g, k}    //@{g=2, k=true}
e@{h, g}    //@{h=none, g=2}
e.h.f       //error
e.h@{f}     //also error
e.h?@{f, g} //none
Code: [Select]
var e = Baz@{ f=1, g=2, k=true };
e#Bar       //@{f=1}
e#{f: Bool} //error type projection requires same kinds
e#T3         //error type mismatch
What's the issue here? who the hell knows! Thanks microsoft for this wonderful language

Quote
The Bosque programming language is a Microsoft Research project that is investigating language designs for writing code that is simple, obvious, and easy to reason about for both humans and machines.
Bro. I've showed this to some professional loving programmers in C# and Java and they had to ask me what some of this meant. This isn't verbose, at all. I can look at e#bar, notice @{f=1} and i'm completely in the loving dark. In C#, this would have been completely readable. I could have read it without even knowing what it means and still get a basic idea of what it does. I can go to C, read some obfuscated stuff and get atleast an IDEA of what it does. This bullstuff comes obfuscated before you even compile it.
I can actually read the syntax file better than this.
/discuss

im not a 2 billion iq code guy but i can tell this is stuff already

I barely know code and can clearly tell its a stuff language


looks like they're trying to go more for a math styled notation?
and defining objects is actually a list, lol

looks like they're trying to go more for a math styled notation?
If they're going for algebra pseudocode they failed at the first step

and defining objects is actually a list, lol
keep in mind that literally everything is a const if you declare it to be something. you can't start at 100 and do int--; like you could in C# or something

is this the first accidental esoteric language?

interesting how you can't change values in an object
but you should be able to do most looping things still with recursion

how much faster is it compared to C#? also the syntax doesn't look too bad. im looking through a lot of the code on the github page and its incredibly straightforward and readable. i have no clue what the stuff in the op is but that looks intentionally hard to read

they really love foobar placeholders which is a little annoying. like i'd prefer entity EntityExample over entity Fizz for readability sake

Code: [Select]
concept BaseConcept {
    field f: Int;
}

entity TestEntity provides BaseConcept {
    field i: Int;
    field b: Bool = true;
}

var y = TestEntity@{f=1, i=2, b=false};
var x = TestEntity@{f=1, i=2};
Code: [Select]
public class BaseClass {
      protected int f;
}

public class SubClass : BaseClass {
      protected int i;
      protected bool b = true;

      public SubClass(int _f, int _i, bool _b) {
             this.f = _f;
             this.i = _i;
             this.b = _b;
      }

      public SubClass(int _f, int _i) {
             this.f = _f;
             this.i = _i;
      }
}

//Somewhere else
var subClassObject1 = new SubClass(1,2,false);
var subClassObject2 = new SubClass(1,2);
these are basically the same codes except bosque used less lines because it's not as explicitly typed as C#

Quote
// Instead of making fields right next to the object, you have to do this now because everything is const. Thanks microsoft
i dont know what this even means lol. in every language when you create a class you define the fields inside the class. entities are just classes. the way you construct them is almost identical to every other language too.



https://github.com/Microsoft/BosqueLanguage/blob/master/docs/tictactoe.md

this is a good example of a larger, well written piece of bosque code that shows how it functions syntactically. Since its goal is to be low-complexity its basically a loosely typed microsoft torquescript. it has almost the exact amount of functionality save any sort of reflection. I don't see why there's so much hate for it? personally i prefer C# for its strongly typed syntax but i know that on large projects the only way to stop yourself from being crippled by type mismatches and polymorphic errors is writing airtight code yourself. in bosque the fact that things are immutable but still have functions to check type mismatches is pretty handy. if i was writing a small widget or program to interface into a larger system i'd use something like bosque or lua

they also use almost exclusively lambda expressions in the place of loops which is pretty neat. i remember i had a project where i needed so much control over enumerables i just ditched for loops in general and resorted to lambda expressions everywhere. at that point you really see that there's absolutely no reason why loops should exist at the higher level when you have more control with lambda expressions
« Last Edit: April 20, 2019, 07:32:23 AM by PhantOS »

why do you keep comparing it with c#? this isn't at all trying to be a successor to c# so i don't see how that's a fair comparison
« Last Edit: April 20, 2019, 07:38:03 AM by EcstaticEggplant »

why do you keep comparing it with c#? this isn't at all trying to be a successor to c# so i don't see how that's a fair comparison
C# is the microsoft standard programming language and (biased imo) the best object oriented programming language in existence. It's true that bosque is just a research project under microsoft's name but its definitely worth comparing to C#. in some ways its better and in other ways its worse, and that's important to understand.

you could compare bosque to C# as easily as you could compare it to lua or python or javascript. its syntactically similar to the latter ones but the goal of bosque is to achieve loosely typed object oriented programming, so it wants to be C# but with syntax and data structures like javascript
« Last Edit: April 20, 2019, 07:48:52 AM by PhantOS »

Replying to Phanto, most of the stuff in OP is taken straight from the document where the different features are shown off. And by "fields next to the object" I meant something akin to
Code: [Select]
Public Burger (bool Lettuce, int Pickles, double Patties, bool Vegan) where this could be called anywhere and just be like
Code: [Select]
Burger(True, 99, 5.6, False); and that call is infinitely simple to type and is straightforward.

In bosque, there is nothing like this for speed and efficiency, atleast yet. You have to create the class, list them under the class and i'm not even sure you can call classes later yet. The VSC syntax for it doesn't tell me I can.

Also, I wanted to mention this is a mostly done Work in Progress that is very newly released, so my stance may change as this project goes on

Replying to Phanto, most of the stuff in OP is taken straight from the document where the different features are shown off. And by "fields next to the object" I meant something akin to
Code: [Select]
Public Burger (bool Lettuce, int Pickles, double Patties, bool Vegan) where this could be called anywhere and just be like
Code: [Select]
Burger(True, 99, 5.6, False);
var burgerObject = Burger@{lettuce = true, pickles = 99, patties = 5.6, vegan=false};
bosque has constructors too. i guess you missed it?

Code: [Select]
// Instead of making fields right next to the object, you have to do this now because everything is const. Thanks microsoft

var e = Baz@{ f=1, g=2, k=true };
« Last Edit: April 20, 2019, 09:42:07 AM by PhantOS »

Nvm im probably handicapped and skipped over that part of the featurelist

const isnt always a good idea considering you might want to make something that modifies an object in place, otherwise you could get some major object thrashing? or am i misunderstanding what const means