←back to thread

17 points Hashex129542 | 3 comments | | HN request time: 0.628s | source

I'm developing a programming language, the keywords and features mostly based on Swift 5 but some additional features like,

1. async function will be called from no async function but no async/await keyword. If you want to block main thread then block_main() function will be used. block_main() /* operations */ unblock_main()

2. protocol can inherit another protocol(s) & protocol can confirm a class like swift.

3. no `let`. only `var`. compiler can optimize further.

4. if (a == (10 || 20 || 30) || b == a) && c { }

5. `Asterisk` is replaced to `x` operator for mul operations.

What are the features you found or you need in a programming language?

1. pizza ◴[] No.42200449[source]
Features from other languages I wish were Python builtins:

- Haskell algebraic data types + syntactic sugar

- C/Lisp macros

replies(1): >>42224489 #
2. gilch ◴[] No.42224489[source]
C macros are just a text preprocessor. You could run the C preprocessor on a text file and have the result be Python code. Comments might be a little tricky, but it's doable. Or you can run a text file through a general-purpose one like m4.

For sum types we have enums, and for product types we have tuples (or namedtuples or dataclasses). Sugar could be done with decorators or metaclasses.

For Lisp macros, there's macropy and Hissp.

https://www.gnu.org/software/m4/

https://threeofwands.com/algebraic-data-types-in-python/

https://github.com/lihaoyi/macropy

https://github.com/gilch/hissp

replies(1): >>42224610 #
3. kazinator ◴[] No.42224610[source]
C preprocessing is token-based. The input is decomposed into preprocessor tokens, sequences of which are then manipulated.

There are issues with using stand-alone implementations of C preprocessing like GNU cpp with languages that deviate from C in their token syntax.