Readit News logoReadit News
shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
iddan · 3 years ago
Language designers: PROVIDE EXAMPLES IN ANY MAIN PAGE. Thanks
shogundev · 3 years ago
LMAO will do, check again in some minutes.

-Shogun

shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
teo_zero · 3 years ago
I'm going through the handbook and some things don't seem satisfactory.

Division always yelds a floating-point number, so the following doesn't work, you have to explicitly use floor():

  min = time / 60
  sec = time % 60
Also

  var x = [1, 2, 3]
  x[1] /= 2
It's weird that now x includes one float and 2 integers. Besides, x[1] == 1 evaluates to false because a float never equals an integer.

The description of 'for' loops is not complete. For example, does range(1, 10) go from 1 to 10 or from 1 to 9? What is the value of the iteration variable after exiting the loop?

The example to handle a variable number of arguments calls the function callee() with 0 to 4 arguments. So it IS possible to have functions with a variable number of parameters. What's the goal of this example, then?

shogundev · 3 years ago
Division yielding always a float is a python issue, in python you would use the floor division to get integers, but you cant do the same in plain shark because other target platforms might not have it.

You can disregard and ignore most floating to int conversions and checks if youre NOT targeting python. Other platforms generally have just double precision and no integers (incluiding the C and Java ones) but not happening in python.

In your example x[1] == 1 yields true in any platform. So dont worry.

The for loop will iterate exacly end - start times with a start of 0 if missing and finish after end - 1 has executed.

Using the iteration variable after loop exit is undefined behavior, some platforms keep the last value stored like python and javascript, others will make a wild assignment to a global variable every time like lua or the C/Java editions.

Functions do NOT have variable lenght calls, if you read the code a second time, what its doing is looking up an array based in arguments length, and proceeding to switch on each case.

Hope this helped, will update the handbook if something is unclear.

- Shogun

shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
Daeraxa · 3 years ago
Is the name "GameShark" not going to be a trademark problem? I don't think GameShark is sold any more but I assume somebody owns the trademark to it.
shogundev · 3 years ago
Thats why you should refer to it as GS or GShark XD. I was aware of it so no worries
shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
PeterWhittaker · 3 years ago
> Just tell GCC to shut up and try again, if persistent make an issue in GH.

That seems like a cavalier approach to type warnings. Sure, it may not be an issue, most of the time, but type warnings are there to highlight/suggest potentially bad code, e.g., poorly thought out or insufficient consideration given to typing, overflows, etc.

For a one-off or bit of hobby code, I'm quite happy to compile without warnings and/or to ignore whatever warnings my code generates, but for something I am sharing with others, especially releasing and hoping they will adopt, I crank the warnings to 11 and make sure compiles are clean, without pragmas.

shogundev · 3 years ago
The code compiles and runs very cleanly and smoothly under win32 and linux mint. This is probably an issue of size_t being different sized in a platform or the code using int64_t everywhere but int is 32 bit. Thanks (and is not ironic).

Shogun

shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
DasCorCor · 3 years ago
Would you consider releasing a less powerful version of the language with a smaller binary? Like a baby version? I’d be really curious what it could do do do do do do do.
shogundev · 3 years ago
Most the weight of the binaries is in the GameShark framework. You can get a tiny binary by erasing all files under /bin except shark(.exe) and system.shar
shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
DeathArrow · 3 years ago
My question is: what problems Shark solves?

Do we need Python in the front-end? Why?

shogundev · 3 years ago
Shark doesnt solves any problem you could not solve with other languages, its just better at handling a whole wide range of problems others cant solve. Have you dreamed making the frontend and backend of your site in the same language, or building the same game in PC, Mobile and Nintendo 3DS from the same codebase and just a few commands? I do, and shark is my attempt at doing it.

- Shogun

shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
robofanatic · 3 years ago
Is there a typo in the doc? Or is “hability” a real/madeup word?
shogundev · 3 years ago
There could be many, thanks for pointing it out O U O
shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
zestyping · 3 years ago
Intriguing!

I noticed one thing in the handbook:

> Care must be taken if you assign a given key to the null value: some platforms remove keys assigned to null from tables making them invisible to the in and not in operators.

It is really important to specify the exact behaviour and make sure all platforms behave the same way. You can't write portable programs if the behaviour differs from platform to platform.

shogundev · 3 years ago
Not happening. If you compile something to Lua assigning a key to nil will erase it, python and javascript will keep it. Pheraps making a special NullObject value to fill these slots would be a good idea, but you could not interact seamlessly with the target system and probably get a speed penalty.

Having the exact behavoir in all platforms is not possible in some cases, and these are the cases left 'undefined' in the handbook.

Hope this clears things a bit ;)

Cheers, -Shogun

shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
soulbadguy · 3 years ago
> Imagine a programming language with the syntax of python

I am not sure when the python syntax become such a beacon of quality, but that makes me genuinely sad; Especially with looking at all the other syntax (swift, kotlin, F#/ocaml, rust) out there.

shogundev · 3 years ago
I like swift and rust quite actually. Might make a shark VM from scratch in swift for the heck of it. :)
shogundev commented on Show HN: The Shark Programming Language   github.com/shogundevel/sh... · Posted by u/shogundev
themodelplumber · 3 years ago
Hey that looks pretty fun, thanks for sharing it & count me in, I'll try it. I like these zippy little lightweight languages that happen to have docs and SDL bindings and so on...

BTW how did you arrive at the name?

Edit: Running the linux build script, bit of an issue:

https://pastebin.com/fHzJAFwz

shogundev · 3 years ago
Just tell GCC to shut up and try again, if persistent make an issue in GH.

Shark used to stand for SHAred ARKitecture, since the language can compile to lua, python and javascript using the shared architecture found in the three. Now it stands for nothing really.

Edit: Typo check O _ O

u/shogundev

KarmaCake day74March 22, 2023View Original