Just how would certainly you make a shows language?

If you were to make a shows language, just how would certainly you do it? What attributes would certainly you place in? What would certainly you omit? Statically or dynamically keyed in? Highly or weakly keyed in? Assembled or analyzed? Warrant your solutions.

2019-05-04 08:21:58
Source Share
Answers: 8

Bearing in mind that the only languages I recognize are PHP and also javascript, which I actually need to find out a couple of even more prior to making a language :

Syntax : Think meticulously concerning function names and also argument order (i.e., be much less unpleasant than PHP).

Attributes : Have a set of string features, which operate variables as a collection of bytes, yet do not recognize message, and also a set of text features, which recognize great deals of encodings and also can operate UTF - 8 and also various other multibyte strings. (And have inscribing peace of mind checks constructed right into the language, with a function like text.isValidEncoding(text, encoding) which will certainly inform you if a byte series is misshapen and also harmful to deal with as message.

I assume I like the suggestion of solid fixed keying, yet I've never ever utilized it, so I can not actually claim.

2019-12-01 19:03:16

Well below is a checklist of attributes I would certainly place in:

Lisp like syntax

Lisp design

Pros :

  • Easily extendable syntax. Ever before attempted to implement a foreach loop in C? It is not specifically very easy. (Mind you, I have done it).
  • Homoiconicity. You can merely (eval "your data files")

Cons :

  • Nested gloss symbols is usually tough to read

Functional Programming

Haskell design

Pros :

  • Easy concurrency, all code is string secure.

Disadvantages :

  • Difficult to implement negative effects in pure useful code, though monads appear to do an excellent work.

Solid vibrant keying

Python design

Pros :

  • Dynamic keying cleans legible code, Solid keying can remove type mistakes

Implementation :

Allow function straining based upon kinds, comparable to CL is defgeneric:

(define (+ (a <int>) (b <int>))
  (ints-add a b))

(define (+ (a <string>) (b <string>))
  (string-concat a b))

(define (+ a b)
  (add-generic a b))

Compilable and also Interpretable

Pros :

  • Performance enhance if assembled (generally real, not constantly)

Cons :

  • Can restrict attributes in the language, llvm would certainly be an excellent backed however.

Equipment shows

C design

Pros :

  • Appeals to a, really a little, bigger series of customers.
  • Easier for applications, bit and also tool vehicle drivers to connect if they are all created in the very same language

Cons :

  • Limits the abstractions in the language, vibrant keying is usually not ideal.

Sanitary macros (CL design and also Scheme design)

Pros :

  • Easy to expand the language, specifically with Lispy syntax
  • I've claimed this in the past, have not I?

Disadvantages :

  • Not several if performed with Lispy syntax

Come to consider it, this essentially specifies system, with the exception of the collection and also systems setting little bit. That can be functioned about by utilizing libguile and also creating those little bits in C.

2019-06-01 03:30:22

Compiler tips

I'm talkin out of me bottom given that I do not recognize that much concerning language design, yet I assume the attribute I'm speaking about is called tips in various other languages. Compiler tips , possibly?

I do not recognize if I read this in a Perl6 draft or was simply high at the time, yet I visualize a language where every little thing by default is loosy goosy and also automagical. Yet if you intended to actually crank out efficiency and also claim, hey, this value is constantly an integer or it is never ever null, or this can be identical, or this is stateless, points like that ... That the compiler can instantly go to community on these especially significant locations.

E: I would certainly value remarks clarifying what I'm requesting for or pointing out instances where this currently exists.

2019-05-30 05:30:47

To attempt originalities:

I would certainly make a vibrant - keyed in useful shows language, it permits you to do all the declaration expression methods and also the most basic lambda syntax with pattern matching. Off - side regulation made it possible for.

// a view pattern (or Active Pattern in F#)
default = \def val: !!val.Type val def

// usage of the pattern
greet = \name<(default "world") `and` hasType Str>:
  p "Hello, \{name}!"

(p "Enter your name", .input).greet // (, ) is a sequence expression, returning the last value

Here is a description:

default = establishes the storage space, \def val starts a curried function with 2 debates, val.Type is like Type[val], !! converts to boolean, and also boolean can be used, so val and also def are after it.

f x = f[x] = x.f .f = f[]

and also in greet, it made use of name<(default "world")andhasType Str>, it suggests the pattern default "world" will certainly be made use of and also bound to name. The default pattern defines a default value. and is an additional pattern that chains 2 patterns with each other. the default pattern can not fall short while hasType can fall short. Because instance, it tosses an exemption.

Variables are in fact storage spaces, which can be functionally passed, and also storage space tables can be referrals, developed and also damaged as extents transform.

Hashes and also such will certainly resemble in Lua and also JavaScript's.

If I'm mosting likely to make an assembled language, I'm mosting likely to make an F# for Java, with Haskell - like features. It is a pure useful language, other than there is an attribute that blends Quotations and also Comp Exprs with each other to attain critical shows by creating pseudocode - like blocks.

2019-05-19 08:39:44
  • I most definitely assume that useful shows languages will certainly capture on, so my language will certainly be useful. See Taming Effects with Functional Programming

  • I assume the CPUs quickly will certainly have hundreads of cores, and also strings will certainly he a heck to take care of. So the Actor Model is a have to as opposed to strings. See Erlang - software for a concurrent world

  • I additionally assume that OOP has actually fallen short, the interaction in between things was thought to be asynchronous . So I assume we require message passing away , with unalterable messages. Send and also Forget. As in the Actor version. See Object Oriented Programming: The Wrong Path?

  • I assume that it would certainly be excellent to have fixed keying , so mistakes are captured previously in the growth cycle. Yet I would certainly make use of type reasoning as in Haskell, to make sure that the programmer do not require to write the type almost everywhere in the code as in C, C# and also Java. See Learn You A Haskell for Great Good

  • I would certainly additionally make a wonderful UI library , with declarative format , as in WPF and also Android. Yet I would love to have it as in Functional Reactive Programming.

So my language would certainly resemble the concurrency in Erlang yet with the keying as in Haskell and also a GUI structure as in WPF.NET.

2019-05-09 00:55:44

Note : I've made use of C - like syntax to define attributes in this blog post, yet I'm not fussy concerning the syntax itself as long as it's not something ludicrous like all search phrases being CAPS.

1. Keying in system

The leading attribute that I would certainly desire in a language is fixed keying with optional vibrant keying. The factor is that fixed keying permits you to a) catch mistakes very early as opposed to late and also b) most code is unconditionally statically keyed in, whether the language makes the difference. Nonetheless, there are numerous usage - instances where vibrant keying is exceptionally valuable. As an example, when reviewing information from a documents, you usually have areas of differing kinds, and also vibrant keying makes heterogeneous containers very easy. So, my excellent language would certainly have something similar to this:

