Live data from Hacker News

Jsc: My New Best Friend

furbo.org

21–30 of 44 posts

Re: Jsc: My New Best Friend

#21
post #4

Not in front of a keyboard, but does tr not work? echo "something in turkish" | LC_ALL=tr_TR tr "[:lower:]" "[:upper:]"

It failed to convert the diacritics for me with LC_ALL="tr_TR.UTF-8" matching my /etc/locale.gen.

Kapı açık -> KAPı AçıK

However this worked: gawk '{ print toupper($0) }'

Re: Jsc: My New Best Friend

#22
post #8

Also on windows, C:\Windows\System32\cscript.exe ( https://en.wikipedia.org/wiki/Windows_Script_Host ) Which run a less modern version of ECMA script, but does have access to COM objects

a reminiscence of the pre powershell days I guess

Re: Jsc: My New Best Friend

#23
post #21
post #4

Not in front of a keyboard, but does tr not work? echo "something in turkish" | LC_ALL=tr_TR tr "[:lower:]" "[:upper:]"

It failed to convert the diacritics for me with LC_ALL="tr_TR.UTF-8" matching my /etc/locale.gen. Kapı açık -> KAPı AçıK However this worked: gawk '{ print toupper($0) }'

Drat, apparently tr (GNU tr anyway) only supports single-byte characters.

https://unix.stackexchange.com/questions/554901/how-to-chang...

Re: Jsc: My New Best Friend

#24
post #8

Also on windows, C:\Windows\System32\cscript.exe ( https://en.wikipedia.org/wiki/Windows_Script_Host ) Which run a less modern version of ECMA script, but does have access to COM objects

There's also the "jsc.exe" JScript.Net compiler included in .NET framework installs. You can access .Net assemblies and APIs. It's handy to have it out-of-the-box on modern Windows machines.

Re: Jsc: My New Best Friend

#25
post #8

Also on windows, C:\Windows\System32\cscript.exe ( https://en.wikipedia.org/wiki/Windows_Script_Host ) Which run a less modern version of ECMA script, but does have access to COM objects

C# and VB compilers are also available somewhere under system32 for the default .NET version shipped with the OS.

Re: Jsc: My New Best Friend

#26

Neat. Also if you've got java installed, there's jrunscript jjs Both invoke the nashorn javascript engine.

That has been dropped in Java 10 and Java 17 is getting released next month, thus only works in what I consider legacy runtimes.

https://openjdk.java.net/jeps/372

Re: Jsc: My New Best Friend

#27
Fun fact: until the most recent versions (0.64 and 0.65), React Native has used JSC as its JS runtime. You can now opt into Hermes (a mobile optimized JS runtime from FB open source) for both Android and iOS (although better supported on Android for now).

Re: Jsc: My New Best Friend

#28
post #12
post #3

Earlier quoted context omitted.

Yeah, there isn't really any reason to use it over something like nodejs, especially since it doesn't look like the code is portable (e.g. print instead of console.log, etc.). It's not like it's the only scripting language available either, OSX comes with ruby, python2, python3 and perl by default.

My understanding is that macOS doesn't ship those runtimes anymore.

On a current MBA/M1, which came with Big Sur:

  % which perl
  /usr/bin/perl
  % which python2
  /usr/bin/python2
  % which python3
  /usr/bin/python3
  % which ruby
  /usr/bin/ruby

Re: Jsc: My New Best Friend

#29

Javascript is more fun away from the web The most fun I've ever had programming was in max/msp https://cycling74.com/ things that are difficult to do in code, processing multiple simultaneous signals is done visually, running lines between object, but when you do want to write code, you open a code window and write javascript, and can then run visual patch cables to your javascript code representing the inputs and ou…

For (guitar) effects processing, there's also JSFX, which uses a scripting language similar to C/Javascript: https://www.cockos.com/EEL2/

Re: Jsc: My New Best Friend

#30
post #12
post #3

Earlier quoted context omitted.

Yeah, there isn't really any reason to use it over something like nodejs, especially since it doesn't look like the code is portable (e.g. print instead of console.log, etc.). It's not like it's the only scripting language available either, OSX comes with ruby, python2, python3 and perl by default.

My understanding is that macOS doesn't ship those runtimes anymore.

They're all still in the current Monterey beta (21A5294g) but python2 says (paraphrasing) "this is only for compatibility; it might not be here in future"
Post reply on HN