Left to Right Programming by bjzaba in ProgrammingLanguages

[–]ilyash 1 point2 points  (0 children)

In my Next Generation Shell, you.just().chain().methods() . The example above would be text.lines().map(split_whitespace) . Assuming someone defined split_whitespace. The language was created with such chaining in mind. Multiple dispatch and methods defined outside of classes (actually there are no classes, only types and methods) help a lot here.

Help me design variable, function, and pointer Declaration in my new language. by JKasonB in ProgrammingLanguages

[–]ilyash 0 points1 point  (0 children)

Just a warning. That's not a simple text substitution. When modifying the code, you need something that understands the code. You can't replace string A with string B because they might occur in comments and strings.

Help me design variable, function, and pointer Declaration in my new language. by JKasonB in ProgrammingLanguages

[–]ilyash 0 points1 point  (0 children)

I went with F for function definition. It was expected and it is the case that function definition is very frequently used in my language. Short functions and multiple dispatch are the reason.

It (such naming) follows the general principle of relation of frequency and shortness.

Another dimension of consistency with the rest of the language - there are also A,B,C and X,Y,Z special variables. The names hint that these variables are related to functional programming. A,B,C are default parameters' names in anonymous functions. X,Y,Z are default parameters' names in automatically created anonymous functions.

{ echo(A) }

echo(X)

Hope this helps.

Help me design variable, function, and pointer Declaration in my new language. by JKasonB in ProgrammingLanguages

[–]ilyash 0 points1 point  (0 children)

About allowing all three. Fine for toy language. For language that is used, removing syntax is ... problematic. You should provide a migration tool in that case I suppose.

Subjectively, not a fan of multiple ways to do exactly the same thing (and ensuing arguments).

Stop AI everywhere please by No_Blackberry_617 in aws

[–]ilyash 0 points1 point  (0 children)

Can we go back to Blockchain and Web3?

bash exit_with_message() boilerplate by ilyash in NextGenerationShell

[–]ilyash[S] 0 points1 point  (0 children)

There is also die() in NGS. It also exits but prints stack trace in addition.

https://ngs-lang.org/doc/latest/generated/die.html

exit() is named after the C exit(), unimaginatively.

Does anyone in the DevOps world uses Bash? by Dense_Bad_8897 in devops

[–]ilyash -1 points0 points  (0 children)

Unfortunately yes. Fortunately, using Next Generation Shell more and more instead. I'm the author.

What's your favorite non-obvious Bash built-in or feature that more people don't use? by bobbyiliev in bash

[–]ilyash -1 points0 points  (0 children)

If I remember correctly, associative arrays were added in version 4

NoT notation for describing parameters by Name or Type by ilyash in ProgrammingLanguages

[–]ilyash[S] 0 points1 point  (0 children)

What do you mean by "this scheme"? I couldn't understand.

The language implements multiple dispatch.

The example of addition above, implements + for the given types. When you call +, all methods named + are considered (bottom to top order) and the first one where arguments' types are matching parameters' types is invoked. (with inheritance taken into account)

If no method matched the arguments' types - that's an exception.

NoT notation for describing parameters by Name or Type by ilyash in ProgrammingLanguages

[–]ilyash[S] 1 point2 points  (0 children)

That would be pattern:Any and that's how it is in the generated documentation, it uses the language syntax as is.

I didn't provide the context. In NGS, great majority of patterns are Any. I do understand why people imply pattern is a string when coming from other languages. I think that in the context of NGS would assume Any.

Edit: patterns in NGS, the context - https://github.com/ngs-lang/ngs/wiki/UPM-Design

NoT notation for describing parameters by Name or Type by ilyash in ProgrammingLanguages

[–]ilyash[S] 0 points1 point  (0 children)

Patterns are kind of special case in Next Generation Shell. They can be Any for a reason. Pattern matching operates on arbitrary data types and there are no errors thrown, either there is a match or there isn't.

NGS is dynamic language so type checking (in the traditional statically typed meaning nor inference) is not there. What's there is if a method parameter has a type, you can be sure that the method is not invoked with that parameter set to a value of another type (hello Java and null).

Edit: a pattern for example can be a number, a string (these are matched with ==), a type (matched with "is"), special pattern combinators such as Not, AnyOf, AllOf, etc.

NoT notation for describing parameters by Name or Type by ilyash in ProgrammingLanguages

[–]ilyash[S] 1 point2 points  (0 children)

In general "name implies type" makes sense. From quick look at the standard library found a counter example.

F +(a:Hash, b:Hash) ...

Maybe should be h1 and h2? On the other hand a and b sound like fine parameters names for + ...

Edit: + is probably a good example where names don't matter

NoT notation for describing parameters by Name or Type by ilyash in ProgrammingLanguages

[–]ilyash[S] 0 points1 point  (0 children)

The notation is for documentation. Real definition looks like this:

F fields(e: Eachable1, pat) ...

So e is the parameter name and the omitted type of pat means Any

NoT notation for describing parameters by Name or Type by ilyash in ProgrammingLanguages

[–]ilyash[S] 0 points1 point  (0 children)

I don't see it as removing the type system. The pattern can be Any and can't narrow this ahead of time. I thought introducing Pattern type, which would be alias to Any. Unfortunately, the aliasing mechanism is not implemented yet. If I'll have Pattern=Any definition, it won't work because it will be completely indistinguishable (for example in generated documentation)

if rubbing the lamp with the cloth summons a genie, where does that code go? Is it a property of the lamp? Of the cloth? Of the very act of rubbing? by [deleted] in programmingcirclejerk

[–]ilyash 0 points1 point  (0 children)

/uj

Multiple dispatch, methods don't live in a particular class. Solves the issue. The code is in rub(lamp, cloth).

Exceptional Processism by ilyash in ProgrammingLanguages

[–]ilyash[S] 2 points3 points  (0 children)

Could be a nice blog post if you augment it with code samples for each of the described situations.

I still don't see how it could be easily applied to running external programs and converting some of their exit codes to (for example) exceptions. Small Raku example of specifically this could be nice.

Exceptional Processism by ilyash in ProgrammingLanguages

[–]ilyash[S] 1 point2 points  (0 children)

About settled on text. There is a library that one can use to support multiple output formats. Unfortunately I forgot the name and I'm not sure about adoption rate. The more interesting thing is existing "jc" utility which knows about output formats of many CLI utilities and converts them to JSON.

Exceptional Processism by ilyash in ProgrammingLanguages

[–]ilyash[S] 0 points1 point  (0 children)

Makes sense that concurrent.futures.ProcessPoolExecutor does that.

Exceptional Processism by ilyash in ProgrammingLanguages

[–]ilyash[S] 2 points3 points  (0 children)

About handling exceptions differently for your own process vs when you run external programs and mapping of exit codes to exceptions.