//variable declarations
int anInt = 42 //anInt is now irrevocably an integer and assigning another type to it is an error
vartype aVariable = 42 //aVariable is currently an integer, but any type can be assigned to it in the future

//function definitions
int countElements(Collection c)
  return c.count();

//c HAS to be a collection, since countElements doesn't make sense otherwise

void addToCollection(Collection& c, vartype v) 

//c is passed by reference here

2. Assembled vs. Interpreted

I would certainly such as the language to be either assembled beforehand, or JIT assembled, yet not totally analyzed, rate being the factor. This incorporate to aim 1 , given that an optimizing compiler/jitter will certainly have a much less complicated time optimizing statically keyed in code, and also dynamically keyed in code can merely be left as - is.

3. Closures

The language have to sustain useful shows constructs, and also features need to be first - class things.

4. Object - oriented

The language needs to permit you to write object - oriented code, yet straightforward critical code needs to be permitted also. i.e., it needs to be feasible to write a hello there globe program thus:

int main(string<> args=null)
  printf("hello, world"); 
  return 0;

// this code also demonstrates two other features,
// default arguments for functions (not explained further)
// and immutable lists like string<> (see 6. Built-in datatypes)

5. Namespaces

Namespaces are a good idea. Really little things needs to enter into the international namespace. Yet if you have to place things in the international namespace, you can (ala C+npls ).

6. Constructed - in datatypes

