Live data from Hacker News

Maccarone: AI-managed code blocks in Python

github.com

1–10 of 75 posts

Re: Maccarone: AI-managed code blocks in Python

#3
post #2

Would python decorators be better for something like this? I always get squeamish when I see magic comments

Decorators are a runtime construct, this is a code-writing-time feature, wouldn't it be confusing to have Maccarone find the decorators at write-time that then did nothing at runtime?

Re: Maccarone: AI-managed code blocks in Python

#5
post #3
post #2

Would python decorators be better for something like this? I always get squeamish when I see magic comments

Decorators are a runtime construct, this is a code-writing-time feature, wouldn't it be confusing to have Maccarone find the decorators at write-time that then did nothing at runtime?

There are examples of decorators having no runtime effects, such as typing.overload. Bit comments are probably more flexible here since it allows arbitrary blocks, not just function/class scopes.

Re: Maccarone: AI-managed code blocks in Python

#6
post #2

Would python decorators be better for something like this? I always get squeamish when I see magic comments

I guess comments provide a simple paradigm for many languages

comments are in most languages, so I can see that angle, but you still have to be able to parse all supported languages, no small feat

you can alternatively split generated code from human written code with files, keep the mapping in something more structured like a config file

I just normally see a better way to do the same thing a magic comment does, generally speaking. There is typically a better language construct if you limit yourself to that language (most common), and config files offer much more structure with existing tooling (mostly decode in your preferred language)

Re: Maccarone: AI-managed code blocks in Python

#7
post #5
post #3

Earlier quoted context omitted.

Decorators are a runtime construct, this is a code-writing-time feature, wouldn't it be confusing to have Maccarone find the decorators at write-time that then did nothing at runtime?

There are examples of decorators having no runtime effects, such as typing.overload. Bit comments are probably more flexible here since it allows arbitrary blocks, not just function/class scopes.

How would not having the source code be present/pre-generated, and thus needing to generate it at runtime, be an example of a decorator having no runtime effects?

Re: Maccarone: AI-managed code blocks in Python

#8
It's so awesome to learn a new term like "macaronic language".

https://en.wikipedia.org/wiki/Macaronic_language

I finally have the right term to describe the warning signs from 1960's-era mainframes that coined "blinkenlichten".

https://en.wikipedia.org/wiki/Blinkenlights

There should be a German term for this, but "gefälschter deutscher" doesn't quite capture it.

Re: Maccarone: AI-managed code blocks in Python

#9
post #7
post #5

Earlier quoted context omitted.

There are examples of decorators having no runtime effects, such as typing.overload. Bit comments are probably more flexible here since it allows arbitrary blocks, not just function/class scopes.

How would not having the source code be present/pre-generated, and thus needing to generate it at runtime, be an example of a decorator having no runtime effects?

I had the urge to try this out a while back, here's what I came up with: https://gist.github.com/nkrumm/2b154ea2041511233079222373c83...

The decorator invokes AI completion only the first time the function is run.

edit: I lost interest before I was able to get arguments to work ¯\_(ツ)_/¯

Re: Maccarone: AI-managed code blocks in Python

#10
post #2

Would python decorators be better for something like this? I always get squeamish when I see magic comments

This is leaving a comment for another programmer, not the compiler or interpreter. It's what comments are for, actually, like writing a TODO.

You should be squeamish about running the code without reading it first, given that you're pair-programming with a bot.

Post reply on HN