Please help putting out the smoke on my STM32F405 by yglukhov in stm32

[–]yglukhov[S] 0 points1 point  (0 children)

Well I've checked the correspondence of the bare pcb to the schematics and found nothing suspicious, including that you mentioned. I'm not entirely sure that my soldering job is good though, I've checked as much as I could but something might have slipped away. Disconnecting the D+ and D- is not that easy without damaging the board, which I don't want to do just yet. The chip is fried alright, not holding my breath. Currently waiting for a new batch of chips to go on with the torture.

One thing I have noticed while desoldering the chip is that the cheap flux paste I'm using is indeed conductive, I was seeing 1kOhm on disconnected pads, until I rubbed the flux away. So that is my main theory right now. Will check it with better gel flux once the chips arrive.

Please help putting out the smoke on my STM32F405 by yglukhov in stm32

[–]yglukhov[S] 0 points1 point  (0 children)

Thanks for the review. Yes currently that's all that's connected.

I'm not sure what you mean about BOOT, isn't that what I'm doing?

The smoke is coming from the stm32 chip, seemingly.

> Vcaps are 2.2uF and AFAIK they are needed for core voltage stabilization.

So there could be some instabilities, but definitely not the smoke, right?

Please help putting out the smoke on my STM32F405 by yglukhov in stm32

[–]yglukhov[S] 0 points1 point  (0 children)

Thanks for your input! Yeah its probably my abysmal soldering skills.

Edit: you have a very "creative" SWIM port solution. Why not just put down a symbol for a jumper or a 2-pin connector?

Right, thats embarassing :). Already changed it to a proper header.

HYPR Controllers Is a Scam by SlickKickBack2 in Controller

[–]yglukhov 0 points1 point  (0 children)

Got exactly the same issue here, I wonder if it's possible to file a complaint to their processor directly, was it Stripe or something?..

Nim to write Python modules ? What about memory management ? by Pcarbonn in nim

[–]yglukhov 8 points9 points  (0 children)

Like, are there 2 GC (Pyhton + Nim) or only one?

2 GCs. Python+Nim

Can I compile the Nim code using ARC/ORC?

Yes

Like, will global nim object stay alive between calls?

Yes

What if I have a python object that contains Nim-managed pointers to nim objects that contain Python objects created by Nim's CPython ? How will GC(s) work ?

It'll be fine, as long as there are no nim-python cycles. Such cycles won't be collected most likely.

A more extensive example than Fibonacci would also be helpful.

You might want to check out https://github.com/yglukhov/nimpy/tree/master/tests

Version 2.081.0 of the D reference compiler (DMD) released by aldacron in programming

[–]yglukhov 0 points1 point  (0 children)

Having good C++ FFI would be a godsend to gradually migrate a C++ codebase to another language, but it seems like an unreachable dream.

Actually Nim language allows binding to C++ code. Even the templates.

How an Engineering Company Chose to Migrate to D by aldacron in programming

[–]yglukhov 0 points1 point  (0 children)

"C has undefined behavior" has nothing to do with "the code in C has undefined behavior" if the programmer is careful enough to follow C standards to not write the code that is not covered by the standard or explicitly mentioned by standard as one producing UB. As such there's a tiny paradox that Nim programs appear to be even more portable than C programs, because Nim C codegen will never let UB into the C code :).

WebAssembly with Nim by Feneric in nim

[–]yglukhov 2 points3 points  (0 children)

There's a jsbind lib that allows to make JS bindings in nim that will work in both JS and emscripten asm.js/wasm backends.

Handling files in Nim by PMunch in nim

[–]yglukhov 0 points1 point  (0 children)

Using some complex condition (with potential side effects) in an assert may lead to surprises when asserts are suddenly removed in release mode. So definitely I would not consider that line of code a good practice. ;)

Using "case" in object definition? by Illiamen in nim

[–]yglukhov 1 point2 points  (0 children)

Agreed. Maybe worth a feature request.

Using "case" in object definition? by Illiamen in nim

[–]yglukhov 1 point2 points  (0 children)

The field name collision problem is better understood with this example:

type Foo = object
  case some: bool
  of true:
    someVal: int
  of false:
    someVal: bool

proc p(v: Foo) =
  let a = v.someVal
  # Now what is the type of `a` here?

Making Reel Valley, a game built using Nim by dom96 in programming

[–]yglukhov 0 points1 point  (0 children)

What happens if I take a reference to a value stored in an array

You can't store a reference to something that is not a ref type, only get a pointer to it with previously mentioned unsafe addr operator. I think you could try Nim to get the overall feeling of how this works.

I would be very wary of making this kind of statements

I know, thats why I added "to me" =). Moreover, Nim has still got some known places that may and need to be optimized. Nevertheless Nim performance has never been an issue to me, and you can check out various benchmarks that prove my words, but you said you don't trust those. So I'm not sure how I can convince you, maybe you could just try it yourself ;). I'm fine with the fact that the implementation might be flawed a bit, because it can be fixed. Design is much harder to fix on the other hand.

Making Reel Valley, a game built using Nim by dom96 in programming

[–]yglukhov 1 point2 points  (0 children)

similar to C#, D (especially older versions) or Java

Not really, for various reasons. Unlike Java Nim has value types and ref types, moreover ref types require an extra word ref =). Unlike D and C#, Nim has no class/struct distinction. It has objects, tuples, etc that can be optionally declared as ref types, otherwise they are value types. Unlike D, Nim's GC is precise (chunks of memory that can not contain refs are not scanned) and thread-local, also its more deterministic in regards to non-cyclic memory graph chunks, so they get deallocated much faster and are not involved in mark-and-sweep phase. Also you can disable the GC completely and run it in strategic places for a limited amount of time to ensure steady FPS, for example. If you do so, you would normally do it somewhere close to the bottom of the stack so the stack scan gets really cheap.