The language have to have, as constructed - in datatypes, the adhering to constructs:

  • An int datatype or kinds. If there is just one int type, it needs to have endless array. If there are extra, there need to be implied upcasting right into the tiniest type with the ability of holding the outcome of a calculation, with the endless array type being the biggest.
  • A solitary constructed - in binary float type, which amounts an IEEE 754 double
  • A mutable list type which is applied as either a twice as connected checklist or a block of adjoining memory holding reminders per component
  • An unalterable list type that imitates an array yet whose dimension can not be transformed after production
  • Mutable and also unalterable string kinds, with the default being unalterable.
  • A map or dict type that is mutable, and also holds unalterable keys and also mutable and/or unalterable values.
  • The constructed - in collection kinds need to be uniform keyed in by default, yet can be vartyped if called for
  • A boolean type
  • A null or none type that can be appointed to a variable of any kind of type.
  • Mutable and also unalterable set kinds
  • A decimal type which applies decimal drifting factor variables
  • A fixed type, that applies a set - factor number

The decimal, float and also fixed kinds need to share the specific very same public user interface (either using inheritance or duck keying), permitting them to be transparently passed to and also returned from features. The moms and dad type can be called real.

7. Call by value and also by reference

You need to have the ability to call features by both value and also reference, with the default being value (i.e., a duplicate of the argument is made and also run upon in the function).

8. Reminders

The language need to have reminders and also permit reminder math. Reminders can just be statically keyed in (to stay clear of the problem that is a void*). vartype reminders are clearly forbidden. Having reminders and also reminder math permits the language to be seriously made use of as a systems setting language.

9. Inline setting up

In link with 8. , The language needs to permit inline setting up language code for those scenarios where it is essential.

10. Safety and security

The language need to be primarily secure to make use of, sustaining exemption taking care of etc Pointer math and also inline setting up can be delegated to sections of the code clearly noted as harmful. Harmful code is permitted, yet highly inhibited.

11. Undefined practices

The language criterion need to define just how the program is to act under all conditions other than in code clearly significant harmful, i.e., there need to be no undefined practices beyond harmful blocks. This permits the language to be made use of as a sensible application growth language, while still permitting you to claim, write an OS in it.

That's all I can consider presently, yet I'll edit/update the blog post as I consider even more points.

2019-05-08 23:43:27

I would certainly have made it virtually like C#, yet Microsoft defeat me to it. : )

(Other than certainly that my own would certainly have been much less well analyzed and also extra amateur. )

I do not mind much whether it is assembled or analyzed, so I do not require to warrant that little bit.

As concerns to solid fixed keying, I locate it tough to value why this also calls for validation. Fixed keying is an attribute which captures pests throughout compile-time. Dynamic keying is the absence of that attribute and also postpones the pests till runtime. In my individual experience I had couple of use-cases where dynamic send off made good sense and also served, so the convolutions I needed to go via in C# prior to 4.0 to get it were conveniently warranted after that. With C# 4.0 I do not also require to warrant that any longer due to the fact that we have dynamic send off currently.

Nonetheless, I possibly would have developed a new syntax as opposed to sticking as consistently to old C syntax as C# did. The button declaration is specifically dreadful, and also I additionally do not like the actors syntax (it is the upside-down around ). I do not make a large difficulty concerning the information of syntax though, so I do not require to warrant it carefully, other than that I would not desire it as verbose as Visual Basic.

What else would certainly you like me to warrant?

2019-05-07 23:27:02

There are numerous languages around that I take into consideration rather damn excellent (C# being my existing fave ). Given that this is my dream language, below's what I actually desire it to have :

  • Kick-ass main api documents. The Java API is excellent similar to this, and also C#/. NET is respectable. Ruby/Rails is rather dreadful below.
  • Kick-ass main basic documents (how-to's, usual usages, great deals of instance code ). C#/. Net benefits this.
  • A massive area of blog-based documenters and also StackOverflow trouble solvers to aid me out of challenging places
  • A variety of well-supported, well-documented, and also effective plugins/libraries/extensions (Ruby/Rails has 'effective' yet neither of the various other 2 ).
  • Is sensibly secure- no transforming every little thing to damage most present code on a yearly basis (considering you, Ruby/Rails ).
  • Isn't also secure- has the ability to adjust to breakthroughs in language design (considering you, c++ )
2019-05-07 23:22:13