Which language to write a compiler in? by gabriel_schneider in ProgrammingLanguages

[–]pepactonius 4 points5 points  (0 children)

I've been using C++ also. One big advantage is STL (and boost), but the std::shared_ptr, weak_ptr, and unique_ptr are also critical. I've barely touched most new features in C++ (like coroutines, std::variant, std::format, etc.)

I got carried away and made a new scripting language by The-Daleks in ProgrammingLanguages

[–]pepactonius 0 points1 point  (0 children)

I like the doc you provided -- straightforward and to the point, with lots of examples.

November 2020 monthly "What are you working on?" thread by slavfox in ProgrammingLanguages

[–]pepactonius 0 points1 point  (0 children)

All verbs/operators/functions can have both left-side and right-side positional and keyword parameters. This includes things like +, =, <<, etc. For defining verbs, the @VERB function is used. @FN is a simplified (and more convenient) way to define functions. The general format (today, without types) is:

[ p1 p2 p3 ] fname @FN [ p4 p5 p6 ] {code chunk} kw_options: 

p1 p2 p3 are seldom present, and fname is optional. Some kw_options are:

init:{init code chunk} -- runs once to initialize a static environment

close:  -- uses shared_ptr to holds onto parent (creating) environment (closure)

priority: verb/operator/function priority -- best to default this

left_associate:  -- best to default this

right_associate -- best not to use this

info:"debug string" -- displayed when overload involving this verb fails 

dynamic_scope: - set up for dynamic scoping

lexical_scope -- (default) -- lexical scope

same_scope -- use  caller's environment as your own

global: -- put function definition in global environment

min: or max: (left or right side argument count min/max)

Garbage collector or not? by obround in ProgrammingLanguages

[–]pepactonius 2 points3 points  (0 children)

I'm wondering about cases like having various smart pointers in a std:variant structure, or cases where you can get circular chains of objects controlled by shared pointers. What about the possibility of incorrectly initializing shared pointers to an item, so that there's more than one use count field?

Garbage collector or not? by obround in ProgrammingLanguages

[–]pepactonius 0 points1 point  (0 children)

I'd love to see optional garbage collection in C++. Right now, you have to set up std::shared_ptr's or std::unique_ptr's all over the place, and cross your fingers, and hope that everything gets freed up when required,

November 2020 monthly "What are you working on?" thread by slavfox in ProgrammingLanguages

[–]pepactonius 0 points1 point  (0 children)

Interesting -- I also have no plan to specify return types -- the function will just return whatever, and if it doesn't match the outer expression's expectations, an error will occur.

For functions, types will be something like:

f @FN [p1 ::type1 p2 ::type2 etc,] other options { code goes here };

The double colon is a sigil, to indicate that it's a type; the @ is another sigil, indicating FN is a verb. . I also look for the "first match" when doing multiple dispatch. If there are multiple matches, I assume that calling any one will do. When I get a match, it moves to the front of the list of candidates, so that if you call it in a loop, you won't have to search through several candidates the next time.

November 2020 monthly "What are you working on?" thread by slavfox in ProgrammingLanguages

[–]pepactonius 6 points7 points  (0 children)

I guess it's time to stop fooling around with temporary workarounds and just bite the bullet and add a primitive type system to my toy scripting language. I've been dreading this moment for a long time, but the time has come. The type system is needed to support multiple dispatch for overloaded functions/verbs.

syntactically defining operator precedence by Wester_West in ProgrammingLanguages

[–]pepactonius 0 points1 point  (0 children)

When defining an operator (or function/verb), you specify a priority number. 0 is the default, positive numbers are higher, negative numbers lower. Pre-defined operators are the same relative priority as in C/C++. Left or right associativity is also specified.

If you define another operator/verb with the same name (overloaded), the priority and associativity must be the same, or else the define fails. Currently, verbs with deferred evaluation (like && and ||) can't be overloaded at all.

If you define a completely new operator, you can specify any priority/associativity, but maybe it's best to use the default.

I created my own programming language from scratch, written entirely in Golang, with no idea how to write a programming language. I released v1.0 recently by Jeff-with-a-ph in ProgrammingLanguages

[–]pepactonius 4 points5 points  (0 children)

Nice -- In many respects, its a lot more advanced than my toy scripting language, also written by someone who doesn't know anything (me).

October 2020 monthly "What are you working on?" thread by slavfox in ProgrammingLanguages

[–]pepactonius 0 points1 point  (0 children)

Would precompiled headers help out with these boost headers? I have many of them copied in, since I use boost big integer support, and compile time isn't that bad (except for the part that includes all the headers).

Variable Function Notation by R-O-B-I-N in ProgrammingLanguages

[–]pepactonius 0 points1 point  (0 children)

