Comments (9)
I think if you're wanting a more C/C++ feel to the language, I think staying with alias
or the more Swift-esque syntax typealias
should be used.
As for using the alias <type> as <alias name>
, for me anyway typing any more words than needed to me seems a waste of your file cough Visual Basic cough. So if I was doing this I'd do what C/C++ does!
typedef old_type newType;
But yours could be:
alias [i8] Integer8Array
from arua-meta.
Good point about Visual Basic. However, when thinking about typedef
readability in C++, these kinds of typedefs come to mind:
typedef __detail::_Adaptor<_Engine, _Dist> engine_value_type;
typedef __detail::_Hash_node<_Value, __cache_hash_code> _Node;
typedef integral_constant<bool, __stored_locally> _Local_storage;
Obviously some of the above are due to underscores in identifiers, which (as of now) Arua will not allow. The underscores are used as internal identifiers, which should be properly zoned away as to not allow public access anyway.
So as an experiment, let's remove the underscores and use as
, use .
instead of ::
, and properly capitalize things:
alias Detail.Adaptor<Engine, Dist> as EngineValueType
alias Detail.HashNode<Value, CacheHashCode> as Node
alias IntegralConstant<bool, StoredLocally> as LocalStorage
and without as
:
alias Detail.Adaptor<Engine, Dist> EngineValueType
alias Detail.HashNode<Value, CacheHashCode> Node
alias IntegralConstant<bool, StoredLocally> LocalStorage
The common theme with as
is that it performs a conversion operation, including pattern matching. This would be no exception - that's the intent of the word as
.
In my personal opinion, the former example is more readable than the latter. With readability in mind, I think it's a fair tradeoff.
from arua-meta.
Ah okay, well if you're going for a more convertible language this would be the most viable option.
As for pattern matching this would most likely be faster for this language, that is true.
P.S, in that example of using alias with "as", I notice the CPP template syntax. Will Aura have templates? Obviously I understand it would be in a later update but, is it a possibility?
from arua-meta.
@polyg0n I'm pretty sure I want them. I want to make sure they mesh well with the trait-based design. If they are incorporated, they will semantically resemble Java's generics more than C++'s templates, but I'm sure underlying implementation will be more similar to templates than generics. I haven't given them a ton of thought yet.
Per-type generics are almost strictly an inheritance thing. I could easily see per-function generics, though.
from arua-meta.
@Qix-, honestly per function generics would be beautiful. I've used C++ templates and Java generics both of which are powerful and great. But per-function generics would be awesome.
from arua-meta.
The top-most post has been updated to reflect the current state of the RFC.
from arua-meta.
typedef
-> type
. Seems much cleaner and drives home that it's an actual new type (unlike C++ treating it more like an alias).
from arua-meta.
@Qix- So you're going for more a TypeScript style of type aliasing?[ as far as syntax goes ] but you're creating an new physical type [ as far as what the compiler sees ]
TypeScript -
type someType = string
Possible Arua implementation -
type someType as u32
from arua-meta.
Precisely, though backwards. as
' pattern of thought is something should be known as....
from arua-meta.
Related Issues (20)
- RFC: Arrays HOT 3
- RFC: Unicode Support HOT 6
- RFC: Primitive Types and Type Qualifiers HOT 1
- RFC: Comments, Docs and Headers HOT 4
- RFC: Numeric Literals HOT 5
- RFC: Method Forwarding HOT 6
- RFC: StdLib: std.math (Math library) HOT 3
- Syntax is Style philosophy? HOT 5
- RFC: Custom operators HOT 8
- RFC: Visibility HOT 5
- RFC: Terminology
- RFC: Namespacing (Zones) HOT 1
- RFC: Compiler Details
- RFC: ABI
- Verbosity of `this` HOT 5
- Out of box compatibility with JVM HOT 2
- RFC: Pluggable Semantics HOT 2
- RFC: Enumerations
- RFC: Traits vs. Composition + Forwarding
- RFC: Tuples HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arua-meta.