What theoretical and/or experimental programming-language features are there?
I'm designing a programming language, purely for fun, and wa开发者_运维问答nt to add as many experimental features as I can, just to make programming in it something completely different, and that not in a bad way like Brainf*ck or Malbolge.
However, I seem to be quite bad at coming up with new things for it but I'm sure that there are tons of things out there that have been talked about but never really tried out.
- What experimental language features or concepts not implemented in mainstream languages are there at the moment?
E.g: If I asked this in, let's say, 1960, an answer could be "Object-oriented programming".
I'm sure that there are a lot of unimplemented ideas computer-scientists have (recently) come up with, at least I was told so.
One current area of research are dependent types. There's still a lot of things you can do with those, that hasn't been done yet.
DWIMNWIS (Do What I Mean, Not What I say).
More seriously, an absolutely great feature (that'd be very-hard-to-impossible to implement) would be the ability for a language's program to be provable not to contain concurrency issues.
As far as MUST-HAVE features I'd say lambdas and First-class functions. Not exactly new or theoretical (how old is Lisp this year) but powerful and missing from many languages.
non-sequentially (an idea coming from dataflow programming), such that expressions are evaluated when their dependencies are fulfilled. So that:
print(msg)
msg = "Hello World"
is a valid program. All variables would be akin to cells in a spreadsheet.
print i
range(1..100) => i
# prints 1 to 100
It would be interesting to study the implications of the change propagations property of such paradigm. However its a heavy challenge to design such language, it starts to become messy when thinking about conditionals, iteration, etc and the synchronization issues that may appear.
read ACM and IEEE publications for research ideas
Here's an idea; and if anyone writes it they must give me copyright credit! Automatic built in arbitrary matrix templates such that these matrices are not the mathematical types but more of a storage or structure type. Depending on the template parameters these matrices can be as simple as a scalar value to as complex as a near infinite dimensional entity in theory if the computer could permit it without running out of memory but in practice this would be limited to the architecture, OS and compilers intrinsic details of the size of their integer or integral type. So one can have a low dimensional volumetric matrix that is 3 Dimensions yet run out of memory because it might look like this: Matrix<type, 1000000000,1000000000,1000000000> matOutOfBounds
before a much higher dimensional matrix such as Matrix<type, 2,2,2,2,2,2,2,2>
that is an 8D volumetric matrix would. Simplification can be done if they are "perfect matrices". That is where every dimension has the same exact amount of elements regardless of how many dimensions they have. For example: <3,3>
<3,3,3>
<3,3,3,3>
are all perfect matrices. Simplification would be Matrix<type, 4^4>
same as Matrix<type, 4,4,4,4>
giving a 4x4x4x4 4D Volumetric Matrix with
96 elements in a 4D structure. Where `Matrix would be 3D Volumetric Matrix with many elements but has a 3D Volumetric structure as our current clocks and compasses operate at such that 360 degrees to full circle, 60 minutes, 60 seconds, except there are that many storage elements of floats.
This below will currently look like a possible C++ library that someone would include in their projects; but the idea here is making it a built in language type. Then any one with your language and compiler can use these at will. They can use these with any number of dimensions such as what this template portrays:
// Header Declaration
template<typename ClassType, unsigned int...>
matrix{
}; // No need to show body just declaration for concept
// User Code Would Be
matrix<float,2,3,4,5,7> mat; // This would create a 2x3x4x5x7 matrix that is a 5th dimensional volumetric matrix
// Default type
matrix<int> mat2; // This creates a 1x1 matrix that would in essence be a scalar.
Now what I've shown is current c++ syntax for variadic templates. The idea here would be that these kind of matrix containers would be built in types!
Want to make them mathematic? Sure that's fine but the user would have to define their own "algorithms, methods, functions, or routines" to do so.
The reason they would have to be defined independently is do to this reason:
mat<float, 3,3,3> mat1; 3x3x3 3D Volumetric Matrix - 27 elements
mat<float, 5,5> mat2; 5x5 2D Linear-Quadratic (Area) Matrix - 25 elements
mat<int, 6,7,8> mat3; 6x7x8 3D Volumetric Matrix - 336 elements
mat<bool, 8> mat4; 1x8 1D Linear Matrix (Array); transpose?
mat4::transpose; // built in - now 8x1 matrix
mat4::transpose; // back to 1x8.
class TheMotherLoad {// Many members and methods };
// ...
mat<TheMotherLoad*, 9,9,9,9,9,9,9,9,9> mat9;
// simplified version
mat<TheMotherLoad*, 9^9> mat9
// A 9 Dimensional Volumetric container So the first the would be a Cube
// with its sides having a length of 9 cells where the Volume 9^3 is the
// First Order of what a Volumetric Matrix is.
// Anything less is linear or quadratic either it being a scalar,
// translation, an array, a line, a point, a vector, rotation, quadratic and area )
// Now that we have a cube that has 729 elements and the next
// three 9s which are the 4th, 5th & 6th dimensions would act as another
// 9x9x9 matrix surrounding the first 3 dimensions respectively.
// Finally the 7th, 8th & 9th dimensions defines the "outer matrix"
// that also has "9x9x9" elements. So in total the number of elements
// in this matrix would be 729^3 and for every
Due to the properties of how matrices are is what determines what the type of math operations that can be done to them so this has to be externally done.
精彩评论