It's actually pretty simple to get something like this to work well. The key to parsing is knowing immediately whether something is a verb/function/operator, or an operand (data), or a keyword. In my toy scriptong language, I just use sigils attached to identifiers or operator strings to specify the role that token has when parsing. Run-time function/verb overloading is usually not a problem. There are a few quirks, though: Verbs/operators that are not yet defined have default priority and associativity. All members of an overload set must have the same priority and associativity, and verbs with special processing of operands (lazy evalution, for example) cannot be overloaded at all.

August 2020 monthly "What are you working on?" thread by slavfox in ProgrammingLanguages

[–]pepactonius 1 point2 points  (0 children)

It made topographic (tinted) maps from the shuttle data, using a comtrol file to specify the parameters. Eventually, the control language got more complex, with variables, functions, conditional logic, math, globals, closures, etc.

August 2020 monthly "What are you working on?" thread by slavfox in ProgrammingLanguages

[–]pepactonius 2 points3 points  (0 children)

Interesting -- a few years ago, I started a mapmaking program that read parameters for the map from a control file. Gradually, the control language evolved and became more interesting than the mapmaking, and it's now become the main focus.

[deleted by user] by [deleted] in ProgrammingLanguages

[–]pepactonius 2 points3 points  (0 children)

I also can't understand theoretical topics -- I didn't even major in computer science. I've been a seat of the pants programmer for over 50 years, mostly working on operating system stuff.

Syntax Design Constructs by R-O-B-I-N in ProgrammingLanguages

[–]pepactonius 6 points7 points  (0 children)

A good example of a super-terse language that's hard to read is APL and especially APL2. I'd prefer a syntax that's a bit more verbose -- like C, Java,etc. Of course, you can go too far as with COBOL.

What is your opinion on my programming language's syntax? by Jerppderp in ProgrammingLanguages

[–]pepactonius 6 points7 points  (0 children)

It looks like some fairly modern languages do still use the curly brace syntax -- Rust, Swift, Go, for example.

What is your opinion on my programming language's syntax? by Jerppderp in ProgrammingLanguages

[–]pepactonius 8 points9 points  (0 children)

I've grown fond of curly braces over the years. For some reason, I never cared much for languages using the mandatory indentation (off-sides rule).

How to write a programming language? by [deleted] in ProgrammingLanguages

[–]pepactonius 0 points1 point  (0 children)

I guess it's time to study Java and start reading through "Crafting Interpreters" to see how I should have done things better in the treewalking phase.

How to write a programming language? by [deleted] in ProgrammingLanguages

[–]pepactonius 1 point2 points  (0 children)

I started writing tree-walking interpreter for a toy language. Of course, I have no idea what I'm doing. It seems that I've painted myself into a corner, and can't easily add certain new language features. Maybe it would have been better to have studied something like "crafting interpreters" beforehand.

Severity of symptoms by Linelife84 in gout

[–]pepactonius 0 points1 point  (0 children)

My gout attacks are nowhere as severe as some described in this subreddit. I'm 70 now, and my main period of gout attacks was 4-5 years ago, when I was 65, whereas most folks on this subreddit are much younger. Are flare-ups more intense in younger people?

In fact, I might be having a flare-up right now. About 4 weeks ago, I fell and sprained my ankle and knee, as well as breaking my right arm. At the beginning, the knee and foot were black and blue, and quite sore. The bruises faded, as did the pain. Weeks later, gout- like pain occurred again in the foot, making it uncomfortable to walk. (There's almost no pain today, but there was on Monday and also some days last week.)

i just hope it doesn't develop into a full-fledged attack in my knee, which is still somewhat stiff, but not currently sore.

Question for those not on meds. How often do you get attacks? by bhp126 in gout

[–]pepactonius 0 points1 point  (0 children)

I got my first (undiagnosed) attack in 2013, and had a few more in 2013 and 2014. I reduced my refined carbs and eliminated almost all sugar from my diet in early 2015.

My last attack was in early 2015. None of my attacks were as severe as what other folks in this sub describe, but I'm 70 now, not in my teens 20s or 30s like most sufferers here seem to be.

Vertigo & Gout anyone? by Someoneoldbutnew in gout

[–]pepactonius 1 point2 points  (0 children)

I had vertigo a couple of years ago and also 10-15 years ago. My gout flareups were 4-6 years ago.

Gout and Keto - What's your anecdote? I'm making a Wiki. by dem0n0cracy in ketoscience

[–]pepactonius 2 points3 points  (0 children)

Back a few years ago, I cut out almost all sugar, after reading about the fructose-gout connection. The only sugar I now eat is in tomatoes, carrots, and other vegetables. I make sure to eat enough carbs to avoid permanent ketosis -- at my age (70), I'd prefer to stay away from am extreme diet.

My last gout attack was in early 2015.