January 20, 2016 Re: Functions that return type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On Sunday, 17 January 2016 at 02:08:06 UTC, Timon Gehr wrote:
> On 01/16/2016 11:50 PM, data pulverizer wrote:
>> I guess the constraints are that of a static language.
>
> (This is not true.)
I'm playing with the design of such a language myself. Basically, anything can create/use/return type objects, but a variable of a particular type can only be instantiated using an immutable type object whose value is known at compile time.
It's not very far along, though. Right now, I have a "compiler" that parses integers and parentheses. ;)
|
January 20, 2016 Re: Functions that return type | ||||
---|---|---|---|---|
| ||||
Posted in reply to blm768 | On Wednesday, 20 January 2016 at 04:27:27 UTC, blm768 wrote:
> It's not very far along, though. Right now, I have a "compiler" that parses integers and parentheses. ;)
That's alright. Parsing and AST construction are trivial with S-expressions (Lisp-like syntax), so if you use them for the early stages of development, you can focus on the type system. When you're done with types, you can switch to making a better grammar for your language.
|
January 20, 2016 Re: Functions that return type | ||||
---|---|---|---|---|
| ||||
Posted in reply to burjui | On Wednesday, 20 January 2016 at 10:04:03 UTC, burjui wrote:
> That's alright. Parsing and AST construction are trivial with S-expressions (Lisp-like syntax), so if you use them for the early stages of development, you can focus on the type system. When you're done with types, you can switch to making a better grammar for your language.
True. I'd been playing with the idea of having multiple syntactic "front-ends" anyway (mainly for the purpose of making DSLs), so it wouldn't be too much of a stretch to use an S-expression syntax. One problem, though, is that I'd either have to extend that syntax to support some of the constructs I want (i.e array literals) or create a bunch of variadic constructor functions (which could be evaluated at compile time). Of course, S-expression syntax is kind of designed to be extensible...
That's all off-topic, though. ;)
|
January 21, 2016 Re: Functions that return type | ||||
---|---|---|---|---|
| ||||
Posted in reply to blm768 | On Wednesday, 20 January 2016 at 04:27:27 UTC, blm768 wrote:
>>> I guess the constraints are that of a static language.
>>
>> (This is not true.)
>
> I'm playing with the design of such a language myself. Basically, anything can create/use/return type objects
This is usually possible in dependently typed languages such as Idris, Agda or Coq. Check out Idris, it's rather small but very nice and interesting.
|
Copyright © 1999-2021 by the D Language Foundation