Something never before (to my knowledge) seen here

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
theDevCorner
Posts: 17
Joined: July 12th, 2013, 8:46 pm

Something never before (to my knowledge) seen here

Post by theDevCorner » February 13th, 2017, 6:40 am

EDIT: I'M NOT GOOD AT SPEAKING AND I STUMBLE A LOT WHEN I TALK AS I GET NERVOUS EASILY. Bear with it, even if I make absolutely no sense when I speak. If something wasn't clear, please leave a comment asking what I meant, I'd be happy to clarify.

Greetings! I've currently spent the last week or so in my dorm in college working on a project of mine, and I'd like to share it with you before it gets too far along. It's a custom made programming language. It's currently a nameless language, and it doesn't serve much of a practical purpose yet, but it's well on its way to being something pretty cool. Just a little information about it:

1) I want the syntax for variable declaration to be a midway form between loosely typed and strongly typed. A strongly typed language being one that requires that every single variable explicitly declares its type with the declaration of the name itself, and a loosely typed language being one that doesn't require that at all. I want a syntax where all variables of a single type can go in a single container (or many containers. Multiple containers of the same type are syntactically valid, but I didn't showcase that in the video. My bad)

2) I want the structure to be similar to languages that already exist, but I want it to be more fluid and flexible. It'll support different kinds of formatting and any kind of paradigm. In other words, it's not going to look so far off from current programming languages that someone who already knows a few won't be scared away by some strange or foreign syntax.

3) I want the people's assistance with the programming language. I want feedback and I want to constantly make tweaks so that a large portion of the people believe it to be a useful and powerful tool at their disposal.

I know this is all very optimistic, but I don't back away from a challenge. As I state in the video below, I'm a freshman in college, and I've been working on this in my spare time, on top of engineering school (software engineering). I'm mostly looking to challenge myself, and I don't think that it'll go immensely far. I'm looking into compiler development and what it takes to make a flexible programming language. Call me crazy, or just ambitious, but I've got a twisted kind of interest in this sort of stuff. I look forward to the comments and criticisms.

Also, as a side note, I am looking for strong community involvement in this. I don't plan on writing the syntax of the language myself. Think of it as almost an experiment. You get the chance to design the syntax of a programming language, and whatever the community wants will happen. Theoretically, based on the "Wisdom of the crowds theory" or "Large number theory", this should, in turn, create a language with powerful and "better" syntax. Thanks to anyone who participates in my experiment/scheme!
:ugeek:

https://www.youtube.com/watch?v=DnANNtm ... e=youtu.be
Code more, work less.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Something never before (to my knowledge) seen here

Post by chili » February 16th, 2017, 3:19 am

Hey Dev, this looks crazy. I figure that a project like this will at least be a good learning experience. Not sure if you'll find anyone else here who shares your interest, but I wish you good luck man :D

If you come up with something cool I'd love to see it.
Chili

User avatar
cyboryxmen
Posts: 190
Joined: November 14th, 2014, 2:03 am

Re: Something never before (to my knowledge) seen here

Post by cyboryxmen » February 16th, 2017, 2:53 pm

If it has modules built into them, that would make me a very happy man. NO MORE HEADERS!

Built in versioning of code would really help library implementations. Actual versioning semantics would be preferable to using the macro language. You can combine that with the modules feature to create nice syntax for choosing the version of the code you want. It would certainly make refactoring a lot easier.

Concepts would be really helpful for metaprogramming purposes. It'll make debugging metaprogramming code actually possible and optimise their compilation. Plus intellisense would actually work with metaprogramming code if you give the compiler an actual idea of what the template would end up as. Template metaprogramming in C++ right now is pretty much just the macro language but with better type safety since it is based around types. The restrictions that concepts provide is what would legitimize the use of template metaprogramming in code for most people.

Better exclusive access semantics would make encapsulation much easier to follow. Right now, C++ only has friend declarations which would give out access to ALL of a class's attributes. An additional keyword like "protected" but for composite members rather than inherited classes would suffice. A class like Socket can have protected variable like "handle_" that only objects that own it can touch. That way, a Server class that owns a Socket can use the handle_ but when it gives out a reference to the socket to other classes, they can't access handle_ from that reference because they don't own the socket. The protected keyword is pretty much the only reason why I still bother to use inheritance instead of composition because it allows access to some of a class's attributes but keep others private.

Serialization semantics would be handy too. Literally every decent program is going to deal with files and C++'s lack of serialization semantics(or libraries for that matter) boggles me.
Zekilk

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Something never before (to my knowledge) seen here

Post by albinopapa » February 16th, 2017, 10:37 pm

Concepts sound a lot like the current "type traits".
Serialization semantics would be handy too. Literally every decent program is going to deal with files and C++'s lack of serialization semantics(or libraries for that matter) boggles me.
What are serialization semantics? What is wrong with the C++ file streams?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Something never before (to my knowledge) seen here

Post by chili » February 17th, 2017, 1:12 am

Concepts are probably coming the next C++ update. They will make template errors a FUCK of a lot more digestible.

I imagine he's referring to this with regards to serialization: https://msdn.microsoft.com/en-us/library/mt656716.aspx

Basically, by adding an attribute to a class serialization code can be automatically generated.
Chili

User avatar
cyboryxmen
Posts: 190
Joined: November 14th, 2014, 2:03 am

Re: Something never before (to my knowledge) seen here

Post by cyboryxmen » February 17th, 2017, 8:27 am

Oh, object reconstruction would be a nice feature too. I hate having to make a constructor only to have to make a set function that basically acts the same way as the constructor but it runs cleanup(destructor) code before initializing. Object reconstruction semantics that calls the destructor then the constructor of an object would really help get rid of that code duplication. Move semantics using a temp object kinda solves that but you incur cost from the destruction of the temp object. The Visual C++ compiler does not optimize this out as far as I've observed and it honestly shouldn't really since this is not what move semantics are made for(ownership transfer, vector reallocations, resource reusability etc. ). Objects like shared_ptr provide functions like Reset() because of that but it shouldn't be needed.

I would imagine the semantics would look like something along the lines of using braced initialization on an already created variable.

Code: Select all

std::unique_ptr<int> p { std::make_unique<int> ( 5 ) };
p { std::make_unique<int> ( 5 ) };
While we're at it, we might as well standardize the language such that you call the constructor using braced initialization instead of '=' which will be reserved for assignment and move operations.
Zekilk

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Something never before (to my knowledge) seen here

Post by albinopapa » February 17th, 2017, 10:17 am

Object reconstruction semantics that calls the destructor then the constructor of an object would really help get rid of that code duplication. Move semantics using a temp object kinda solves that but you incur cost from the destruction of the temp object.
Either way you are destructing one object before constructing a new object so I don't see why you would need a separate Set function at all.

If the destructor is empty, the compiler will optimize it away.
If you are moving a pointer, the moved pointer ( the temp ) should be nullptr and the mem won't be released
You shouldn't have to do any clean up for simple types or even structs made up of simple types.
In move semantics, the object being assigned to takes ownership of the temp object so the destructor isn't called on the temp object.

I tried this in release mode, I had a Vec3 struct object, a float and a manually allocated array of Vec3 objects. Using move semantics, the destructor never even got called for the temp object, only the object being assigned to had the destructor called when leaving scope.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Something never before (to my knowledge) seen here

Post by albinopapa » February 17th, 2017, 10:20 am

Honestly, I think the only reason for the Reset() function is more for developers who want it, not because it's needed. You can take care of deleting and overwriting members in the move/copy assignment operators.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply