Buzz: A lightweight statically typed scripting language
51–60 of 91 posts
Re: Buzz: A lightweight statically typed scripting language
#52Earlier quoted context omitted.
English is not my native language, and "orthogonal concepts" always mean something along the lines of "mutually exclusive" in my head.
Not at all, it means independent from each other. Like the x and y coordinates of a point in a plane: you can set one of them to the value you want and it won't affect the other. This only happens when the x and y axes intersect at 90°, hence the "orthogonal".
Re: Buzz: A lightweight statically typed scripting language
#53Earlier quoted context omitted.
Static typing is orthogonal to scripting or GC.
Yes, but "statically typed scripting language" is a quite unusual combination of words [1], and there seemed nothing to back up the "scripting" concept, so I thought it might be something more akin to Nim or Zig (i.e. "scripty system programming"), and it wasn't. That was a missing line of thought that I should have explicitly stated, sorry for the confusion. [1] Especially when no type inference was mentioned.
Re: Buzz: A lightweight statically typed scripting language
#54Also, my only concern in the future is that I have to download 10+ different runtimes to my machine to be able to co-operate with others. But I guess Docker solves this.
Re: Buzz: A lightweight statically typed scripting language
#55Earlier quoted context omitted.
> actually unseat Python or bash or Lua These languages each have enough warts that lots of people and languages are chipping away at them. Go and Nim are doing the strong static typing that "feels like scripting" thing. Even Rust is making a bit of a dent, despite it being a systems language with memory semantics. There's plenty of room for all sorts of projects to try. Don't count anyone out. Even if the language n…
This is an excellent point and I think that while most languages will fade away in time, if they even contribute one new idea the project is worthwhile. If we had asked programmers in 1991 what the point of Python was, the responses would have probably been similar to the parent comment, and look at where it is now. I played around with Vala (a C# style language that compiled to C on Linux) back in 2010 and while I n…
I disagree, because back in 91 Guido released some rationale along with the language: https://www.tuhs.org/Usenet/alt.sources/1991-February/001749...
> This is Python, an extensible interpreted programming language that combines remarkable power with very clear syntax.
> This is version 0.9 (the first beta release), patchlevel 1.
> Python can be used instead of shell, Awk or Perl scripts, to write prototypes of real applications, or as an extension language of large systems, you name it. There are built-in modules that interface to the operating system and to various window systems: X11, the Mac window system (you need STDWIN for these two), and Silicon Graphics' GL library. It runs on most modern versions of UNIX, on the Mac, and I wouldn't be surprised if it ran on MS-DOS unchanged. I developed it mostly on an SGI IRIS workstation (using IRIX 3.1 and 3.2) and on the Mac, but have tested it also on SunOS (4.1) and BSD 4.3 (tahoe).
> Building and installing Python is easy (but do read the Makefile). A UNIX style manual page and extensive documentation (in LaTeX format) are provided. (In the beta release, the documentation is still under development.)
etc. Docs/tutorials were later fleshed out even more but always had some rationale: https://docs.python.org/release/1.4/tut/node4.html
Clojure has an explicit rationale page: https://clojure.org/about/rationale
If the authors don't even make a value proposition themselves, I assume the language is a learning exercise and won't take it seriously. Also not really worth critiquing things I don't like about it. Indeed, I see on the introduction:
> It started as a toy language following the excellent book Crafting Interpreters by Robert Nystrom.
Nothing wrong with that! Sometimes the value is mainly for the author, and that's great. Probably not going to contribute any new ideas though.
Re: Buzz: A lightweight statically typed scripting language
#56Yes! We're finally challenging the notion that scripting languages must inheritly be dynamically typed. Some say that types are too much of an overhead for small programs but I find it impossible to reason about the design of software without types. I even opt for TS over JS for throwaways...
All languages are both statically typed and dynamically typed. Or, if you want to be precise: statically checked and dynamically checked. Static vs dynamic refers to whether a check is performed before the program is run or when the program is run.
It's upsetting that even people who write languages use this nonsense taxonomy to describe what they do.
----
As a consequence, your enthusiasm... sort of comes from the place of not understanding something. My guess is that you are happy to see that there are type annotations in the language and they seem to be mandatory (? -- I haven't explored the language in detail enough to tell, but usually if the type annotation precedes an identifier in the grammar is not possible to make it optional).
What I think you (or the language's author) might be happy about is that there aren't built-in mechanisms in the language to convert between different types (or interpret the data stored in a variable in different ways). Such mechanisms exist to various degree in languages programmers don't normally call "dynamically typed" (even though, like I wrote before, this taxonomy is nonsense). For example, in C, everything is and integer in the end of the day, which makes a lot of implicit conversions possible. Or, for example, it's possible in Haskell to overload string literals making them something other than strings (eg. SQL prepared statements) making the meaning of the program depend on an annotation / compiler argument.
There are instances where it's genuinely convenient to have the language guess the type of data and there are instances where it leads to frustrating and difficult to discover bugs. Since a language has to make a decision for all such cases it's difficult to find a good middle ground. Below are some examples of when implicit type conversion is convenient:
* When everything in the language can be "printed" and operations involving strings implicitly convert everything to string. Alternatives involve complicated mechanisms of defining printing methods for various objects, while still not being able to write generic code that prints any inputted objects. Or creating automatic methods that print "something" about the object that usually ends up being useless (eg. the memory address of the chunk of memory occupied by the object). And so on.
* Reading user's input, especially interactively. If I had to spell out the types of arguments I pass down to Unix "find" command every time I use it, I'd have invented a language that would allow me not to do that and would've guessed the types from a more concise input.
* Arithmetic involving different flavors of numbers. Imagine there are languages where it's a tradition to define a special sub-type of some integral type for indexing of every array type the program uses. Imagine now that these types usually cannot be converted between each other. You probably haven't worked with a language like that, but if you want to see how you might like it, you could try Ada.
Re: Buzz: A lightweight statically typed scripting language
#57Couple of questions:
1. Does it support any type inference?
2. It looks like objects have to explicitly declare what protocols (interfaces?) they implement when the object itself is declared. Is that true? If so, why did you opt for that rather than the typeclass approach where the struct is declared separately from its interface implementations?
Re: Buzz: A lightweight statically typed scripting language
#58Earlier quoted context omitted.
There have been statically types scripting languages for ages. Embeddable ones, too. That's not new.
Any in particular that you're a fan of? (Genuinely curious)
Re: Buzz: A lightweight statically typed scripting language
#59Earlier quoted context omitted.
Java too. Rust is the only language I’ve used where “immutable” means everything through the whole reference tree is also immutable. Well, only language that allows mutation at all.
And C/C++. Probably other value based languages like Go and Zig. JavaScript probably behaves like that because `const` was tacked on (and it's dynamically typed so there's no place to mark parameters as const). There is Object.freeze() which sort of makes something immutable, but it's not really the same. Java doesn't even have const so I guess they just didn't care about const correctness or didn't have time to add…
More info here: https://go.dev/blog/constants
Re: Buzz: A lightweight statically typed scripting language
#60What makes a language a "scripting" one?
For me it's when it's useful for writing adhoc utility tools distributed as source, and directly runnable from source code in the terminal and without requiring a manual compilation step (but maybe requiring installing a runtime). E.g. Python, JS/TS with node.js/deno, Lua, Bash, Powershell qualify as scripting language, but C, C++, Rust are not. Of course there's a grey area of compilers which allow compiling and run…
A language can be designed once and then interpreters and compilers (and transpilers) can be made available for it.
Python is a classic example: it's most commonly interpreted, but can be compiled when performance matters.
C is usually compiled, but tcc offers the option to directly run it from source (-run).
History has given us both compilers and interpreters for various dialects of BASIC since the 80s.
Honestly I can't imagine why a language designer should decide upfront if the result of their study will be interpreted or compiled. And I have no idea what choices should they make to characterize it as a "scripting" language.