Good language for metaprogramming?

  • 8 Replies
  • 1922 Views
*

Zero

  • Eve
  • ***********
  • 1287
Good language for metaprogramming?
« on: September 18, 2018, 10:13:52 am »
What programming language has good metaprogramming capabilities in your opinion?
(Preferably not s-exp based ;) )

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1729
    • mind-child
Re: Good language for metaprogramming?
« Reply #1 on: September 18, 2018, 11:56:06 am »
Javascript has that `eval` function that compiles a sring into code at runtime. And I thik assembler is a king of metaprogramming.

*

Zero

  • Eve
  • ***********
  • 1287
Re: Good language for metaprogramming?
« Reply #2 on: September 18, 2018, 02:24:58 pm »
Yes, you can also retrieve the source code of a function, by calling its toString() method.
There's also Reflect and proxies... Javascript is not bad at all :)

Assembler? That's an unexpected answer! but I can see what you mean...

*

Ultron

  • Trusty Member
  • *******
  • Starship Trooper
  • *
  • 471
  • There are no strings on me.
Re: Good language for metaprogramming?
« Reply #3 on: September 20, 2018, 12:21:48 pm »
I mentioned this previously however I concluded there is no interest on the topic. Check out my reply at

http://aidreams.co.uk/forum/index.php?topic=13359.msg54760;topicseen#new

I personally work with Javascript in various project with various requirements but would never use it for the discussed application.
Software and Hardware developer, and everything in between.

*

Zero

  • Eve
  • ***********
  • 1287
Re: Good language for metaprogramming?
« Reply #4 on: September 20, 2018, 02:44:48 pm »
... which makes Julia sexy again! Thanks for the link, I'll look into Julia's metaprogramming capabilities. :)

*

ranch vermin

  • Not much time left.
  • Terminator
  • *********
  • 947
  • Its nearly time!
Re: Good language for metaprogramming?
« Reply #5 on: September 21, 2018, 02:05:41 am »
truth table masks.

//A B C  S  C
//0 0 0  0  0
//1 0 0  1  0
//0 1 0  1  0
//1 1 0  0  1
//0 0 1  1  0
//1 0 1  0  1
//0 1 1  0  1
//1 1 1  1  1

the output is just as much data as the input is.
« Last Edit: September 21, 2018, 08:09:04 am by ranch vermin »

*

Zero

  • Eve
  • ***********
  • 1287
Re: Good language for metaprogramming?
« Reply #6 on: September 21, 2018, 08:41:09 am »
Homoiconicity is a funky thing. After all, every language has a source code made of strings, and every language can manipulate strings. However, closures are usually not accessible - as data - from the runtime.

In Javascript, I'd like a function to be able to refer to itself without knowing its own name. Before, there was "callee", but now you're supposed to give it a name and access it using its name, which is less powerful. They say it's because doing otherwise makes a lot of optimizations impossible.

You're maybe wondering the why of all this.

The other day, I was thinking about... some kind of world of functions. Building a system not as a whole, but rather as a landscape. You see Tron, the movie? There are programs running everywhere, living out their lives. I thought, what would it look like, for real?

Imagine a person is a Javascript function. There are two things we need first:
- It has to be currently "somewhere" geographically, and
- It has to move.

The "somewhere" is easy: some object, or some array (which are objects in Js) holds a reference to it. The landscape, so to speak, is an object, which has roots in "window" in the browser, or "global" in node.

It also has to move. So it must be executed, every now and then. There could be a "world scanner", that loops through every object, executing every function.

The closure of the function would represent its "mind". It is a part of a person that other persons cannot see.

It would have been neat to just call functions, and let them be able to access their own source code, to modify it when needed, but you can't in Javascript. So the simplest way to achieve this, is to call these persons-functions with an argument pointing to themselves (meaning these functions would have a "me" parameter). Their "this" would point to where they are, as usual.

That's a starting point.  :idiot2:

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: Good language for metaprogramming?
« Reply #7 on: September 21, 2018, 10:17:48 am »
It seems to me you are describing a type cellular automation (Conway’s Game Of Life).

Homoiconicity is not a native function of modern computers, therefore languages that can leverage Homoiconicity like Lisp where written in standard languages that can’t… if you get my drift.

My point being that even though Java does not have the functionality you require you can still write a language/ interpreter that does.

 :)
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

Zero

  • Eve
  • ***********
  • 1287
Re: Good language for metaprogramming?
« Reply #8 on: September 21, 2018, 11:00:26 am »
Sure... I get it.

But there are Javascript parsers written in Javascript, and you can get the source code of a function using its toString() method, so it's not direct homoiconicity, but we're still dealing with code as data. Which is pretty cool!

 


Requirements for functional equivalence to conscious processing?
by DaltonG (General AI Discussion)
November 19, 2024, 11:56:05 am
Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

342 Guests, 0 Users

Most Online Today: 529. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles