Skip to content

Prop: Proposed Language Attributes

John Weiss edited this page May 15, 2020 · 3 revisions

Some initial proposals:

  • no "let" or "function". Everythings a function/object, and you don't have to say it. it's assumed. Just get on with the name. If it's anonymous (whole module executing straightaway).
  • isNull returns a boolean, therefor it's obvious this is a switch. We don't have to say it. No if needed. It's a boolean statement. It's obvious.
  • true and false are keywords, and will get syntax highlighting in IDE. Their purpose in this context is obvious. We don't have to say it.
  • If possible, no curlies, no parens, squares for everything. Simpler. No Shift-key.
  • Every variable in a function is automatically scoped to the function. That, scoped to it's context. You don't have to say it.
  • sName has string type base on "s" prefix. VBA has this. OR, first assignment sets type, and nevermind the prefix.
  • on instead of switch. The most oft used keywords should be short.
  • When calling a function, no parens around parameters (or optional). on isNull sName is something a smart parser/compiler can figure out. Stop making me write parser/compiler machinery. Expect the parser/compiler to figure out as much as possible, by context. BASH commands don't require parens around args. We go further, no punctuation needed for piping.
  • Elimination of almost all punctuation. That's parser/compiler machinery Stop making me write parser/compiler machinery. Expect the parser/compiler to figure out as much as possible, by context.
  • No longwinded library dot qualifiers. This is something the parser/compiler can figure out. Stop making me write parser/compiler machinery. Expect the parser/compiler to figure out as much as possible, by context. parser/compiler should search availalable libs in order of precedence. Fully-qualifying the fx can be used optionally to override default order of precedence.
  • No case keywords. Newline means next case. Make whitespace meaningful.
  • No end sub or closing curlies. Eliminate punctuation and make whitespace meaningful.
  • No "hoisting". That's a metaphor and behavior based on page-postition. Lose archaic metaphors. Precedence should have nothing to do with page-position. That's stupid.
  • No using + for string concat. Kick out dumb syntax.
  • Avoid pressing Shift-key whenever possible.
  • the language is designed to eliminate as much as possible for the most common sitations, and offer optional punctuation or syntax for other situations.
  • 2nd option: with boolean tests, maybe don't need to say "true" and "false". It's obvious!
  • optional module curlies when multiple variable-scopes share a file.
  • No new on instantiating a class, it's obvious. Stop making me think for the parser/compiler.
  • Mixed named and positional argument-passing, no problem.
  • object is global simply by assigning it in the global scope. It's obvious.
  • Cities indicates module-name. Name can be used to call fx within the module from another module.
  • module private
  • Variables are declared when first used. If memory optimization strategies require reserving the memory, let the compiler deal with that. Stop making me do the compiler's work.
  • oCity = city ['Boston', pop: 694,583] creates a new class called city, AND types whatever members it adds to the class. Future instances must conform to the types auto-declared by the first instance. Future instances can freely add more members, for which they can define datatypes. Classes can optionally be declared and typed before instantiated.
  • Collection cities automatically created by use of .add. It's obvious.
  • e prefix is enum. c is collection. o is object-instance.
  • No this baloney. No prototypes baloney.
  • greet oUser defines the parameter list for the greet fx. greet can optionally define it's own parameter list. Either way, they have to match, else compiler error. Either way, you'll get parser/compiler alerts and correct intellisense.
  • !isNull .email = sEmail .email assumes if no other logic reference, then .email refers to passed argument.
  • Possibly, when ad hoc class is created by a new instance, auto-type the class def into the IDE. Even if IDE doesn't support that, the class is still getting defined in background, and compiler/parser will still catch errors.
  • Everything is private unless you qualifiy it (with module name or lib name). If you qualify it, then you can use it.
  • for cities .byPop = .pop eQty >0, >1e6, >3e6 Applies a calculated member to each city called .byPop. Returns enum eQty.
  • lat-lon Dash/hypen is allowed in names.
  • oBoston = cities.add .city *'Boston', pop: 694,583 Auto-declares a new collection called cities. .city creates a new member called city. * means required member. Just like required fields on web-pages.
  • Would it make sense to have no distinction between object and collection?
  • !isNull .email = sEmail By default, receives output of line before it (or maybe only if this line is indented). Thus, it's test !isNull is testing return of previous line. Previous line says sEmail = ..., therefor, an assignment statement will return the assigned value to the next line (or to next line if it's indented). JS and BASH do something similar at console-- they print assigned value on an assignment.
  • Language is based on many assumed and unstated things. Some people hate that. This isn't the language for them. oUSA countries.add 'USA' wondering if we can forego =
  • oJapan = .add 'Japan' Implies same countries object as previous line for .add.
  • Code should use PATTERNS.
  • in is excessive. for already tells us we're looping a collection. therefor All we need is the collection. It wouldn't make sense to put two collections on the line, or no collections. Therefor, we can assume that the only collection on the line is the in.
  • Every for loop has an index number. Don't have to say it. We don't need a custom user-invented variable-name for index-number! Every loop in the universe has an index number. Every collection in your program has index numbers. Don't need to invent a new identifier for index number every time you loop a collection. Can use a standard keyword for index number: idx. Allow programmer to define custom identifier for all indexes. Allow later human to CHANGE the custom identifier for all indexes while reading.
  • Same for item identifier: itm.
  • CoffeeScript: for Name, Position in ['Sue, 'Bill']. The optional custom index-identifier Position is in same place as the item-variable, separated by comma, as :
    • It's ambiguous which position is the item, and which position is index. Putting index-identifier AFTER the collection eliminates the ambiguity.
    • Putting index-identifier AFTER the collection eliminates the need for comma. The collection is the separator.
  • don't need commas in arg list going to log. It's obvious. BASH doesn't use commas between arguments.
  • don't need qualifiers before log
  • log .name - min for with objects: the item implied by the for statement is the implied object for dot-members inside the for loop.
  • Allow programmer to define a non-default comment char. Maybe ; by default.
  • / would also be nice. Non-ambiguous at start of line, but could be ambiguaous at end of a line, depending on what precedes it.

JS Classes:

  • get and set are expected to be defined in order, so you don't have to say get or set.
  • Default value is written after the member name.
  • "private" variable is unstated
  • Write the processing methods or functions for get and set without mentioning the parameter or "private" variable. It's assumed.
  • . Dot is an alias for the parameter passed into set by the caller.
  • Eliminate + with a rule that says "a string followed by a value is assumed to be a concatenation."
object
    member defaultValue
        getProcessing
        setProcessing

Clone this wiki locally