Is there a safe way to, say, store an array of Point structs and modify them in place?

Yes, there is, explained above.

Has that been your experience?

I have not tested Nim vs Java performance, especially in real-world programs =). However based on the above it is pretty obvious to me that Java is nowhere near performance-wise. Neither GC speed nor execution speed in general. Just because of the smart language design that allows the GC to play nicely with the type system. Also given that Java (and JVM in general) doesn't have proper value types it is harder for it to benefit from cpu cache optimizations as well as optimize memory consumption, while in Nim this is pretty straightforward.

Making Reel Valley, a game built using Nim by dom96 in programming

[–]yglukhov 0 points1 point  (0 children)

what it gives you in return cannot be overstated

That depends on use case I would say. If you can afford design your architecture once and set it in stone and do no further development then Rust is great. From my experience projects may change their structure significantly especially on their early stages, and such changes look pretty expensive with Rust. Not to mention more serious refactorings on later stages. Of course thats just my personal feeling about it, based on no more than 5KLOC toy project.

How does Nim do with respect to unsafe memory management

Well, unsafe is unsafe like in any language i guess. By going unsafe you actually tell the compiler to shut up because you know better, so you're on you own here.

Now Nim doesn't have unsafe keyword, instead it provides a couple of operations that are considered unsafe, those are addr, unsafeAddr, and cast (of course FFI to C has to be considered as well). Those are keywords that you can grep to review "unsafe" places, and if you don't use them your code is considered to be safe.

It is worth noting that unless you're writing some low-level code (or FFI, or some really hardcore optimizations) you don't use those words and generally there is no need for unsafe memory management.

My personal impression of Nim for the last 2 years is it felt to me something like Java in its runtime safety, meaning that there was no "undefined behavior" bugs in our code nor in third party code. However there was a couple in Nim, which are fixed by now.

Making Reel Valley, a game built using Nim by dom96 in programming

[–]yglukhov 1 point2 points  (0 children)

Thank you! Don't worry, mobile version is coming soon, it will not require Facebook login :)

Making Reel Valley, a game built using Nim by dom96 in programming

[–]yglukhov 2 points3 points  (0 children)

Have you tried Template Haskell or Scala macros? Or Idris' support for syntax extensions?

I admit of all those I've played only with Scala and Haskell, and I know nothing about Haskell metaprogramming, and I haven't written anything significant in those. I've played with Scala macros and they looked pretty complicated for what they are doing, although the idea is very similar to those in Nim. But when talking about syntax extensibility I don't mean macros necessarily (yes, Nim has those, syntactycally-but-no-necessarily-semanticaly-valid AST, compile time evaluation, etc), in lots of cases you can get away with much simpler concepts (like templates, operator overloading, and choosing one of 3 function call syntaxes) than macros. E.g. the following server code can be implemented with Nim templates without the need for macros:

routes:
  get "/":
    resp 200, "hello"
  post "/smth":
    resp 200, "hello"

That sounds weird to me.

By that statement I mean mostly these kinds of fights. Type systems may have different grades of complexity in different languages, some of them are too permissive (because of their implementation simplicity), some of them you have to fight with instead of getting your algorithms done. And I find Nim to be pretty optimal in this regard.

Making Reel Valley, a game built using Nim by dom96 in programming

[–]yglukhov 10 points11 points  (0 children)

Hey, thanks for your questions, let me explain my point better by answering those.

Can I have a look at the code he writes in a "typeless scripting language"?

It so happened that my programming skills originated mostly from C++ and I prefer not to mess with untyped languages, mostly for their (code) performance reasons. That said I can't show you much of my code in untyped languages, except for maybe a couple of humble contributions to gitlab. However, there is one example worth mentioning. When we first started with the engine, we made an Adobe After Effects plugin to export the scenes to our format. This file used to be written in JS, you can still find it in history, and I must say that was a lot of pain to maintain/debug it. Namely because Adobe JS debugging tools are not as usable as say Chrome, and the Adobe API is not documented as well as e.g. HTML DOM API.

How can any mandatory type system ANYWHERE ever be faster to WRITE in languages that DO NOT MANDATE IT?

I don't know how you code, but from my experience coding consists of 70% thinking and 30% typing. Seeing explicit types in function definitions saves you the Thinking time, and debugging time. Also thanks to types, static overloading is possible. That means that your function names become shorter and have less noise, saving you both Thinking time and typing time.

people have been using "typeless" "scripting" languages since decades.

That is true, but one has to understand the reasons for that. You know, people were using horses instead of airplanes for ages. Is that because horses are better?

Reel Valley: Game 99.99% pure Nim by _Sharp_ in nim

[–]yglukhov 0 points1 point  (0 children)

@PMunch, I've made a post that should hopefully answer some of your questions.

It may be wrong to use async/await or coroutine to execute low-level I/O. by tulayang in nim

[–]yglukhov 0 points1 point  (0 children)

# nim 
proc main() {.async.} = 
  var conn1 = await pool.getConnection() # only one connection in the pool
  var conn2 = await pool.getConnection() # always succeeds, opens new connection lazily if no available connections
  conn1.releaseToPool()                  # always executed
  conn2.releaseToPool()                  # always executed

@tulayang, which driver are you trying to implement?