3 ms·
in Scheme you can redefine `define` to be number 5. Easy to implement, but a nightmare in real world scenarios [0]. That's why languages like Go became popular,
by behnamoh 2y ago
in Scheme you can redefine `define` to be number 5. Easy to implement, but a nightmare in real world scenarios [0]. That's why languages like Go became popular, they're trashy, boring, and dumb, but that's exactly what's needed in big projects.
[0]: imagine your colleague wrote a macro that redefines for loops because at the time, it made life easier for him.
- codemac 2y ago> in Scheme you can redefine `define` to be number 5. This is like asking "what if your coworker named all errs as `ok`" so everything was `if ok { return errors.New("Not ok!!"); }`. It's possible but no one does it. This is why `defmacro` and `gensym` in common lisp are awesome, and similarly why Go's warts don't matter. Much of programming language ugliness is an "impact x frequency" calculation, rather than one or the other. It's also why javascript is so terrible, you run into it's warts constantly all day long.
- lolinder 2y ago"No one does it" is extremely relative. Take your closing remark about JavaScript: I don't run into JS warts very often at all, and I'm a professional web developer who works in it day in and day out. I guess my team just doesn't do dumb JS stuff? But apparently lots of other people do run into them regularly, so I believe that such things do exist. By the same token, I've heard countless reports of people struggling with the flexibility that Lisp offers, with co-workers who abuse it to create nightmarish situations. That you haven't experienced that doesn't mean no one does.
- codr7 2y agoI would definitely recommend mature teams for powerful languages, and the other way around. You wouldn't let a child handle a chainsaw.
- codemac 2y agoah you misunderstand me. I don't mean "do dumb stuff", I mean I've literally never seen anyone redefine the `define` keyword in any code. With javascript, I do see people use `===` frequently. It's a wart of the language that the operator even exist. It's not "dumb" to use it - it's how frequently are you assaulted with the bugs of the language (not bugs in your code).
- dullcrisp 2y agoThat’s true but I think if a major issue is having to type === instead of == then you’re probably doing okay.
- neilv 2y agoYou might have been misled by a CS professor's enthusiasm about what they thought was neat, or was a good way to communicate something. But I don't recall seeing someone re-define `define` in real life. Nor do I recall seeing any problematic redefinitions in Scheme in real life. That said, if you wanted to make a language variant in which `define` did something different than normal (say, for instrumentation, or for different semantics for variable syntax), then you'd probably use Racket, and you'd probably define your own `#lang`, so that the first line of files using your language would be something like `#lang myfunkylang`. You can randomly sample code in <https://pkgs.racket-lang.org/ https://pkgs.racket-lang.org/>, and look for people doing anything other than `#lang racket/base` or `#lang typed/racket/base`.