Random question about languages

Started by Xaron, June 24, 2018, 19:19:35

Previous topic - Next topic

Xaron


Phil7

A space between ' and the comment value makes also sense for easier reading. An adult reader seems to recognise a word by looking only at the first letter and some other hints, so anything disturbing there could decrease the speed of perception.

Regarding 'local' I would also prefer to write only variableName:int=10 and an error message if :int is occuring in another place.
Could anyone give an example were this could lead to an ambiguity (using monkey/cerberus)?

col

https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

col

QuoteCould anyone give an example were this could lead to an ambiguity
I've used this approach with a BlitzMax style variant and it works well. I used the colon to be followed by a valid type to mean a variable declaration with an optional initialiser expression.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

Kryzon

Quote from: Derron on June 24, 2018, 22:53:48
Code (BlitzMax) Select

Type TTest
  Field x:int

  Method superduper()
    local x:int = 10
    self.x = 20
    print x + "  " + self.x
  End Method
End Type

new TTest.superduper()
To me the 'self.x' is what differentiates between the member x and the local x. So the 'local' qualifier is not needed (I know that's how BlitzMax behaves, but it's logically redundant).
self.x = member x
x = x that's not a member of the class.

In Python if you forget the 'self.' suffix you will start creating local variables, even if they have the same name as members.

Xaron

#20
Quote from: col on June 25, 2018, 16:03:35
Nice :)

Any details on features?

Hey col, the plan is as follows:

We (Mike and me) want to create a Basic Language which is easy to use like BB3D.
There will be an interpreter for debugging purposes and fast development plus easy debugging and a transpiler which translates everything to C++ for maximum performance.
There will be the possibility to use C++ together with the libs at all like Tier 2 for AGK.

For the first version we aim for Windows only which already is quite a task. It shall include steam integration and all that stuff plus 2d/3d, sound, physics and networking. If that's done, I'd love to add more targets like Mac, HTML5, Android and iOS but that's very future, so we focus on Windows first.

For the 2d/3d part we still think about what to use as backend. For know I currently check out Irrlicht + IrrlichtBAW, Ogre3d, Urho3d and bgfx. The plan is to use a modern renderer pipeline. Maybe it's an option to use SDL2 for 2d and other stuff for 3d.

At the moment I'm in the process of writing the lexer and parser (C++) and creating the interpreter for just the language itself so it's still a way to go but it's pure fun. :)

The motivation

Ok, some words about why I am (we are) doing this. I grew up with a C64 and Basic was the first language I got in contact with. Shortly after (I was 12 at that point) I started with assembly language and used it for many years, even following by different Amiga computers. I LOVED that 68000 motorola CPU, the Intel compared to that was a nightmare when it comes to assembly language. I even did the GUI stuff and all that in assembly, that was quite funny.

Then I came to PC and somehow stumbled across BlitzBasic and WOW I was in love. Used it for many years, but we all know how the story did end... :/

So I already had the plan to create something by myself a few years ago. But I never really did because there always were good alternatives. Monkey came out and I switched over there, created some ( 8 ) games using it for mobiles and was quite happy using it. Then it died... Monkey 2 came out but for me personally I never got warm with it due to the complexity. Sure, it's a nice language but using C++ day in day out for about two decades now I simply doesn't see the need for another fancy language to learn. So I went to AGK and had the same warm feeling as with BB3D in the beginning. But somehow it just doesn't feel the same. I think it has way too many commands, some things are strange done and unnecessary complex. I even tried out Unity and did a pretty successful game with it but... oh boy, I just hate that tool. So here I am. There is nothing out there atm which creates the same good warm feeling like BB3D did in the past and I want to try to revive that. :)

col

@Xaron
Sounds interesting. Happy coding ahead :)

Are you changing the original language syntax ( therefore writing a new lexer and parser ) ?
The only reason I ask is because the source is in the public domain on BRLs github and if you ARE keeping things the same then why reinvent the wheel? :P
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

Xaron

I do it from scratch, yes. Simply because I like some C++11 features.  ;D

And that makes it much easier for me to fix things when I did it myself.

BTW on topic: I would just not add the keywords goto and gosub because... well. I know, they are part of the Basic language but I don't think they are needed at all, are they?

TomToad

When I was using BlitzMax,I decided to start using Superstrict on all my programs. I was hesitant at first, because it meant losing goto and gosub. After using Superstrict for a while,I found I didn't miss those commands at all. Don't see any use for them at all in a well structured language.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Xaron

I think settings like strict or even superstrict should be enabled by default.

meems

@tomtoad my understanding is that goto and gosubs are useful when pushing algorithms to their speed limit. they are faster than function and method calls. These days for most coding, speed isn't so crucial as to prefer gosubs over functions. perhaps a compiler can intepret zero parameter functions as gosubs for a minor speed increase.

Xaron

Quote from: meems on June 26, 2018, 21:32:04
@tomtoad my understanding is that goto and gosubs are useful when pushing algorithms to their speed limit. they are faster than function and method calls. These days for most coding, speed isn't so crucial as to prefer gosubs over functions. perhaps a compiler can intepret zero parameter functions as gosubs for a minor speed increase.

That was true ages ago but nowadays it's really not an issue anymore, especially with compiler optimization levels beyond our imagination. ;)

col

#27
My personal 2 pennies...

For BASIC variants I wouldn't entertain versions of 'Strict' - it just creates headaches if you want to expand the language. I'd either have explicit type declaration of a variable, or you don't and you default 'no type declaration' as an integer.
I'd keep the language as strongly typed as possible. I think type inference is just lazy and starts heading towards hidden ambiguities that are silently resolved incorrectly.
The same with type conversion - it should be explicit for clarity: 'Numbers -> string' is ok to be implicitly converted, and 'int -> float/double', 'float/double -> int' should be ok with a warning of possible loss of data, but all other types, including 'string -> number' should be explicitly converted.

I agree with your thoughts on Goto and Gosub.
Whilst they are very powerful ( assembler doesn't have much more than these for moving around inside executable code ) they don't really belong in higher level languages anymore due to compiler optimisations.

For BB3D2 I'd...
Fix the array syntax.
Allow types to have methods for OO but have composition as opposed to inheritance - kind of how B3D is now ( except B3D doesn't support methods of course ).
Fix the Type system to work the same as BlitzMax except there would be no default base 'Object'.
Introduce 'collections' ( structured containers ) which would have a specific type for the instances it holds.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

Xaron

Thanks col, yeah inheritance is probably one of the most misused and misunderstood concepts in OO languages. It's often just evil. In our company I sometimes see hierarchies of 10 derived classes. o_O

col

Quoteperhaps a compiler can intepret zero parameter functions as gosubs for a minor speed increase.
The major compilers ( Intels icc, GNUs gcc, MSVCs cl ) are really very advanced to yesterday and all are capable of inlining functions regardless of the parameters. Release builds can also be very aggressive when it comes to optimising. Trying to debug the assembly of a release build takes more effort due to optimisations - a lot of variables/parameters can stay in registers across many function boundaries, especially if the function was inlined - code is also moved around and executed 'out of order' to how the code was originally written as long as the result is the same as if it was executed 'in order'.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."