Git Product home page Git Product logo

Comments (9)

corbin-r avatar corbin-r commented on June 11, 2024

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.

Qix- avatar Qix- commented on June 11, 2024

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.

corbin-r avatar corbin-r commented on June 11, 2024

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.

Qix- avatar Qix- commented on June 11, 2024

@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.

corbin-r avatar corbin-r commented on June 11, 2024

@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.

Qix- avatar Qix- commented on June 11, 2024

The top-most post has been updated to reflect the current state of the RFC.

from arua-meta.

Qix- avatar Qix- commented on June 11, 2024

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.

corbin-r avatar corbin-r commented on June 11, 2024

@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.

Qix- avatar Qix- commented on June 11, 2024

Precisely, though backwards. as' pattern of thought is something should be known as....

from arua-meta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.